Skip to content

Commit

Permalink
LinkedInLearning#1 completed unit testing tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
Shamaine committed Feb 19, 2024
1 parent c4d0cfd commit b35b6b7
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions notes/test_notes_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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('<h3>')

@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()



0 comments on commit b35b6b7

Please sign in to comment.