def test_count_author_returns_right_amount(self): for i in range(3): memo = get_test_memo() memo["author"] = self.user_two self.memorepo.new(memo) result = self.memorepo.count("author", self.user_two) self.assertEqual(result, 3)
def test_count_all_with_multiple_added_works(self): before = self.memorepo.count() for i in range(1, 4): memo = get_test_memo(i) self.memorepo.new(memo) after = self.memorepo.count() self.assertEqual(after, before + 3)
def test_get_all_returns_list_of_memos(self): added_memos = [] added_memos.append(self.saved_memo) for i in range(1, 4): added_memos.append(self.memorepo.new(get_test_memo(i))) memos = self.memorepo.get("all") for i in range(len(memos)): self.assertEqual(memos[i], added_memos[i])
def test_get_author_id_with_author_works(self): user_two_memo = get_test_memo() user_two_memo["author"] = self.user_two self.memorepo.new(user_two_memo) queried_memos = self.memorepo.get( "author", self.saved_memo.author) self.assertEqual(len(queried_memos), 1) queried_memo = queried_memos[0] self.assertEqual(queried_memo.id, self.saved_memo.id) self.assertEqual(queried_memo.author, self.saved_memo.author)
def setUp(self): connect_test_database() self.userrepo = user_repository self.user = self.userrepo.update(get_test_memo_user()) self.user_two = self.userrepo.update( get_test_memo_user("6072d33e3a3c627a49901cd7", "memouser2")) self.memorepo = memo_repository self.before = self.memorepo.count() self.memo = get_test_memo() self.saved_memo = self.memorepo.new(self.memo)
def setUp(self): connect_test_database() self.userrepo = user_repository self.filerepo = file_repository self.author = self.userrepo.update(get_test_memo_user()) self.second_author = self.userrepo.update( get_test_memo_user('6072d33e3a3c627a49901cd7', "memouser2")) self.memo_service = memo_service self.image_service = image_service self.before = self.memo_service.count() self.test_memo = get_test_memo() self.saved_memo = self.memo_service.create(self.author.id, self.test_memo["title"], self.test_memo["content"])
def test_count_all_memos_works(self): before = self.memorepo.count("all") self.memorepo.new(get_test_memo()) after = self.memorepo.count("all") self.assertEqual(after, before + 1)
def test_count_defaults_to_all_memos(self): for i in range(1, 4): self.memorepo.new(get_test_memo()) count = self.memorepo.count() memos = self.memorepo.get() self.assertEqual(count, len(memos))
def test_get_defaults_get_all(self): for i in range(1, 4): self.memorepo.new(get_test_memo(i)) count = self.memorepo.count() memos = self.memorepo.get() self.assertEqual(len(memos), count)
def setUp(self): self.memo = get_test_memo() self.new_memo = Memo(author=self.memo["author"], title=self.memo["title"], content=self.memo["content"], date=self.memo["date"])