pass flake8
This commit is contained in:
parent
fe9ee4c11a
commit
b41d4ea06e
@ -2,9 +2,8 @@
|
||||
Test for recipe APIs.
|
||||
"""
|
||||
from decimal import Decimal
|
||||
from operator import itemgetter
|
||||
|
||||
from django.contrib.auth import get_user, get_user_model
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.test import TestCase
|
||||
from django. urls import reverse
|
||||
|
||||
@ -65,7 +64,10 @@ class PrivateRecipeApiTests(TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.client = APIClient()
|
||||
self.user = create_user(email='user@example.com', password='testpass123')
|
||||
self.user = create_user(
|
||||
email='user@example.com',
|
||||
password='testpass123'
|
||||
)
|
||||
self.client.force_authenticate(self.user)
|
||||
|
||||
def test_retrive_recipes(self):
|
||||
@ -83,7 +85,10 @@ class PrivateRecipeApiTests(TestCase):
|
||||
|
||||
def test_recipe_list_limited_to_user(self):
|
||||
"""Test list of recipes is limited to authenticated user."""
|
||||
other_user = create_user(email='other@example.com', password='password123')
|
||||
other_user = create_user(
|
||||
email='other@example.com',
|
||||
password='password123'
|
||||
)
|
||||
create_recipe(user=other_user)
|
||||
create_recipe(user=self.user)
|
||||
|
||||
@ -165,7 +170,10 @@ class PrivateRecipeApiTests(TestCase):
|
||||
|
||||
def test_update_user_returns_error(self):
|
||||
"""Test changing the recipe user results in an error."""
|
||||
new_user = create_user(email='user2@example.com', password='testpass123')
|
||||
new_user = create_user(
|
||||
email='user2@example.com',
|
||||
password='testpass123'
|
||||
)
|
||||
recipe = create_recipe(user=self.user)
|
||||
|
||||
payload = {'user': new_user.id}
|
||||
@ -187,7 +195,10 @@ class PrivateRecipeApiTests(TestCase):
|
||||
|
||||
def test_recipe_other_users_recipe_error(self):
|
||||
"""Test trying to delete another users recipe gives error."""
|
||||
new_user = create_user(email='user2@example.com', password='testpass123')
|
||||
new_user = create_user(
|
||||
email='user2@example.com',
|
||||
password='testpass123'
|
||||
)
|
||||
recipe = create_recipe(user=new_user)
|
||||
|
||||
url = detail_url(recipe.id)
|
||||
|
Loading…
Reference in New Issue
Block a user