diff options
author | Parker Berberian <pberberian@iol.unh.edu> | 2018-11-20 11:19:55 -0500 |
---|---|---|
committer | Parker Berberian <pberberian@iol.unh.edu> | 2018-11-26 14:07:15 -0500 |
commit | b7c4d286ffa618be0e95b15f3883e2f6920a3fb1 (patch) | |
tree | 930e9b9282b8f50e671844b2a1e7f39dc5d6035d /src/workflow/tests/test_steps.py | |
parent | 6a90796de1df8d74c79415c39c867ffe6cd80fd0 (diff) |
Fix all flake8 errors
The flake8 command in test.sh finds no longer finds any errors.
This may form a basis of a jenkins verify job as a sort of 'weak compile-time checks'
The flake8 command will not complain about line length, and will not complain about
django's manage.py file
Change-Id: Ic47cb4fc7ada55e64485661ab6881aef475018ff
Signed-off-by: Parker Berberian <pberberian@iol.unh.edu>
Diffstat (limited to 'src/workflow/tests/test_steps.py')
-rw-r--r-- | src/workflow/tests/test_steps.py | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/src/workflow/tests/test_steps.py b/src/workflow/tests/test_steps.py index 602d3dd..380102a 100644 --- a/src/workflow/tests/test_steps.py +++ b/src/workflow/tests/test_steps.py @@ -6,18 +6,28 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -from django.test import TestCase, client + +from django.test import TestCase from dashboard.populate_db import Populator from workflow.tests import constants from workflow.workflow_factory import WorkflowFactory from workflow.models import Repository -from workflow.resource_bundle_workflow import * -from workflow.sw_bundle_workflow import * -from workflow.booking_workflow import * +from workflow.resource_bundle_workflow import Define_Hardware, Define_Nets, Resource_Meta_Info, Host_Meta_Info +from workflow.sw_bundle_workflow import SWConf_Resource_Select, Define_Software, Config_Software +from workflow.booking_workflow import Booking_Resource_Select, SWConfig_Select, Booking_Meta from django.http import QueryDict, HttpRequest from django.contrib.auth.models import User -from django.core.management import call_command -from resource_inventory.models import * +from resource_inventory.models import ( + Scenario, + Installer, + OPNFVRole, + Image, + GenericResourceBundle, + GenericHost, + HostProfile, + GenericResource, + ConfigBundle +) class BaseStepTestCase(TestCase): @@ -48,7 +58,7 @@ class BookingResourceSelectTestCase(BaseStepTestCase): grb_model = GenericResourceBundle.objects.filter(owner__username="user 1").first() grb = [{"small_name": grb_model.name, "expanded_name": "user 1", "id": grb_model.id, "string": ""}] grb = str(grb).replace("'", '"') - data = {"generic_resource_bundle": grb } + data = {"generic_resource_bundle": grb} response, context = self.step_test(Booking_Resource_Select, data) self.assertTrue(True) @@ -60,11 +70,12 @@ class BookingResourceSelectTestCase(BaseStepTestCase): data = {} response, context = self.step_test(SWConfig_Select, data) + class SoftwareConfigSelectTestCase(BaseStepTestCase): def test_step_with_good_data(self): config_model = ConfigBundle.objects.filter(owner__username="user 1").first() - config = [{"expanded_name":"user 1", "small_name":config_model.name, "id":config_model.id, "string":""}] + config = [{"expanded_name": "user 1", "small_name": config_model.name, "id": config_model.id, "string": ""}] config = str(config).replace("'", '"') data = {"software_bundle": config} response, context = self.step_test(SWConfig_Select, data) @@ -77,6 +88,7 @@ class SoftwareConfigSelectTestCase(BaseStepTestCase): data = {} response, context = self.step_test(SWConfig_Select, data) + class BookingMetaTestCase(BaseStepTestCase): def test_step_with_good_data(self): @@ -84,9 +96,9 @@ class BookingMetaTestCase(BaseStepTestCase): user2 = User.objects.get(username="user 2") john = User.objects.get(username="johnsmith") users = [ - {"expanded_name":"", "id":user2.id, "small_name":user2.username, "string":user2.email}, - {"expanded_name":"", "id":john.id, "small_name":john.username, "string":john.email} - ] + {"expanded_name": "", "id": user2.id, "small_name": user2.username, "string": user2.email}, + {"expanded_name": "", "id": john.id, "small_name": john.username, "string": john.email} + ] users = str(users).replace("'", '"') data['users'] = users response, context = self.step_test(Booking_Meta, data) @@ -104,7 +116,7 @@ class DefineHardwareTestCase(BaseStepTestCase): def test_step_with_good_data(self): hosts = {"host_4": 1, "host_1": 1} - labs = {"lab_1":"true"} + labs = {"lab_1": "true"} data = {"hosts": hosts, "labs": labs} response, context = self.step_test(Define_Hardware, data) @@ -197,7 +209,7 @@ class SWConfResourceSelectTestCase(BaseStepTestCase): grb_model = GenericResourceBundle.objects.filter(owner__username="user 1").first() grb = [{"small_name": grb_model.name, "expanded_name": "user 1", "id": grb_model.id, "string": ""}] grb = str(grb).replace("'", '"') - data = {"generic_resource_bundle": grb } + data = {"generic_resource_bundle": grb} response, context = self.step_test(SWConf_Resource_Select, data) def test_step_with_bad_data(self): # TODO @@ -220,7 +232,6 @@ class DefineSoftwareTestCase(BaseStepTestCase): repo.el[repo.SWCONF_SELECTED_GRB] = grb return repo - def test_step_with_good_data(self): data = {"form-INITIAL_FORMS": 3, "form-MAX_NUM_FORMS": 1000} data["form-MIN_NUM_FORMS"] = 0 @@ -268,4 +279,3 @@ class ConfigSoftwareTestCase(BaseStepTestCase): def test_step_with_empty_data(self): data = {} response, context = self.step_test(Config_Software, data) - |