From 88b171bd5b89e2d0668a3ba8349cd63b18f4c729 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Tue, 26 Mar 2013 18:53:39 -0400 Subject: [PATCH] Add tests for posting new hosts via subcollection. --- lib/main/tests/inventory.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/main/tests/inventory.py b/lib/main/tests/inventory.py index cf848b1682..af924121d9 100644 --- a/lib/main/tests/inventory.py +++ b/lib/main/tests/inventory.py @@ -185,16 +185,23 @@ class InventoryTest(BaseTest): url = '/api/v1/inventories/1/hosts/' - new_host = dict(name='web100.example.com') - added_by_collection = self.post(url, data=new_host, expect=201, auth=self.get_super_credentials()) + new_host_a = dict(name='web100.example.com') + new_host_b = dict(name='web101.example.com') + new_host_c = dict(name='web102.example.com') + new_host_d = dict(name='web103.example.com') + new_host_e = dict(name='web104.example.com') # a super user can associate hosts with inventories + added_by_collection = self.post(url, data=new_host_a, expect=201, auth=self.get_super_credentials()) # an org admin can associate hosts with inventories + added_by_collection = self.post(url, data=new_host_b, expect=201, auth=self.get_normal_credentials()) # a normal user cannot associate hosts with inventories + added_by_collection = self.post(url, data=new_host_c, expect=403, auth=self.get_nobody_credentials()) # a normal user with edit permission on the inventory can associate hosts with inventories + added_by_collection = self.post(url, data=new_host_d, expect=403, auth=self.get_other_credentials()) ################################################## # GROUPS->inventories POST via subcollection