def test_should_persist_follow(self): test_user = self.create_test_user() dao = InstalikeSQLDAO() rows = dao.persist_follow(test_user) self.assertEqual(rows, 1)
def test_should_not_persist_unfollow_if_not_following(self): test_user = self.create_test_user() test_user.id = 2 dao = InstalikeSQLDAO() rows = dao.persist_unfollow(test_user) self.assertEqual(rows, 0)
def test_should_persist_like(self): test_photo = Photo().from_json( json.loads(''' {"code": "tedwefeqwfa4s", "dimensions": {"width": 1080, "height": 1349}, "comments_disabled": false, "owner": {"id": "11111111"}, "comments": {"count": 134}, "caption": "#sunday#black#girl#selfie", "likes": {"count": 12}, "date": 1476637330, "thumbnail_src": "https://scontent-waw1-1.cdninstagram.com/whatever/whatever", "is_video": false, "id": "3333333333333333333", "display_src": "https://scontent-waw1-1.cdninstagram.com/whatever/whatever"}''' )) dao = InstalikeSQLDAO() rows = dao.persist_like(test_photo) self.assertEqual(rows, 1)
def test_should_get_users_to_unfollow(self): dao = InstalikeSQLDAO() test_user = self.create_test_user() test_user.id = 4 dao.persist_user(test_user) dao.persist_follow(test_user) rows = dao.get_users_to_unfollow(-1) self.assertEqual(len(rows), 1)
def test_should_create_sqlite_dao(self): dao = InstalikeSQLDAO() self.assertIsNotNone(dao)
def test_should_return_zero_if_no_users_to_unfollow(self): dao = InstalikeSQLDAO() rows = dao.get_users_to_unfollow(1) print(rows) self.assertEqual(len(rows), 0)