diff options
author | Sudarshan Kumar <sudars19@in.ibm.com> | 2019-04-03 15:47:27 +0530 |
---|---|---|
committer | Sudarshan Kumar <sudars19@in.ibm.com> | 2019-04-03 15:47:38 +0530 |
commit | a3741cb4d23c96bf7f54fd6b98c4348e86d6b1e8 (patch) | |
tree | bbaa0458606a9af9f6ef7911dd1310b3e177118f | |
parent | 1d45f1a72b6f54b4cd43070154c9cb6fb51471ca (diff) |
HAS - PyUnit Code coverage
HAS - PyUnit Code coverage
Issue-ID: OPTFRA-302
Change-Id: I434f993a6f80ecda970840841e82bc25e807a598
Signed-off-by: Sudarshan Kumar <sudars19@in.ibm.com>
4 files changed, 169 insertions, 0 deletions
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 index 0000000..ba2c462 --- /dev/null +++ b/conductor/conductor/tests/unit/common/models/test_country_latency.py @@ -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 index 0000000..c085d82 --- /dev/null +++ b/conductor/conductor/tests/unit/common/models/test_groups.py @@ -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 index 0000000..452d175 --- /dev/null +++ b/conductor/conductor/tests/unit/common/models/test_order_lock_history.py @@ -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 index 0000000..32c0661 --- /dev/null +++ b/conductor/conductor/tests/unit/common/models/test_region_placeholders.py @@ -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() |