def test_is_synced(self): article = Article("Test", "lk", datetime.now(), uuid.uuid4()) article.save_to_db() article.set_title("TestUpdated") article.sync_to_db() self.assertTrue(article.is_synced(), "article marked un-synced when it is") article.remove_from_db()
def test_sync_to_db(self): article = Article("Test", "lk", datetime.now(), uuid.uuid4()) article.save_to_db() article.set_title("TestUpdated") article.sync_to_db() try: test_result = Article.get_by_id(article.get_id()) except NoSuchArticleExistException: self.fail() article.remove_from_db() self.assertEqual(test_result, article, "Sync event with database failed")
def test_not_synced(self): article = Article("Test", "lk", datetime.now(), uuid.uuid4()) article.save_to_db() article.set_title("TestUpdated") self.assertFalse(article.is_synced(),"article marked synced when it is not") article.remove_from_db()