Code coverage for Utils and Music package 48/84748/1
authorSudarshan Kumar <sudars19@in.ibm.com>
Tue, 9 Apr 2019 21:00:27 +0000 (02:30 +0530)
committerSudarshan Kumar <sudars19@in.ibm.com>
Tue, 9 Apr 2019 21:01:38 +0000 (02:31 +0530)
Code coverage for Utils and Music package

Issue-ID: OPTFRA-302
Change-Id: If487fae7e52a26e5b884a6d5db25d47b8cd580f9
Signed-off-by: Sudarshan Kumar <sudars19@in.ibm.com>
conductor/conductor/tests/unit/common/music/__init__.py [new file with mode: 0644]
conductor/conductor/tests/unit/common/music/test_transaction.py [new file with mode: 0644]
conductor/conductor/tests/unit/common/utils/__init__.py [new file with mode: 0644]
conductor/conductor/tests/unit/common/utils/test_basic_auth_util.py [new file with mode: 0644]
conductor/conductor/tests/unit/solver/utils/__init__.py [new file with mode: 0644]
conductor/conductor/tests/unit/solver/utils/test_utils.py [new file with mode: 0644]

diff --git a/conductor/conductor/tests/unit/common/music/__init__.py b/conductor/conductor/tests/unit/common/music/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
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 (file)
index 0000000..9083ef7
--- /dev/null
@@ -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 (file)
index 0000000..e69de29
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 (file)
index 0000000..149fa08
--- /dev/null
@@ -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 (file)
index 0000000..e69de29
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 (file)
index 0000000..ba685ab
--- /dev/null
@@ -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()