aboutsummaryrefslogtreecommitdiffstats
path: root/src/resource_inventory/tests/test_models.py
diff options
context:
space:
mode:
authorParker Berberian <pberberian@iol.unh.edu>2018-11-20 11:19:55 -0500
committerParker Berberian <pberberian@iol.unh.edu>2018-11-26 14:07:15 -0500
commitb7c4d286ffa618be0e95b15f3883e2f6920a3fb1 (patch)
tree930e9b9282b8f50e671844b2a1e7f39dc5d6035d /src/resource_inventory/tests/test_models.py
parent6a90796de1df8d74c79415c39c867ffe6cd80fd0 (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/resource_inventory/tests/test_models.py')
-rw-r--r--src/resource_inventory/tests/test_models.py109
1 files changed, 60 insertions, 49 deletions
diff --git a/src/resource_inventory/tests/test_models.py b/src/resource_inventory/tests/test_models.py
index 4ddedf2..e1b2106 100644
--- a/src/resource_inventory/tests/test_models.py
+++ b/src/resource_inventory/tests/test_models.py
@@ -9,11 +9,24 @@
from django.test import TestCase
from django.contrib.auth.models import User
from account.models import Lab
-from resource_inventory.models import *
+from resource_inventory.models import (
+ Scenario,
+ Installer,
+ Opsys,
+ ConfigBundle,
+ OPNFVConfig,
+ OPNFVRole,
+ Image,
+ HostProfile,
+ GenericResourceBundle,
+ GenericResource,
+ GenericHost,
+ HostConfiguration
+)
class ConfigUtil():
- count=0
+ count = 0
@staticmethod
def makeScenario():
@@ -21,17 +34,13 @@ class ConfigUtil():
@staticmethod
def makeInstaller():
- inst = Installer.objects.create(
- name = "testInstaller"
- )
+ inst = Installer.objects.create(name="testInstaller")
inst.sup_scenarios = [ConfigUtil.makeScenario()]
return inst
@staticmethod
def makeOpsys():
- os = Opsys.objects.create(
- name = "test Operating System"
- )
+ os = Opsys.objects.create(name="test Operating System")
os.sup_installers = [ConfigUtil.makeInstaller()]
return os
@@ -39,9 +48,7 @@ class ConfigUtil():
def makeConfigBundle():
user = User.objects.create(username="test_user" + str(ConfigUtil.count))
ConfigUtil.count += 1
- return ConfigBundle.objects.create(
- owner = user
- )
+ return ConfigBundle.objects.create(owner=user)
@staticmethod
def makeOPNFVConfig():
@@ -49,61 +56,60 @@ class ConfigUtil():
scenario = ConfigUtil.makeScenario()
bundle = ConfigUtil.makeConfigBundle()
return OPNFVConfig.objects.create(
- installer=installer,
- scenario=scenario,
- bundle=bundle
- )
+ installer=installer,
+ scenario=scenario,
+ bundle=bundle
+ )
@staticmethod
def makeOPNFVRole():
return OPNFVRole.objects.create(
- name="Test role",
- description="This is a test role"
- )
+ name="Test role",
+ description="This is a test role"
+ )
@staticmethod
def makeImage():
owner = User.objects.create(username="another test user")
lab_user = User.objects.create(username="labUserForTests")
lab = Lab.objects.create(
- lab_user=lab_user,
- name="this is lab for testing",
- contact_email="email@mail.com",
- contact_phone="123-4567"
- )
+ lab_user=lab_user,
+ name="this is lab for testing",
+ contact_email="email@mail.com",
+ contact_phone="123-4567"
+ )
return Image.objects.create(
- lab_id=0,
- from_lab=lab,
- name="an image for testing",
- owner=owner
- )
-
+ lab_id=0,
+ from_lab=lab,
+ name="an image for testing",
+ owner=owner
+ )
@staticmethod
def makeGenericHost():
profile = HostProfile.objects.create(
- host_type=0,
- name="test lab for config bundle",
- description="this is a test profile"
- )
+ host_type=0,
+ name="test lab for config bundle",
+ description="this is a test profile"
+ )
user = User.objects.create(username="test sample user 12")
bundle = GenericResourceBundle.objects.create(
- name="Generic bundle for config tests",
- xml="",
- owner=user,
- description=""
- )
+ name="Generic bundle for config tests",
+ xml="",
+ owner=user,
+ description=""
+ )
resource = GenericResource.objects.create(
- bundle=bundle,
- name="a test generic resource"
- )
+ bundle=bundle,
+ name="a test generic resource"
+ )
return GenericHost.objects.create(
- profile=profile,
- resource=resource
- )
+ profile=profile,
+ resource=resource
+ )
@staticmethod
def makeHostConfiguration():
@@ -112,11 +118,11 @@ class ConfigUtil():
bundle = ConfigUtil.makeConfigBundle()
opnfvRole = ConfigUtil.makeOPNFVRole()
return HostConfiguration.objects.create(
- host=host,
- image=image,
- bundle=bundle,
- opnfvRole=opnfvRole
- )
+ host=host,
+ image=image,
+ bundle=bundle,
+ opnfvRole=opnfvRole
+ )
class ScenarioTestCase(TestCase):
@@ -124,26 +130,31 @@ class ScenarioTestCase(TestCase):
def test_save(self):
self.assertTrue(ConfigUtil.makeScenario())
+
class InstallerTestCase(TestCase):
def test_save(self):
self.assertTrue(ConfigUtil.makeInstaller())
+
class OperatingSystemTestCase(TestCase):
def test_save(self):
self.assertTrue(ConfigUtil.makeOpsys())
+
class ConfigBundleTestCase(TestCase):
def test_save(self):
self.assertTrue(ConfigUtil.makeConfigBundle())
+
class OPNFVConfigTestCase(TestCase):
def test_save(self):
self.assertTrue(ConfigUtil.makeOPNFVConfig())
+
class OPNFVRoleTestCase(TestCase):
def test_save(self):