def test_get_token_returns_token_on_success(self):
     _prepare_mock_post(status=200,
                        body='{"access": {"token": {"id": "token"}}}')
     token = auth.get_token(username='******', password='******')
     self.assertEqual(token, 'token')
 def test_get_token_returns_token_on_success(self):
     _prepare_mock_post(status=200,
                        body='{"access": {"token": {"id": "token"}}}')
     token = auth.get_token(username='******', password='******')
     self.assertEqual(token, 'token')
 def test_get_token_by_apikey_raises_if_invalid_creds(self):
     _prepare_mock_post(status=403)
     with self.assertRaises(HTTPError):
         auth.get_token(apikey='bad', username='******')
 def test_get_token_by_apikey_raises_if_invalid_creds(self):
     _prepare_mock_post(status=403)
     with self.assertRaises(HTTPError):
         auth.get_token(apikey='bad', username='******')