diff --git a/build_container/test.sh b/build_container/test.sh index d9211605..2b25ad9d 100755 --- a/build_container/test.sh +++ b/build_container/test.sh @@ -13,6 +13,12 @@ cd chump/ && npm run lint && npm run test && cd .. go test skinny/*.go echo "Running tests for follows microservice" -cd services/follows -python3 -m unittest +cd build_out/follows +python3 -m unittest discover cd ../../ + +echo "Running tests for database microservice" +cd build_out/database +python3 -m unittest discover +cd ../../ + diff --git a/services/database/test_util.py b/services/database/test_util.py new file mode 100644 index 00000000..180f3172 --- /dev/null +++ b/services/database/test_util.py @@ -0,0 +1,12 @@ +import unittest + +import util +import database_pb2 + +class UtilTest(unittest.TestCase): + def test_entry_to_filter(self): + entry = database_pb2.PostsEntry(title="Despacito") + clause, vals = util.entry_to_filter(entry) + self.assertEqual(clause, "title = ?") + self.assertEqual(vals, ["Despacito"]) + diff --git a/services/follows/util_test.py b/services/follows/test_util.py similarity index 96% rename from services/follows/util_test.py rename to services/follows/test_util.py index 74097581..a3fa0526 100644 --- a/services/follows/util_test.py +++ b/services/follows/test_util.py @@ -8,7 +8,7 @@ class UtilTest(unittest.TestCase): def setUp(self): self.logger = logging.getLogger(__name__) - self.util = Util(self.logger) + self.util = Util(self.logger, None) def test_parse_local_username(self): a, b = self.util.parse_username('admin')