Skip to content

Commit

Permalink
Testando se o usuário enviou o JWT para fazer POST
Browse files Browse the repository at this point in the history
  • Loading branch information
luizomf committed Apr 5, 2022
1 parent ddf6c05 commit ad1e19d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion recipes/tests/test_recipe_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@


class RecipeAPIv2Test(test.APITestCase, RecipeMixin):
def get_recipe_api_list(self, reverse_result=None):
def get_recipe_reverse_url(self, reverse_result=None):
api_url = reverse_result or reverse('recipes:recipes-api-list')
return api_url

def get_recipe_api_list(self, reverse_result=None):
api_url = self.get_recipe_reverse_url(reverse_result)
response = self.client.get(api_url)
return response

Expand Down Expand Up @@ -73,3 +77,11 @@ def test_recipe_api_list_loads_recipes_by_category_id(self):
len(response.data.get('results')),
9
)

def test_recipe_api_list_user_must_send_jwt_token_to_create_recipe(self):
api_url = self.get_recipe_reverse_url()
response = self.client.post(api_url)
self.assertEqual(
response.status_code,
401
)

0 comments on commit ad1e19d

Please sign in to comment.