mirror of
https://github.com/ansible/awx.git
synced 2026-02-16 02:30:01 -03:30
Some hacks to make organizational user object creation possible by posting directly to the subcollection. This is a little complex due to the user (being a Django object) not having any FKs
to our objects. This should be refactored later but is at least sufficiently operational for the two cases it is used here.
This commit is contained in:
@@ -270,6 +270,15 @@ class OrganizationsTest(BaseTest):
|
||||
users = self.get(url, expect=200, auth=self.get_normal_credentials())
|
||||
self.assertEqual(users['count'], 1)
|
||||
|
||||
# post a completely new user to verify we can add users to the subcollection directly
|
||||
new_user = dict(username='NewUser9000')
|
||||
which_org = self.normal_django_user.admin_of_organizations.all()[0]
|
||||
url = '/api/v1/organizations/%s/users/' % (which_org.pk)
|
||||
posted = self.post(url, new_user, expect=201, auth=self.get_normal_credentials())
|
||||
|
||||
all_users = self.get(url, expect=200, auth=self.get_normal_credentials())
|
||||
self.assertEqual(all_users['count'], 2)
|
||||
|
||||
def test_post_item_subobjects_admins(self):
|
||||
|
||||
url = '/api/v1/organizations/2/admins/'
|
||||
|
||||
Reference in New Issue
Block a user