Beispiel #1
0
 def test_create_who_knows(self):
     auth_args = {
         'auth_url': 'http://localhost:5000/',
         'username': '******',
         'password': '******',
     }
     auth = discoverable.Auth(**auth_args)
     self.assertEqual('openstack.auth.identity.v3',
                      auth.auth_plugin.__class__.__module__)
Beispiel #2
0
    def test_methods(self):
        auth_args = {
            'auth_url': 'http://localhost:5000/',
            'username': '******',
            'password': '******',
        }
        auth = discoverable.Auth(**auth_args)
        self.assertEqual('http://localhost:5000/auth/tokens', auth.token_url)
        xport = mock.MagicMock()
        xport.post = mock.Mock()
        response = mock.Mock()
        response.json = mock.Mock()
        response.json.return_value = common.TEST_RESPONSE_DICT_V3
        response.headers = {'X-Subject-Token': common.TEST_SUBJECT}
        xport.post.return_value = response

        result = auth.authorize(xport)
        self.assertEqual(common.TEST_SUBJECT, result.auth_token)
        self.assertEqual(True, auth.invalidate())