def test_post_exists_returns_false(self, post_mock): post_mock.objects.get.side_effect = ObjectDoesNotExist post_storage_object = PostStorageImpl() response = post_storage_object.post_exists(post_id=1) post_mock.objects.get.assert_called_once_with(pk=1) assert response == False
def test_post_exists_returns_true(self, post_mock): post = create_autospec(Post) post_mock.objects.get.return_value = post post_storage_object = PostStorageImpl() response = post_storage_object.post_exists(post_id=1) post_mock.objects.get.assert_called_once_with(pk=1) assert response == True