def test_entry_creation(self): u = User(username='******', email='*****@*****.**') db.session.add(u) db.session.commit() title = 'book one' author = 'some author' res1 = u.add_entry_to_collection(title=title, author=author) res2 = u.add_entry_to_collection(title=title, author=author) res3 = u.add_entry_to_collection(title='other title', author='other author') db.session.commit() # res1 = res2 b/c trying to insert same book shouldn't duplicate anything # collection() should be equal to [ first_entry, second_entry ] self.assertEqual(res1, res2) self.assertEqual(u.collection().all(), [res1, res3])