diff options
author | Sudarshan Kumar <sudars19@in.ibm.com> | 2019-04-10 02:30:27 +0530 |
---|---|---|
committer | Sudarshan Kumar <sudars19@in.ibm.com> | 2019-04-10 02:31:38 +0530 |
commit | 516b49bb01943111e72b5a60789abe930ab47a33 (patch) | |
tree | 047402c080b8b550511a183a024a1491004f4bb5 /conductor | |
parent | a55afc5dedbdd5863b67884c8657a84d0480a660 (diff) |
Code coverage for Utils and Music package
Code coverage for Utils and Music package
Issue-ID: OPTFRA-302
Change-Id: If487fae7e52a26e5b884a6d5db25d47b8cd580f9
Signed-off-by: Sudarshan Kumar <sudars19@in.ibm.com>
Diffstat (limited to 'conductor')
6 files changed, 108 insertions, 0 deletions
diff --git a/conductor/conductor/tests/unit/common/music/__init__.py b/conductor/conductor/tests/unit/common/music/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/conductor/conductor/tests/unit/common/music/__init__.py diff --git a/conductor/conductor/tests/unit/common/music/test_transaction.py b/conductor/conductor/tests/unit/common/music/test_transaction.py new file mode 100644 index 0000000..9083ef7 --- /dev/null +++ b/conductor/conductor/tests/unit/common/music/test_transaction.py @@ -0,0 +1,39 @@ +# +# ------------------------------------------------------------------------- +# Copyright (c) 2018 Intel Corporation Intellectual Property +# +# 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. +# +# ------------------------------------------------------------------------- +# +import unittest +import conductor.common.music.model.transaction as Transaction + + + +class TestTransaction(unittest.TestCase): + + def setUp(self): + self.expectedValue = None + + def test_Transaction(self): + self.assertEqual(self.expectedValue, Transaction.start()) + self.assertEqual(self.expectedValue, Transaction.start_read_only()) + self.assertEqual(self.expectedValue, Transaction.commit()) + self.assertEqual(self.expectedValue, Transaction.rollback()) + self.assertEqual(self.expectedValue, Transaction.clear()) + self.assertEqual(self.expectedValue, Transaction.flush()) + + +if __name__ == "__main__": + unittest.main() diff --git a/conductor/conductor/tests/unit/common/utils/__init__.py b/conductor/conductor/tests/unit/common/utils/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/conductor/conductor/tests/unit/common/utils/__init__.py diff --git a/conductor/conductor/tests/unit/common/utils/test_basic_auth_util.py b/conductor/conductor/tests/unit/common/utils/test_basic_auth_util.py new file mode 100644 index 0000000..149fa08 --- /dev/null +++ b/conductor/conductor/tests/unit/common/utils/test_basic_auth_util.py @@ -0,0 +1,35 @@ +# +# ------------------------------------------------------------------------- +# Copyright (c) 2018 Intel Corporation Intellectual Property +# +# 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. +# +# ------------------------------------------------------------------------- +# +import unittest +import conductor.common.utils.basic_auth_util as BaseAuthUtil +from conductor.i18n import _, _LI, _LE + + +class TestBaseAuthUtil(unittest.TestCase): + def setUp(self): + self.userId = 'Test' + self.userId = 'Password' + + def test_basic_auth_util(self): + self.authorization_val = _LE(BaseAuthUtil.encode(self.userId, self.userId)) + self.assertEqual('Basic UGFzc3dvcmQ6UGFzc3dvcmQ=', self.authorization_val) + + +if __name__ == "__main__": + unittest.main() diff --git a/conductor/conductor/tests/unit/solver/utils/__init__.py b/conductor/conductor/tests/unit/solver/utils/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/conductor/conductor/tests/unit/solver/utils/__init__.py diff --git a/conductor/conductor/tests/unit/solver/utils/test_utils.py b/conductor/conductor/tests/unit/solver/utils/test_utils.py new file mode 100644 index 0000000..ba685ab --- /dev/null +++ b/conductor/conductor/tests/unit/solver/utils/test_utils.py @@ -0,0 +1,34 @@ +# +# ------------------------------------------------------------------------- +# Copyright (c) 2018 Intel Corporation Intellectual Property +# +# 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. +# +# ------------------------------------------------------------------------- +# +import unittest +import conductor.solver.utils.utils as utils + +class TestUtils(unittest.TestCase): + + def setUp(self): + self._dst = None + self._src = None + + def test_utils(self): + self.assertEqual(0.0, utils.compute_air_distance(self._src, self._dst)) + self.assertEqual(1.242742, utils.convert_km_to_miles(2.0)) + self.assertEqual(2.0, utils.convert_miles_to_km(1.242742)) + +if __name__ == "__main__": + unittest.main() |