diff --git a/notes/test_notes_views.py b/notes/test_notes_views.py index c941ec1d..846c4ad5 100644 --- a/notes/test_notes_views.py +++ b/notes/test_notes_views.py @@ -18,3 +18,19 @@ def test_list_endpoint_return_user_notes(client,logged_user): content=str(response.content) assert note.title in content assert 1 ==content.count('

') + +@pytest.mark.django_db +def test_create_endpoint_receives_form_data(client,logged_user): + form_data = {'title':'An Impressive title', 'text':'A really interesting text'} + + response =client.post(path='/smart/notes/new',data = form_data,follow=True) + + assert 200 == response.status_code + + #check if we receive the final template we expect + assert 'notes/notes_list.html' in response.template_name + # to make sure the user has at least 1 note + assert 1 ==logged_user.notes.count() + + +