Skip to content

Instantly share code, notes, and snippets.

@mhassanist
Created March 8, 2023 16:15
Show Gist options
  • Save mhassanist/785326d39f134e9b92d525684ab515d2 to your computer and use it in GitHub Desktop.
Save mhassanist/785326d39f134e9b92d525684ab515d2 to your computer and use it in GitHub Desktop.
import requests
import unittest
class TestNotesAPI(unittest.TestCase):
base_url = "https://afternoon-beach-08354.herokuapp.com/"
def test_add_note(self):
sample_note = {"content": "do prog2 assignment sooon!"}
response = requests.post(TestNotesAPI.base_url + "/notes",
json=sample_note)
self.assertEqual(response.status_code, 201)
#make sure the returned object is actually equals to the passed object
self.assertEqual(response.json()['content'], sample_note["content"])
self.assertEqual("note_id" in response.json(), True)
def test_remove_note(self):
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment