Esempio n. 1
0
    def setUp(self):
        super().setUp()
        key = PrivateKey.deserialize(
            'x0NeASLPFhOFfq3Q9M0joMveI4HjGwEuJ9dtX/HTSRY=')
        agent = Agent(url='https://auth.example.com', username='******')
        auth_info = AuthInfo(key=key, agents=[agent])
        url = 'https://rbac.example.com/'

        self.mock_request = self.patch(requests, 'request')
        self.client = RBACClient(url=url, auth_info=auth_info)
Esempio n. 2
0
 def test_default_config_from_settings(self):
     Config.objects.set_config('rbac_url', 'https://rbac.example.com')
     Config.objects.set_config('external_auth_url',
                               'https://auth.example.com')
     Config.objects.set_config('external_auth_user', 'user@candid')
     Config.objects.set_config(
         'external_auth_key',
         'x0NeASLPFhOFfq3Q9M0joMveI4HjGwEuJ9dtX/HTSRY=')
     client = RBACClient()
     self.assertEqual(client._url, 'https://rbac.example.com')
     self.assertEqual(
         client._auth_info.key,
         PrivateKey.deserialize(
             'x0NeASLPFhOFfq3Q9M0joMveI4HjGwEuJ9dtX/HTSRY='))
     [agent] = client._auth_info.agents
     self.assertEqual(agent.url, 'https://auth.example.com')
     self.assertEqual(agent.username, 'user@candid')
Esempio n. 3
0
 def test_default_config_from_settings(self):
     Config.objects.set_config("rbac_url", "https://rbac.example.com")
     Config.objects.set_config("external_auth_url",
                               "https://auth.example.com")
     Config.objects.set_config("external_auth_user", "user@candid")
     Config.objects.set_config(
         "external_auth_key",
         "x0NeASLPFhOFfq3Q9M0joMveI4HjGwEuJ9dtX/HTSRY=")
     client = RBACClient()
     self.assertEqual(client._url, "https://rbac.example.com")
     self.assertEqual(
         client._auth_info.key,
         PrivateKey.deserialize(
             "x0NeASLPFhOFfq3Q9M0joMveI4HjGwEuJ9dtX/HTSRY="),
     )
     [agent] = client._auth_info.agents
     self.assertEqual(agent.url, "https://auth.example.com")
     self.assertEqual(agent.username, "user@candid")