Skip to content

Commit 400859f

Browse files
committed
Update test
API v1 is read only
1 parent 7f03825 commit 400859f

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

readthedocs/rtd_tests/tests/test_api.py

+3-12
Original file line numberDiff line numberDiff line change
@@ -418,8 +418,8 @@ def test_get_invalid_raw_log(self):
418418
class APITests(TestCase):
419419
fixtures = ['eric.json', 'test_data.json']
420420

421-
def test_make_project(self):
422-
"""Test that a superuser can use the API."""
421+
def test_cant_make_project(self):
422+
"""Test that a can't use the API to create projects."""
423423
post_data = {
424424
'name': 'awesome-project',
425425
'repo': 'https://github.com/ericholscher/django-kong.git',
@@ -430,16 +430,7 @@ def test_make_project(self):
430430
content_type='application/json',
431431
HTTP_AUTHORIZATION='Basic %s' % super_auth,
432432
)
433-
self.assertEqual(resp.status_code, 201)
434-
self.assertEqual(resp['location'], '/api/v1/project/24/')
435-
resp = self.client.get(
436-
'/api/v1/project/24/',
437-
data={'format': 'json'},
438-
HTTP_AUTHORIZATION='Basic %s' % eric_auth,
439-
)
440-
self.assertEqual(resp.status_code, 200)
441-
obj = json.loads(resp.content)
442-
self.assertEqual(obj['slug'], 'awesome-project')
433+
self.assertEqual(resp.status_code, status.HTTP_401_UNAUTHORIZED)
443434

444435
def test_user_doesnt_get_full_api_return(self):
445436
user_normal = get(User, is_staff=False)

0 commit comments

Comments
 (0)