Ability to post new job templates. The permissions checks on these need more tests for non-org-admin users.

This commit is contained in:
Michael DeHaan
2013-04-18 22:11:00 -04:00
parent 6bb4f4f255
commit 28332cc5a5
2 changed files with 56 additions and 5 deletions

View File

@@ -100,12 +100,23 @@ class JobsTest(BaseTest):
)
def test_get_list(self):
def test_mainline(self):
# no credentials == 401
# job templates
data = self.get('/api/v1/job_templates/', expect=401)
data = self.get('/api/v1/job_templates/', expect=200, auth=self.get_normal_credentials())
#print data
self.assertTrue(data['count'], 99)
self.assertTrue(data['count'], 2)
rec = dict(
name = 'job-foo',
credential = self.credential.pk,
inventory = self.inventory.pk,
project = self.project.pk,
job_type = PERM_INVENTORY_DEPLOY
)
posted = self.post('/api/v1/job_templates/', rec, expect=201, auth=self.get_normal_credentials())
self.assertEquals(posted['url'], '/api/v1/job_templates/3/')