Esempio n. 1
0
 def test_memberOf_false(self):
     """When the memberOf param value is a string, and that value DOESN'T
     exist within the memberOf token array, `acl_in_token` return False.
     """
     output = http_auth.acl_in_token(self.token,
                                     memberOf='a-group-never-heard-of')
     self.assertFalse(output)
Esempio n. 2
0
 def test_memberOf_array_false(self):
     """When the memberOf param value is a List, and NONE of those values
     exist within the memberOf token array, `acl_in_token` returns False.
     """
     output = http_auth.acl_in_token(
         self.token,
         memberOf=['a-group-never-heard-of', 'some-other-crazy-group'])
     self.assertFalse(output)
Esempio n. 3
0
 def test_memberOf(self):
     """When the memberOf param equals the token memberOf, `acl_in_token` returns True."""
     output = http_auth.acl_in_token(self.token, memberOf='some-group')
     self.assertTrue(output)
Esempio n. 4
0
 def test_username_array_false(self):
     """When the username param is a List and the token DOESN"T contain an element
     within that list, `acl_in_token` returns False.
     """
     output = http_auth.acl_in_token(self.token, username=['peep-A', 'bro'])
     self.assertFalse(output)
Esempio n. 5
0
 def test_username_false(self):
     """When the username param does not equal the token username, `acl_in_token`
     returns False.
     """
     output = http_auth.acl_in_token(self.token, username='******')
     self.assertFalse(output)
Esempio n. 6
0
 def test_username_array(self):
     """When the username param is a List and the token contains an element
     within that list, `acl_in_token` returns True.
     """
     output = http_auth.acl_in_token(self.token, username=['bob'])
     self.assertTrue(output)
Esempio n. 7
0
 def test_username(self):
     """When the username param equals the token username, `acl_in_token` returns True.
     """
     output = http_auth.acl_in_token(self.token, username='******')
     self.assertTrue(output)
Esempio n. 8
0
 def test_version_array_false(self):
     """When the version param is a List, the token DOESN'T contain an element
     within that list, `acl_in_token` returns False.
     """
     output = http_auth.acl_in_token(self.token, version=[1000, 1001])
     self.assertFalse(output)
Esempio n. 9
0
 def test_version_false(self):
     """When the version param does not equal the token version, `acl_in_token`
     returns False.
     """
     output = http_auth.acl_in_token(self.token, version=1000)
     self.assertFalse(output)
Esempio n. 10
0
 def test_version_array(self):
     """When the version param is a List and the token contains an element
     within that list, `acl_in_token` returns True.
     """
     output = http_auth.acl_in_token(self.token, version=[1, 2])
     self.assertTrue(output)
Esempio n. 11
0
 def test_version(self):
     """When the version param equals the token version, `acl_in_token` returns True.
     """
     output = http_auth.acl_in_token(self.token, version=1)
     self.assertTrue(output)
Esempio n. 12
0
 def test_defaults_false(self):
     """When no parameters are set, `acl_in_token` returns False."""
     output = http_auth.acl_in_token(self.token)
     self.assertFalse(output)
Esempio n. 13
0
 def test_memberOf_array(self):
     """When the memberOf param is a List and the token contains an element
     within that list, `acl_in_token` returns True."""
     output = http_auth.acl_in_token(
         self.token, memberOf=['some-group', 'a-group-never-heard-of'])
     self.assertTrue(output)