MCPcopy Create free account
hub / github.com/encode/django-rest-framework / test_create

Method test_create

tests/test_routers.py:515–524  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

513 RouterTestModel.objects.create(uuid='a b', text='baz qux')
514
515 def test_create(self):
516 new_note = {
517 'uuid': 'foo',
518 'text': 'example'
519 }
520 response = self.client.post('/example/notes/', data=new_note)
521 assert response.status_code == 201
522 assert response['location'] == 'http://testserver/example/notes/foo/'
523 assert response.data == {"url": "http://testserver/example/notes/foo/", "uuid": "foo", "text": "example"}
524 assert RouterTestModel.objects.filter(uuid='foo').exists()
525
526 def test_retrieve(self):
527 for url in ('/example/notes/123/', '/default/notes/123/'):

Callers

nothing calls this directly

Calls 3

postMethod · 0.45
existsMethod · 0.45
filterMethod · 0.45

Tested by

no test coverage detected