One more test for the api
@@ -59,6 +59,28 @@ class APIBuildTests(TestCase):
self.assertEqual(build['output'], 'Test Output')
self.assertEqual(build['state_display'], 'Cloning')
+ def test_save_config(self):
+ """Test that a superuser can use the API."""
+ client = APIClient()
+ client.login(username='super', password='test')
+ resp = client.post(
+ '/api/v2/build/',
+ {
+ 'project': 1,
+ 'version': 1,
+ 'config': {'one': 'two'},
+ },
+ format='json',
+ )
+ self.assertEqual(resp.status_code, status.HTTP_201_CREATED)
+ build = resp.data
+ self.assertEqual(build['config'], {'one': 'two'})
+
+ resp = client.get('/api/v2/build/%s/' % build['id'])
+ self.assertEqual(resp.status_code, 200)
+ build = resp.data
+ self.assertEqual(build['config'], {'one': 'two'})
+
def test_response_building(self):
"""
The ``view docs`` attr should return a link
