Note: The default ITS GitLab runner is a shared resource and is subject to slowdowns during heavy usage.
You can run your own GitLab runner that is dedicated just to your group if you need to avoid processing delays.

Commit 28620831 authored by Bruce Timberlake's avatar Bruce Timberlake
Browse files

Some data cleanups

parent 03950ab1
......@@ -14,8 +14,8 @@ logger = logging.getLogger(__name__)
# which may be different in your IDE, or command line.
class IamGroupCRUDTests(unittest.TestCase):
client_id = "e06fb405-c58e-4334-b746-dd5969575bf2"
secret = "G5oT3vL1uK8xS7rO5sJ4nH7bK5iB6hN5jN5dI0nL8tO5bG4tT5"
client_id = "some-guid-goes-here"
secret = "secret-string-goes-here"
scope = "iamgroups"
token_url = "https://apigw-tst.it.umich.edu/um/inst/oauth2/token"
url_base = "https://apigw-tst.it.umich.edu/um/iamGroups"
......@@ -44,7 +44,7 @@ class IamGroupCRUDTests(unittest.TestCase):
# needs to url encode. Note the test at the bottom of the unit test.
def test_2_read(self):
api = ApiDirectory(self.client_id, self.secret, self.scope, self.token_url)
dn = "cn=iamGroupTestJB,ou=user groups,ou=groups,dc=umich,dc=edu"
dn = "cn=TestGroupName,ou=user groups,ou=groups,dc=umich,dc=edu"
encoded = urllib.parse.quote(dn)
url_endpoint = 'profile/dn'
url = IamGroupCRUDTests.url_base + '/' + url_endpoint + "/" + encoded
......@@ -66,14 +66,14 @@ class IamGroupCRUDTests(unittest.TestCase):
profile = list[0]
self.assertEqual(profile['dn'], dn)
# update. There are many update operations. I am showing how to modifiy a moderator.
# update. There are many update operations. I am showing how to modify a moderator.
def test_3_update(self):
api = ApiDirectory(self.client_id, self.secret, self.scope, self.token_url)
url_endpoint = 'update/moderator'
url = IamGroupCRUDTests.url_base + '/' + url_endpoint
data = {'dn': 'cn=iamGroupTestJB,ou=user groups,ou=groups,dc=umich,dc=edu',
'moderator': [{'email': 'john.boufford@yahoo.com'},
{'name': 'John Boufford', 'email': 'jbouffor@yahoo.com'}]}
data = {'dn': 'cn=TestGroupName,ou=user groups,ou=groups,dc=umich,dc=edu',
'moderator': [{'email': 'bjensen@umich.edu'},
{'name': 'Barbara Jensen', 'email': 'bjensen@umich.edu'}]}
response = requests.post(
url=url,
......@@ -89,7 +89,7 @@ class IamGroupCRUDTests(unittest.TestCase):
# delete an existing group. Again the dn is part of the url so it should be encoded.
def test_4_delete(self):
api = ApiDirectory(self.client_id, self.secret, self.scope, self.token_url)
dn = "cn=iamGroupTestJB,ou=user groups,ou=groups,dc=umich,dc=edu"
dn = "cn=TestGroupName,ou=user groups,ou=groups,dc=umich,dc=edu"
encoded = urllib.parse.quote(dn)
url_endpoint = 'delete'
url = IamGroupCRUDTests.url_base + '/' + url_endpoint + "/" + encoded
......@@ -107,8 +107,8 @@ class IamGroupCRUDTests(unittest.TestCase):
# Note that I used urllib.parse.quote which converts spaces to %20.
# the urllib.parse.quote_plus converts spaces to a plus sign. Which fails in this api.
def test_urlencoding(self):
expected = "cn%3DiamGroupTestJB%2Cou%3Duser%20groups%2Cou%3Dgroups%2Cdc%3Dumich%2Cdc%3Dedu"
pre = "cn=iamGroupTestJB,ou=user groups,ou=groups,dc=umich,dc=edu"
expected = "cn%3DTestGroupName%2Cou%3Duser%20groups%2Cou%3Dgroups%2Cdc%3Dumich%2Cdc%3Dedu"
pre = "cn=TestGroupName,ou=user groups,ou=groups,dc=umich,dc=edu"
post = urllib.parse.quote(pre)
print(post)
self.assertEqual(post, expected)
......@@ -117,7 +117,7 @@ class IamGroupCRUDTests(unittest.TestCase):
# Make sure to encode the name because the name can contain spaces and other specail chars.
def test_isValid(self):
api = ApiDirectory(self.client_id, self.secret, self.scope, self.token_url)
name = "iamGroupTestJB"
name = "TestGroupName"
encoded = urllib.parse.quote(name)
url_endpoint = 'isValidName'
url = IamGroupCRUDTests.url_base + '/' + url_endpoint + "/" + encoded
......@@ -138,7 +138,7 @@ class IamGroupCRUDTests(unittest.TestCase):
# Make sure to encode the name because the name can contain spaces and other specail chars.
def test_isValid_failed(self):
api = ApiDirectory(self.client_id, self.secret, self.scope, self.token_url)
name = "jbouffor"
name = "bjensen"
encoded = urllib.parse.quote(name)
url_endpoint = 'isValidName'
url = IamGroupCRUDTests.url_base + '/' + url_endpoint + "/" + encoded
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment