Exemplo n.º 1
0
 def test_save_to_db(self):
     article = Article("Test", "lk", datetime.now(), uuid.uuid4())
     article.save_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, "Saved and retrieved article is not the same")
Exemplo n.º 2
0
 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")