HAS - PyUnit Code coverage 80/84080/1
authorSudarshan Kumar <sudars19@in.ibm.com>
Wed, 3 Apr 2019 10:17:27 +0000 (15:47 +0530)
committerSudarshan Kumar <sudars19@in.ibm.com>
Wed, 3 Apr 2019 10:17:38 +0000 (15:47 +0530)
HAS - PyUnit Code coverage

Issue-ID: OPTFRA-302
Change-Id: I434f993a6f80ecda970840841e82bc25e807a598
Signed-off-by: Sudarshan Kumar <sudars19@in.ibm.com>
conductor/conductor/tests/unit/common/models/test_country_latency.py [new file with mode: 0644]
conductor/conductor/tests/unit/common/models/test_groups.py [new file with mode: 0644]
conductor/conductor/tests/unit/common/models/test_order_lock_history.py [new file with mode: 0644]
conductor/conductor/tests/unit/common/models/test_region_placeholders.py [new file with mode: 0644]

diff --git a/conductor/conductor/tests/unit/common/models/test_country_latency.py b/conductor/conductor/tests/unit/common/models/test_country_latency.py
new file mode 100644 (file)
index 0000000..ba2c462
--- /dev/null
@@ -0,0 +1,42 @@
+#
+# -------------------------------------------------------------------------
+#   Copyright (C) 2019 IBM.
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file 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.
+#
+# -------------------------------------------------------------------------
+#
+
+"""Test class for model country_latency"""
+
+import unittest
+from conductor.common.models.country_latency import CountryLatency
+
+
+class TestCountryLatency(unittest.TestCase):
+
+    def setUp(self):
+        self.countryLatency = CountryLatency()
+
+    def test_CountryLatency(self):
+        self.assertEqual(True, self.countryLatency.atomic())
+        self.assertEqual("id", self.countryLatency.pk_name())
+        self.assertEqual(None, self.countryLatency.pk_value())
+        self.value = {'country_name': None, 'groups': None}
+        self.assertEqual(self.value, self.countryLatency.values())
+        self.assertEqual("text", self.countryLatency.schema().get("country_name"))
+        self.assertEqual(None, self.countryLatency.__json__().get("groups"))
+
+
+if __name__ == '__main__':
+    unittest.main()
diff --git a/conductor/conductor/tests/unit/common/models/test_groups.py b/conductor/conductor/tests/unit/common/models/test_groups.py
new file mode 100644 (file)
index 0000000..c085d82
--- /dev/null
@@ -0,0 +1,43 @@
+#
+# -------------------------------------------------------------------------
+#   Copyright (C) 2019 IBM.
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file 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.
+#
+# -------------------------------------------------------------------------
+#
+
+"""Test class for model group"""
+
+import unittest
+from conductor.common.models.groups import Groups
+
+
+class TestGroups(unittest.TestCase):
+    def setUp(self):
+        self.groups = Groups()
+
+    def test_groups(self):
+        self.assertEqual(True, self.groups.atomic())
+        self.assertEqual("id", self.groups.pk_name())
+        self.assertEqual(None, self.groups.pk_value())
+
+        self.values = {'group': None, 'id': None}
+        self.assertEqual(self.values, self.groups.values())
+        self.assertEqual(None, self.groups.__json__().get("group"))
+        self.assertEqual('<Groups None>', self.groups.__repr__())
+        self.assertEqual('text', self.groups.schema().get("id"))
+
+
+if __name__ == '__main__':
+    unittest.main()
diff --git a/conductor/conductor/tests/unit/common/models/test_order_lock_history.py b/conductor/conductor/tests/unit/common/models/test_order_lock_history.py
new file mode 100644 (file)
index 0000000..452d175
--- /dev/null
@@ -0,0 +1,42 @@
+#
+# -------------------------------------------------------------------------
+#   Copyright (C) 2019 IBM.
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file 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.
+#
+# -------------------------------------------------------------------------
+#
+
+"""Test class for model order_lock_history"""
+
+import unittest
+from conductor.common.models.order_lock_history import OrderLockHistory
+
+
+class TestOrderLockHistory(unittest.TestCase):
+
+    def setUp(self):
+        self.orderLockHistory = OrderLockHistory()
+
+    def test_OrderLockHistory(self):
+        self.assertEqual(True, self.orderLockHistory.atomic())
+        self.assertEqual("id", self.orderLockHistory.pk_name())
+        self.assertEqual(None, self.orderLockHistory.pk_value())
+        self.value = {'is_spinup_completed': False, 'conflict_id': None, 'spinup_completed_timestamp': None, 'plans': None}
+        self.assertEqual(self.value, self.orderLockHistory.values())
+        self.assertEqual("text", self.orderLockHistory.schema().get("conflict_id"))
+        self.assertEqual(None, self.orderLockHistory.__json__().get("plans"))
+
+
+if __name__ == '__main__':
+    unittest.main()
diff --git a/conductor/conductor/tests/unit/common/models/test_region_placeholders.py b/conductor/conductor/tests/unit/common/models/test_region_placeholders.py
new file mode 100644 (file)
index 0000000..32c0661
--- /dev/null
@@ -0,0 +1,42 @@
+#
+# -------------------------------------------------------------------------
+#   Copyright (C) 2019 IBM.
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file 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.
+#
+# -------------------------------------------------------------------------
+#
+
+"""Test class for model region_placeholders"""
+
+import unittest
+from conductor.common.models.region_placeholders import RegionPlaceholders
+
+
+class TestRegionPlaceholders(unittest.TestCase):
+
+    def setUp(self):
+        self.regionPlaceHolder = RegionPlaceholders()
+
+    def test_RegionPlaceholders(self):
+        self.assertEqual(True, self.regionPlaceHolder.atomic())
+        self.assertEqual("id", self.regionPlaceHolder.pk_name())
+        self.assertEqual(None, self.regionPlaceHolder.pk_value())
+        self.value = {'region_name': None, 'countries': None}
+        self.assertEqual(self.value, self.regionPlaceHolder.values())
+        self.assertEqual("text", self.regionPlaceHolder.schema().get("region_name"))
+        self.assertEqual(None, self.regionPlaceHolder.__json__().get("region_name"))
+
+
+if __name__ == '__main__':
+    unittest.main()