def test_get_search_url(): assert Rating.get_search_url() == reverse('ratings:search')
# TODO add tests for MIN and MAX values of stars # TODO test perform_create import pytest from django.urls import reverse from accounts.models import UserAccount from factories import RatingFactory, RecipeFactory, UserFactory from ratings.models import Rating from recipes.models import Recipe pytestmark = pytest.mark.django_db rating_rate_url = Rating.get_create_url() rating_search_url = Rating.get_search_url() create_recipe_url = Recipe.get_create_url() class TestRatingCreateView: class TestAuthenticatedUsers: def test_rating_page_render(self, api_client): new_user = UserFactory() api_client.force_authenticate(new_user) response = api_client.get(rating_rate_url) assert response.status_code == 405 def test_rate_post_request(self, api_client): new_user = UserFactory() api_client.force_authenticate(new_user) new_recipe = RecipeFactory() new_recipe = Recipe.objects.all().get(id__exact=new_recipe.id)