def test_to_json(self): dt = datetime.now() id_ = uuid.uuid4() page_id = uuid.uuid4() article = Article("Test", "lk", dt, page_id, None,id_) test = article.to_json() self.equal = self.assertEqual(article.to_json(), {'title': 'Test', 'summary': 'lk', 'date': dt, 'page_id': page_id, 'publication': None, '_id': id_})
def test_factory_form_json(self): article = Article("Test", "lk", datetime.now(), uuid.uuid4() ) dfsdf = article.to_json() dsds = Article.factory_form_json(dfsdf) self.assertEqual(article, Article.factory_form_json(article.to_json()), "Creating article object from json failed")