Skip to content

Commit

Permalink
Merge pull request #134 from CPSSD/c/dbtest
Browse files Browse the repository at this point in the history
Add simple test for DB and fix follows test
  • Loading branch information
CianLR authored Oct 29, 2018
2 parents b6ea107 + 8da579c commit 6e15bab
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
10 changes: 8 additions & 2 deletions build_container/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ../../

12 changes: 12 additions & 0 deletions services/database/test_util.py
Original file line number Diff line number Diff line change
@@ -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"])

Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 6e15bab

Please sign in to comment.