aboutsummaryrefslogtreecommitdiffstats
path: root/iceci
diff options
context:
space:
mode:
authorLovett, Trevor <trevor.lovett@att.com>2020-03-03 14:04:39 -0600
committersteven stark <steven.stark@att.com>2020-03-03 21:49:31 +0000
commitd7d8722ce27e308defb6764d8d76f85ce7d63927 (patch)
tree701e5aee2665bbde9298ea597e8f88355ec786d5 /iceci
parentca6342d22a8eb94436287efb1c9276e1d307b2e9 (diff)
[VVP] Removing outdated test-engine code
Issue-ID: VVP-381 Signed-off-by: Lovett, Trevor <trevor.lovett@att.com> Change-Id: I8622794a24deb83e14334e3454194914b835d37d
Diffstat (limited to 'iceci')
-rw-r--r--iceci/__init__.py38
-rw-r--r--iceci/admin.py131
-rw-r--r--iceci/apps.py43
-rw-r--r--iceci/decorator/__init__.py38
-rw-r--r--iceci/decorator/exception_decor.py69
-rw-r--r--iceci/decorator/logFuncEntry.py83
-rw-r--r--iceci/decorator/repeat.py50
-rw-r--r--iceci/mail.py186
-rw-r--r--iceci/migrations/0001_initial.py76
-rw-r--r--iceci/migrations/0002_auto_20160728_1111.py64
-rw-r--r--iceci/migrations/0003_auto_20160914_1004.py57
-rw-r--r--iceci/migrations/0004_testresults_build_id.py58
-rw-r--r--iceci/migrations/0005_auto_20161219_0619.py64
-rw-r--r--iceci/migrations/__init__.py38
-rw-r--r--iceci/models.py61
-rw-r--r--iceci/serializers.py82
-rw-r--r--iceci/urls.py51
-rw-r--r--iceci/views.py313
18 files changed, 0 insertions, 1502 deletions
diff --git a/iceci/__init__.py b/iceci/__init__.py
deleted file mode 100644
index 32b601a..0000000
--- a/iceci/__init__.py
+++ /dev/null
@@ -1,38 +0,0 @@
-
-# ============LICENSE_START==========================================
-# org.onap.vvp/test-engine
-# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
-# ===================================================================
-#
-# Unless otherwise specified, all software contained herein is licensed
-# under the Apache License, Version 2.0 (the “License”);
-# you may not use this software except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-#
-# Unless otherwise specified, all documentation contained herein is licensed
-# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
-# you may not use this documentation except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://creativecommons.org/licenses/by/4.0/
-#
-# Unless required by applicable law or agreed to in writing, documentation
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# ============LICENSE_END============================================
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
diff --git a/iceci/admin.py b/iceci/admin.py
deleted file mode 100644
index d9fac56..0000000
--- a/iceci/admin.py
+++ /dev/null
@@ -1,131 +0,0 @@
-
-# ============LICENSE_START==========================================
-# org.onap.vvp/test-engine
-# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
-# ===================================================================
-#
-# Unless otherwise specified, all software contained herein is licensed
-# under the Apache License, Version 2.0 (the “License”);
-# you may not use this software except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-#
-# Unless otherwise specified, all documentation contained herein is licensed
-# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
-# you may not use this documentation except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://creativecommons.org/licenses/by/4.0/
-#
-# Unless required by applicable law or agreed to in writing, documentation
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# ============LICENSE_END============================================
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-from django.contrib import admin
-from .models import TestResults
-from django.conf import settings
-
-
-def export_csv(modeladmin, request, queryset):
- import csv
-# import xlwt
- from django.utils.encoding import smart_str
- from django.http import HttpResponse
- response = HttpResponse(content_type='text/csv')
- response['Content-Disposition'] = \
- 'attachment; filename=ci_Test_Results.csv'
- writer = csv.writer(response, csv.excel)
- # BOM (optional...Excel needs it to open UTF-8 file properly)
- response.write(u'\ufeff'.encode('utf8'))
- writer.writerow([
- smart_str(u"testType"),
- smart_str(u"testFeature"),
- smart_str(u"testName"),
- smart_str(u"testResult"),
- smart_str(u"notes"),
- smart_str(u"duration"),
- smart_str(u"build_id"),
- smart_str(u"create_time"),
- ])
-
- total_counter = 0
- fail_counter = 0
- pass_counter = 0
- for obj in queryset:
- total_counter += 1
- if obj.testResult == 'FAIL':
- fail_counter += 1
- elif obj.testResult == 'PASS':
- pass_counter += 1
-
- writer.writerow([
- smart_str(obj.testType),
- smart_str(obj.testFeature),
- smart_str(obj.testName),
- smart_str(obj.testResult),
- smart_str(obj.notes),
- smart_str(obj.duration),
- smart_str(obj.build_id),
- smart_str(obj.create_time),
- ])
- # calsl evaluation
- evaultaion = as_percentage_of(pass_counter, total_counter)
- # title
- writer.writerow([
- smart_str(u"total_counter"),
- smart_str(u"fail_counter"),
- smart_str(u"pass_counter"),
- smart_str(u"evaultaion"),
- ])
- # values
- writer.writerow([
- smart_str(total_counter),
- smart_str(fail_counter),
- smart_str(pass_counter),
- smart_str(evaultaion),
- ])
-
- return response
-# export_csv.short_description = u"Export CSV" ### Check this action meaning.
-
-
-def as_percentage_of(part, whole):
- try:
- return "%d%%" % (float(part) / whole * 100)
- except (ValueError, ZeroDivisionError):
- return ""
-
-
-@admin.register(TestResults)
-class TestResultsModelAdmin(admin.ModelAdmin):
-
- list_display = [
- "testType",
- "testFeature",
- "testName",
- "testResult",
- "notes",
- "duration",
- "build_id",
- "create_time"]
- list_filter = ["testResult", "testType", "testFeature",
- "testName", "notes", "duration", "build_id", "create_time"]
- search_fields = ["testResult", "testType", "testFeature", "testName",
- "notes", "duration", "build_id", "create_time"]
- actions = [export_csv]
- list_per_page = settings.NUMBER_OF_TEST_RESULTS
diff --git a/iceci/apps.py b/iceci/apps.py
deleted file mode 100644
index 459b943..0000000
--- a/iceci/apps.py
+++ /dev/null
@@ -1,43 +0,0 @@
-
-# ============LICENSE_START==========================================
-# org.onap.vvp/test-engine
-# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
-# ===================================================================
-#
-# Unless otherwise specified, all software contained herein is licensed
-# under the Apache License, Version 2.0 (the “License”);
-# you may not use this software except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-#
-# Unless otherwise specified, all documentation contained herein is licensed
-# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
-# you may not use this documentation except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://creativecommons.org/licenses/by/4.0/
-#
-# Unless required by applicable law or agreed to in writing, documentation
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# ============LICENSE_END============================================
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-from django.apps import AppConfig
-
-
-class IceCiConfig(AppConfig):
- name = 'iceci'
diff --git a/iceci/decorator/__init__.py b/iceci/decorator/__init__.py
deleted file mode 100644
index 32b601a..0000000
--- a/iceci/decorator/__init__.py
+++ /dev/null
@@ -1,38 +0,0 @@
-
-# ============LICENSE_START==========================================
-# org.onap.vvp/test-engine
-# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
-# ===================================================================
-#
-# Unless otherwise specified, all software contained herein is licensed
-# under the Apache License, Version 2.0 (the “License”);
-# you may not use this software except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-#
-# Unless otherwise specified, all documentation contained herein is licensed
-# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
-# you may not use this documentation except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://creativecommons.org/licenses/by/4.0/
-#
-# Unless required by applicable law or agreed to in writing, documentation
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# ============LICENSE_END============================================
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
diff --git a/iceci/decorator/exception_decor.py b/iceci/decorator/exception_decor.py
deleted file mode 100644
index 2bbced7..0000000
--- a/iceci/decorator/exception_decor.py
+++ /dev/null
@@ -1,69 +0,0 @@
-
-# ============LICENSE_START==========================================
-# org.onap.vvp/test-engine
-# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
-# ===================================================================
-#
-# Unless otherwise specified, all software contained herein is licensed
-# under the Apache License, Version 2.0 (the “License”);
-# you may not use this software except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-#
-# Unless otherwise specified, all documentation contained herein is licensed
-# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
-# you may not use this documentation except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://creativecommons.org/licenses/by/4.0/
-#
-# Unless required by applicable law or agreed to in writing, documentation
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# ============LICENSE_END============================================
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-import traceback
-
-from services.logging_service import LoggingServiceFactory
-from services.session import session
-
-
-logger = LoggingServiceFactory.get_logger()
-
-
-def exception():
- """
- A decorator that wraps the passed in function and logs
- exceptions should one occur
-
- @param logger: The logging object
- """
-
- def decorator(func):
-
- def wrapper(*args, **kwargs):
- try:
- return func(*args, **kwargs)
- except BaseException:
- err = "There was an exception in %s" % func.__name__
- logger.error(err)
- session.errorCounter += 1
- session.errorList = traceback.format_exc()
- raise
-
- return wrapper
- return decorator
diff --git a/iceci/decorator/logFuncEntry.py b/iceci/decorator/logFuncEntry.py
deleted file mode 100644
index 3caac92..0000000
--- a/iceci/decorator/logFuncEntry.py
+++ /dev/null
@@ -1,83 +0,0 @@
-
-# ============LICENSE_START==========================================
-# org.onap.vvp/test-engine
-# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
-# ===================================================================
-#
-# Unless otherwise specified, all software contained herein is licensed
-# under the Apache License, Version 2.0 (the “License”);
-# you may not use this software except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-#
-# Unless otherwise specified, all documentation contained herein is licensed
-# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
-# you may not use this documentation except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://creativecommons.org/licenses/by/4.0/
-#
-# Unless required by applicable law or agreed to in writing, documentation
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# ============LICENSE_END============================================
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-from services.logging_service import LoggingServiceFactory
-logger = LoggingServiceFactory.get_logger()
-
-
-def _aop(decorator):
- '''This decorator can be used to turn simple functions
- into well-behaved decorators, so long as the decorators
- are fairly simple. If a decorator expects a function and
- returns a function (no descriptors), and if it doesn't
- modify function attributes or docstring, then it is
- eligible to use this. Simply apply @_aop to
- your decorator and it will automatically preserve the
- docstring and function attributes of functions to which
- it is applied.'''
- def new_decorator(f):
- g = decorator(f)
- g.__name__ = f.__name__
- g.__doc__ = f.__doc__
- g.__dict__.update(f.__dict__)
- return g
-
- # Now a few lines needed to make _aop itself
- # be a well-behaved decorator.
- new_decorator.__name__ = decorator.__name__
- new_decorator.__doc__ = decorator.__doc__
- new_decorator.__dict__.update(decorator.__dict__)
- return new_decorator
-
-#
-# Sample Use:
-#
-
-
-@_aop
-def logFuncEntry(func):
- def foo(*args, **kwargs):
- logger.debug(
- 'calling {}'.format(
- func.__name__) +
- " | " +
- str(args) +
- " | " +
- str(kwargs))
- return func(*args, **kwargs)
- return foo
diff --git a/iceci/decorator/repeat.py b/iceci/decorator/repeat.py
deleted file mode 100644
index cf57a14..0000000
--- a/iceci/decorator/repeat.py
+++ /dev/null
@@ -1,50 +0,0 @@
-
-# ============LICENSE_START==========================================
-# org.onap.vvp/test-engine
-# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
-# ===================================================================
-#
-# Unless otherwise specified, all software contained herein is licensed
-# under the Apache License, Version 2.0 (the “License”);
-# you may not use this software except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-#
-# Unless otherwise specified, all documentation contained herein is licensed
-# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
-# you may not use this documentation except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://creativecommons.org/licenses/by/4.0/
-#
-# Unless required by applicable law or agreed to in writing, documentation
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# ============LICENSE_END============================================
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-import time
-
-
-def repeat(times):
- def repeatHelper(f):
- def callHelper(*args):
- for i in range(0, times):
- f(*args)
- time.sleep(3)
- return callHelper
- time.sleep(3)
- return repeatHelper
diff --git a/iceci/mail.py b/iceci/mail.py
deleted file mode 100644
index 310f09e..0000000
--- a/iceci/mail.py
+++ /dev/null
@@ -1,186 +0,0 @@
-
-# ============LICENSE_START==========================================
-# org.onap.vvp/test-engine
-# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
-# ===================================================================
-#
-# Unless otherwise specified, all software contained herein is licensed
-# under the Apache License, Version 2.0 (the “License”);
-# you may not use this software except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-#
-# Unless otherwise specified, all documentation contained herein is licensed
-# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
-# you may not use this documentation except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://creativecommons.org/licenses/by/4.0/
-#
-# Unless required by applicable law or agreed to in writing, documentation
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# ============LICENSE_END============================================
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-##########################################################################
-'''
-Created on Apr 20, 2016
-
-@author: ya107f
-'''
-import socket
-from string import Template
-import traceback
-
-from django.conf import settings
-from django.core.mail import send_mail
-from django.utils import timezone
-
-from services.constants import ServiceProvider
-from services.logging_service import LoggingServiceFactory
-
-
-admin_mail_from = settings.ICE_CONTACT_FROM_ADDRESS
-# lastBuild = ""
-param = "1"
-logger = LoggingServiceFactory.get_logger()
-
-
-def sendMail(param, email, data, mail_body, mail_subject,
- mail_from=admin_mail_from):
- logger.debug("about to send mail to " + email)
-
- try:
- html_msg = mail_body.substitute(data)
- mail_subject = mail_subject.substitute(data)
- send_mail(mail_subject, '', ServiceProvider.PROGRAM_NAME
- + "-CI Report Test Team <" + mail_from + ">",
- settings.ICE_CONTACT_EMAILS, fail_silently=False,
- html_message=html_msg)
- logger.debug(
- "Looks like email delivery to " +
- email +
- " has succeeded")
- except Exception:
- traceback.print_exc()
- raise
-
-
-##########################
-# For Contact Request #
-##########################
-lastBuild = param
-dt = timezone.now().strftime("%Y-%m-%d %H:%M:%S")
-# envIP = str(socket.gethostbyname(socket.gethostname()))
-envIP = str(socket.gethostname())
-testsResults_mail_subject = Template("""CI Testing results """ + str(dt))
-testsResults_mail_to = settings.ICE_CONTACT_EMAILS
-testsResults_mail_body = Template(
- """
-<html>
- <head>
- <title>CI Test Report</title>
- <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
- </head>
- <body style="word-wrap: break-word; -webkit-nbsp-mode: space; """ +
- """-webkit-line-break: after-white-space; color: rgb(0, 0, 0); """ +
- """font-size: 14px; font-family: Calibri, sans-serif;">
- <a href="http://172.20.31.59:9090/">Jenkins Link for Build</a>
- <h3>Environment name : """ +
- settings.ICE_CI_ENVIRONMENT_NAME +
- """</h3>
- <h3>Environment IP : """ +
- envIP +
- """</h3>
- <h2>Tests summary</h2>
-
- <table id="versions" style="border:1px solid black">
- <tr>
- <th scope="col" class="sortable column-testVersion">
- <div class="text"><a href="#">Last Build Version</a></div>
- <div class="clear"></div>
- </th>
- </tr>
- <tbody>
- $paramData
- </tbody>
- </table>
-
- <table id="statistics" style="border:1px solid black">
- <tr>
- <th scope="col" class="sortable column-testTotal">
- <div class="text"><a href="#">Total</a></div>
- <div class="clear"></div>
- </th>
- <th scope="col" class="sortable column-testPass">
- <div class="text"><a href="#">Pass</a></div>
- <div class="clear"></div>
- </th>
- <th scope="col" class="sortable column-tesFail">
- <div class="text"><a href="#">Fail</a></div>
- <div class="clear"></div>
- </th>
- <th scope="col" class="sortable column-testEvaultaion">
- <div class="text"><a href="#">Successful</a></div>
- <div class="clear"></div>
- </th>
- </tr>
- <tbody>
- $statisticData
- </tbody>
- </table>
-
- <table id="result_list" style="border:1px solid blue">
- <tr>
- <th scope="col" class="sortable column-testType">
- <div class="text"><a href="#">TestType</a></div>
- <div class="clear"></div>
- </th>
- <th scope="col" class="sortable column-testFeature">
- <div class="text"><a href="#">TestFeature</a></div>
- <div class="clear"></div>
- </th>
- <th scope="col" class="sortable column-testName">
- <div class="text"><a href="#">TestName</a></div>
- <div class="clear"></div>
- </th>
- <th scope="col" class="sortable column-testResult">
- <div class="text"><a href="#">TestResult</a></div>
- <div class="clear"></div>
- </th>
- <th scope="col" class="sortable column-notes">
- <div class="text"><a href="#">Notes</a></div>
- <div class="clear"></div>
- </th>
- <th scope="col" class="sortable column-duration">
- <div class="text"><a href="#">Duration</a></div>
- <div class="clear"></div>
- </th>
- <th scope="col" class="sortable column-create_time">
- <div class="text"><a href="#">Creation time</a></div>
- <div class="clear"></div>
- </th>
- </tr>
- <tbody>
- $allData
- </tbody>
- </table>
-
- </body>
-</html>
-
-""")
diff --git a/iceci/migrations/0001_initial.py b/iceci/migrations/0001_initial.py
deleted file mode 100644
index b229156..0000000
--- a/iceci/migrations/0001_initial.py
+++ /dev/null
@@ -1,76 +0,0 @@
-
-# ============LICENSE_START==========================================
-# org.onap.vvp/test-engine
-# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
-# ===================================================================
-#
-# Unless otherwise specified, all software contained herein is licensed
-# under the Apache License, Version 2.0 (the “License”);
-# you may not use this software except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-#
-# Unless otherwise specified, all documentation contained herein is licensed
-# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
-# you may not use this documentation except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://creativecommons.org/licenses/by/4.0/
-#
-# Unless required by applicable law or agreed to in writing, documentation
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# ============LICENSE_END============================================
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-# Generated by Django 1.9.7 on 2016-06-06 13:51
-from __future__ import unicode_literals
-
-import datetime
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- initial = True
-
- dependencies = [
- ]
-
- operations = [
- migrations.CreateModel(
- name='TestResults',
- fields=[
- ('id', models.AutoField(
- auto_created=True, primary_key=True,
- serialize=False, verbose_name='ID')),
- ('testType', models.CharField(max_length=64)),
- ('testCaseName', models.CharField(max_length=64)),
- ('testResult', models.CharField(max_length=64)),
- ('testName', models.CharField(max_length=64)),
- ('notes', models.TextField(
- blank=True, max_length=1024, null=True)),
- ('create_time', models.DateTimeField(
- default=datetime.datetime(
- 2016, 6, 6, 16, 50, 59, 963000),
- verbose_name='creation time')),
- ],
- options={
- 'db_table': 'ice_test_results',
- 'verbose_name_plural': 'Tests Results',
- },
- ),
- ]
diff --git a/iceci/migrations/0002_auto_20160728_1111.py b/iceci/migrations/0002_auto_20160728_1111.py
deleted file mode 100644
index e8cdb00..0000000
--- a/iceci/migrations/0002_auto_20160728_1111.py
+++ /dev/null
@@ -1,64 +0,0 @@
-
-# ============LICENSE_START==========================================
-# org.onap.vvp/test-engine
-# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
-# ===================================================================
-#
-# Unless otherwise specified, all software contained herein is licensed
-# under the Apache License, Version 2.0 (the “License”);
-# you may not use this software except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-#
-# Unless otherwise specified, all documentation contained herein is licensed
-# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
-# you may not use this documentation except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://creativecommons.org/licenses/by/4.0/
-#
-# Unless required by applicable law or agreed to in writing, documentation
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# ============LICENSE_END============================================
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-# Generated by Django 1.9.7 on 2016-07-28 08:11
-from __future__ import unicode_literals
-
-import datetime
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('iceci', '0001_initial'),
- ]
-
- operations = [
- migrations.RenameField(
- model_name='testresults',
- old_name='testCaseName',
- new_name='testFeature',
- ),
- migrations.AlterField(
- model_name='testresults',
- name='create_time',
- field=models.DateTimeField(
- default=datetime.datetime.now, verbose_name='creation time'),
- ),
- ]
diff --git a/iceci/migrations/0003_auto_20160914_1004.py b/iceci/migrations/0003_auto_20160914_1004.py
deleted file mode 100644
index 88a27df..0000000
--- a/iceci/migrations/0003_auto_20160914_1004.py
+++ /dev/null
@@ -1,57 +0,0 @@
-
-# ============LICENSE_START==========================================
-# org.onap.vvp/test-engine
-# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
-# ===================================================================
-#
-# Unless otherwise specified, all software contained herein is licensed
-# under the Apache License, Version 2.0 (the “License”);
-# you may not use this software except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-#
-# Unless otherwise specified, all documentation contained herein is licensed
-# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
-# you may not use this documentation except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://creativecommons.org/licenses/by/4.0/
-#
-# Unless required by applicable law or agreed to in writing, documentation
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# ============LICENSE_END============================================
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-# Generated by Django 1.9.7 on 2016-09-14 10:04
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('iceci', '0002_auto_20160728_1111'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='testresults',
- name='notes',
- field=models.TextField(blank=True, null=True),
- ),
- ]
diff --git a/iceci/migrations/0004_testresults_build_id.py b/iceci/migrations/0004_testresults_build_id.py
deleted file mode 100644
index d4ba634..0000000
--- a/iceci/migrations/0004_testresults_build_id.py
+++ /dev/null
@@ -1,58 +0,0 @@
-
-# ============LICENSE_START==========================================
-# org.onap.vvp/test-engine
-# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
-# ===================================================================
-#
-# Unless otherwise specified, all software contained herein is licensed
-# under the Apache License, Version 2.0 (the “License”);
-# you may not use this software except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-#
-# Unless otherwise specified, all documentation contained herein is licensed
-# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
-# you may not use this documentation except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://creativecommons.org/licenses/by/4.0/
-#
-# Unless required by applicable law or agreed to in writing, documentation
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# ============LICENSE_END============================================
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-# Generated by Django 1.9.7 on 2016-09-26 13:25
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('iceci', '0003_auto_20160914_1004'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='testresults',
- name='build_id',
- field=models.TextField(
- blank=True, default=b'2016,09,26,25,41', null=True),
- ),
- ]
diff --git a/iceci/migrations/0005_auto_20161219_0619.py b/iceci/migrations/0005_auto_20161219_0619.py
deleted file mode 100644
index ad12901..0000000
--- a/iceci/migrations/0005_auto_20161219_0619.py
+++ /dev/null
@@ -1,64 +0,0 @@
-
-# ============LICENSE_START==========================================
-# org.onap.vvp/test-engine
-# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
-# ===================================================================
-#
-# Unless otherwise specified, all software contained herein is licensed
-# under the Apache License, Version 2.0 (the “License”);
-# you may not use this software except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-#
-# Unless otherwise specified, all documentation contained herein is licensed
-# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
-# you may not use this documentation except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://creativecommons.org/licenses/by/4.0/
-#
-# Unless required by applicable law or agreed to in writing, documentation
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# ============LICENSE_END============================================
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-# Generated by Django 1.9.7 on 2016-12-19 06:19
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('iceci', '0004_testresults_build_id'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='testresults',
- name='duration',
- field=models.CharField(default='000', max_length=64),
- preserve_default=False,
- ),
- migrations.AlterField(
- model_name='testresults',
- name='build_id',
- field=models.TextField(
- blank=True, default=b'2016-12-19-14-18-40', null=True),
- ),
- ]
diff --git a/iceci/migrations/__init__.py b/iceci/migrations/__init__.py
deleted file mode 100644
index 32b601a..0000000
--- a/iceci/migrations/__init__.py
+++ /dev/null
@@ -1,38 +0,0 @@
-
-# ============LICENSE_START==========================================
-# org.onap.vvp/test-engine
-# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
-# ===================================================================
-#
-# Unless otherwise specified, all software contained herein is licensed
-# under the Apache License, Version 2.0 (the “License”);
-# you may not use this software except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-#
-# Unless otherwise specified, all documentation contained herein is licensed
-# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
-# you may not use this documentation except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://creativecommons.org/licenses/by/4.0/
-#
-# Unless required by applicable law or agreed to in writing, documentation
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# ============LICENSE_END============================================
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
diff --git a/iceci/models.py b/iceci/models.py
deleted file mode 100644
index 9f92eca..0000000
--- a/iceci/models.py
+++ /dev/null
@@ -1,61 +0,0 @@
-
-# ============LICENSE_START==========================================
-# org.onap.vvp/test-engine
-# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
-# ===================================================================
-#
-# Unless otherwise specified, all software contained herein is licensed
-# under the Apache License, Version 2.0 (the “License”);
-# you may not use this software except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-#
-# Unless otherwise specified, all documentation contained herein is licensed
-# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
-# you may not use this documentation except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://creativecommons.org/licenses/by/4.0/
-#
-# Unless required by applicable law or agreed to in writing, documentation
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# ============LICENSE_END============================================
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-from __future__ import unicode_literals
-from django.db import models
-import datetime
-from django.conf import settings
-
-
-class TestResults(models.Model):
- testType = models.CharField(max_length=64)
- testFeature = models.CharField(max_length=64)
- testName = models.CharField(max_length=64)
- testResult = models.CharField(max_length=64)
- notes = models.TextField(null=True, blank=True)
- duration = models.CharField(max_length=64)
- build_id = models.TextField(
- null=True,
- blank=True,
- default=settings.ICE_BUILD_REPORT_NUM)
- create_time = models.DateTimeField(
- 'creation time', default=datetime.datetime.now)
-
- class Meta:
- db_table = "ice_test_results"
- verbose_name_plural = 'Tests Results'
diff --git a/iceci/serializers.py b/iceci/serializers.py
deleted file mode 100644
index 2eaae34..0000000
--- a/iceci/serializers.py
+++ /dev/null
@@ -1,82 +0,0 @@
-
-# ============LICENSE_START==========================================
-# org.onap.vvp/test-engine
-# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
-# ===================================================================
-#
-# Unless otherwise specified, all software contained herein is licensed
-# under the Apache License, Version 2.0 (the “License”);
-# you may not use this software except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-#
-# Unless otherwise specified, all documentation contained herein is licensed
-# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
-# you may not use this documentation except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://creativecommons.org/licenses/by/4.0/
-#
-# Unless required by applicable law or agreed to in writing, documentation
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# ============LICENSE_END============================================
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-from rest_framework import serializers
-from .models import TestResults
-
-
-class TestResultsModelSerializer(serializers.ModelSerializer):
- class Meta:
- model = TestResults
- fields = (
- 'testType',
- 'testFeature',
- 'testName',
- 'testResult',
- 'notes',
- 'create_time',
- )
-
-
-class TestResultsSerializer(serializers.Serializer):
- class Meta:
- model = TestResults
- fields = (
- 'testType',
- 'testFeature',
- 'testName',
- 'testResult',
- 'notes',
- 'create_time',
- )
-
- def create(self, validated_data):
- return TestResults(**validated_data)
-
- def update(self, instance, validated_data):
- instance.testType = validated_data.get('testType', instance.testType)
- instance.testFeature = validated_data.get(
- 'testFeature', instance.testFeature)
- instance.testName = validated_data.get('testName', instance.testName)
- instance.testResult = validated_data.get(
- 'testResult', instance.testResult)
- instance.notes = validated_data.get('notes', instance.notes)
- instance.duration = validated_data.get('duration', instance.duration)
- instance.create_time = validated_data.get(
- 'create_time', instance.create_time)
- return instance
diff --git a/iceci/urls.py b/iceci/urls.py
deleted file mode 100644
index e52e7ce..0000000
--- a/iceci/urls.py
+++ /dev/null
@@ -1,51 +0,0 @@
-
-# ============LICENSE_START==========================================
-# org.onap.vvp/test-engine
-# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
-# ===================================================================
-#
-# Unless otherwise specified, all software contained herein is licensed
-# under the Apache License, Version 2.0 (the “License”);
-# you may not use this software except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-#
-# Unless otherwise specified, all documentation contained herein is licensed
-# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
-# you may not use this documentation except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://creativecommons.org/licenses/by/4.0/
-#
-# Unless required by applicable law or agreed to in writing, documentation
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# ============LICENSE_END============================================
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-from django.conf.urls import url
-from . import views
-
-urlpatterns = [url(r'^testresults/?$',
- views.testResult_list),
- url(r'^testresults/(?P<param>.*)$',
- views.testResult_detail),
- url(r'^testresultstomail/(?P<param>.*)$',
- views.testResult_list_to_mail),
- url(r'^testresultstohtml/(?P<param>.*)$',
- views.testResult_list_to_html_file),
- url(r'^testresultstr/(?P<param>.*)$',
- views.testResultStr)]
diff --git a/iceci/views.py b/iceci/views.py
deleted file mode 100644
index 8f33679..0000000
--- a/iceci/views.py
+++ /dev/null
@@ -1,313 +0,0 @@
-
-# ============LICENSE_START==========================================
-# org.onap.vvp/test-engine
-# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
-# ===================================================================
-#
-# Unless otherwise specified, all software contained herein is licensed
-# under the Apache License, Version 2.0 (the “License”);
-# you may not use this software except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-#
-# Unless otherwise specified, all documentation contained herein is licensed
-# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
-# you may not use this documentation except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://creativecommons.org/licenses/by/4.0/
-#
-# Unless required by applicable law or agreed to in writing, documentation
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# ============LICENSE_END============================================
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-
-
-from django.conf import settings
-from django.http import HttpResponse
-from django.views.decorators.csrf import csrf_exempt
-from rest_framework.parsers import JSONParser
-from rest_framework.renderers import JSONRenderer
-
-from iceci import mail
-from iceci.mail import testsResults_mail_body
-from services.constants import ServiceProvider
-from services.logging_service import LoggingServiceFactory
-
-from .models import TestResults
-from .serializers import TestResultsModelSerializer
-
-
-LAST_BUILD_REPORT_NUM = None
-# from django.core.mail import send_mail
-# from . import mail
-logger = LoggingServiceFactory.get_logger()
-
-
-def index(request):
- return HttpResponse("Hello, world. You're at the "
- + ServiceProvider.PROGRAM_NAME + " ci index.")
-
-
-@csrf_exempt
-def testResult_list(request): # List all tests, or create a new test.
- if (request.method == 'DELETE' or request.method == 'PUT'):
- return HttpResponse(status=405)
-
- if request.method == 'GET':
- testResult = TestResults.objects.all()
- serializer = TestResultsModelSerializer(testResult, many=True)
- return JSONResponse(serializer.data)
-
- elif request.method == 'POST':
- data = JSONParser().parse(request)
- serializer = TestResultsModelSerializer(data=data)
- if serializer.is_valid():
- serializer.save()
- return JSONResponse(serializer.data, status=201)
- return JSONResponse(serializer.errors, status=400)
-
-
-@csrf_exempt
-def testResultStr(request, param): # List all tests, or create a new test.
- try:
- testResults = TestResults.objects.filter(build_id=param)
- pass_counter, total_counter, statisticData, fail_counter = \
- strReportForTestResults(testResults)
- evaultaion = as_percentage_of(pass_counter, total_counter)
- except Exception as e:
- msg = "Something went wrong while trying to send Test Results " + \
- str(e)
- return HttpResponse(msg, status=500)
-
- msg = "Total Tests: " + str(total_counter) + " Pass Tests: " + \
- str(pass_counter) + " Fail Tests: " + str(fail_counter) +\
- " Statistics : " + str(evaultaion) + \
- " BUILD_REPORT_NUM : " + str(param)
- return HttpResponse(msg, status=200)
-
-
-@csrf_exempt
-def testResult_detail(request, param): # Retrieve, update or delete a test.
- if request.method == 'POST':
- return HttpResponse(status=405)
-
- param = param.strip("/")
-
- try:
- testResult = TestResults.objects.get(name=param)
- except TestResults.DoesNotExist:
- return HttpResponse(status=404)
-
- if request.method == 'GET':
- serializer = TestResultsModelSerializer(testResult)
- return JSONResponse(serializer.data)
-
- elif request.method == 'PUT':
- data = JSONParser().parse(request)
- serializer = TestResultsModelSerializer(testResult, data=data)
- if serializer.is_valid():
- serializer.save()
- return JSONResponse(serializer.data)
- return JSONResponse(serializer.errors, status=400)
-
- elif request.method == 'DELETE':
- testResult.delete()
- return HttpResponse(status=204)
-
-# =========================================================================
-# def testResult_post_action(request, data):
-#
-# logger.debug("about to send mail to " + data['email'])
-#
-# html_msg = mail.mail_body.substitute(data)
-# #send mail with template
-# send_mail(mail.mail_subject,
-# '',
-# mail.mail_from,
-# mail.mail_to,
-# fail_silently=False,
-# html_message=html_msg)
-# =========================================================================
-
-
-def createHtmlStrReportForTestResults(testResults):
- total_counter = 0
- fail_counter = 0
- pass_counter = 0
- statisticData = ""
- str2 = "<tr class='row1'>" + "<th class='field-testTotal'>@Total</th>" + \
- "<td class='field-testPass'>@Pass</td>" + \
- "<td class='field-tesFail'>@Fail</td>" + \
- "<td class='field-testEvaultaion'>@Evaultaion</td>" + "</tr>"
- paramData = ""
- str3 = "<tr class='row2'>" + \
- "<th class='field-testTotal'>@Version</th>" + "</tr>"
- allData = ""
- string_temp = "<tr class='row1'>" + \
- "<th class='field-testType'>@TestType</th>" +\
- "<td class='field-testFeature'>@TestFeature</td>" + \
- "<td class='field-testName'>@TestName</td>" + \
- "<td class='field-testResult'>@TestResult</td>" + \
- "<td class='field-notes'>@Notes</td>" + \
- "<td class='field-create_time nowrap'>@Creation_time</td>" + "</tr>"
- # testResults
- for res in testResults:
- allData += string_temp.replace(
- "@TestType", string_temp(
- res.testType)).replace(
- "@TestFeature", string_temp(
- res.testFeature)).replace(
- "@TestName", string_temp(
- res.testName)).replace(
- "@TestResult", string_temp(
- res.testResult)).replace(
- "@Notes", string_temp(
- res.notes)).replace(
- "@Creation_time", string_temp(
- res.create_time))
- total_counter += 1
- if (res.testResult == "PASS"):
- pass_counter += 1
- else:
- fail_counter += 1
-
- return pass_counter, total_counter, statisticData, str2, \
- fail_counter, paramData, str3, allData
-
-
-def strReportForTestResults(testResults):
- total_counter = 0
- fail_counter = 0
- pass_counter = 0
- statisticData = ""
- for res in testResults: # testResults
- total_counter += 1
- if (res.testResult == "PASS"):
- pass_counter += 1
- else:
- fail_counter += 1
-
- return pass_counter, total_counter, statisticData, fail_counter
-
-
-@csrf_exempt
-# List all tests, or create a new test.
-def testResult_list_to_mail(request, param):
- if (request.method == 'DELETE' or request.method ==
- 'PUT' or request.method == 'POST'):
- return HttpResponse(status=405)
-
- data = dict()
-
- print("BUILD_REPORT_NUM = " + settings.ICE_BUILD_REPORT_NUM)
-
- testResults = TestResults.objects.filter(build_id=param)
-
- pass_counter, total_counter, statisticData, str2, fail_counter, \
- paramData, str3, allData = createHtmlStrReportForTestResults(
- testResults)
-
- evaultaion = as_percentage_of(pass_counter, total_counter)
- statisticData += str2.replace(
- "@Total", str(total_counter)).replace(
- "@Pass", str(pass_counter)).replace(
- "@Fail", str(fail_counter)).replace(
- "@Evaultaion", str(evaultaion))
- paramData += str3.replace("@Version", str(param))
- data['email'] = "rgafiulin@interwise.com"
- data['allData'] = str(allData)
- data['statisticData'] = str(statisticData)
- data['paramData'] = str(paramData)
-
- mail.testsResults_mail_to = data['email']
- try:
- mail.sendMail(
- param,
- data['email'],
- data,
- mail.testsResults_mail_body,
- mail.testsResults_mail_subject)
- except Exception as e:
- msg = "Something went wrong while " +\
- "trying to send Test Report mail to " + \
- data['email'] + str(e)
- return HttpResponse(msg, status=500)
-
- serializer = TestResultsModelSerializer(testResults, many=True)
- return JSONResponse(serializer.data)
-
-
-@csrf_exempt
-def testResult_list_to_html_file(request, param):
- if (request.method == 'DELETE' or request.method ==
- 'PUT' or request.method == 'POST'):
- return HttpResponse(status=405)
-
- data = dict()
-
- print("BUILD_REPORT_NUM = " + settings.ICE_BUILD_REPORT_NUM)
-
- testResults = TestResults.objects.filter(
- build_id=settings.ICE_BUILD_REPORT_NUM)
-
- pass_counter, total_counter, statisticData, str2, fail_counter, \
- paramData, str3, allData = \
- createHtmlStrReportForTestResults(testResults)
-
- evaultaion = as_percentage_of(pass_counter, total_counter)
- statisticData += str2.replace(
- "@Total", str(total_counter)).replace(
- "@Pass", str(pass_counter)).replace(
- "@Fail", str(fail_counter)).replace(
- "@Evaultaion", str(evaultaion))
- paramData += str3.replace("@Version", str(param))
-
- data['allData'] = str(allData)
- data['statisticData'] = str(statisticData)
- data['paramData'] = str(paramData)
-
- html_msg = testsResults_mail_body.substitute(data)
- fileName = settings.LOGS_PATH + "Test_Results_" + \
- settings.ICE_BUILD_REPORT_NUM + ".html"
- try:
- with open(fileName, "w") as text_file:
- text_file.write(html_msg)
- except Exception as e:
- msg = "Something went wrong while trying to " +\
- "write the tet results to html file " + \
- fileName + " " + str(e)
- return HttpResponse(msg, status=500)
-
- serializer = TestResultsModelSerializer(testResults, many=True)
- return JSONResponse(serializer.data)
-
-
-def as_percentage_of(part, whole):
- try:
- return "%d%%" % (float(part) / whole * 100)
- except (ValueError, ZeroDivisionError):
- return ""
-
-
-# An HttpResponse that renders its content into JSON.
-class JSONResponse(HttpResponse):
- def __init__(self, data, **kwargs):
- content = JSONRenderer().render(data)
- kwargs['content_type'] = 'application/json'
- super(JSONResponse, self).__init__(content, **kwargs)