예제 #1
0
 def test_getting_identities_when_response_is_ok(self):
     api = AtmosphereAPI('token', base_url=self.mock_users_base_url)
     response = api.get_identities()
     assert response.ok
     assert response.message['results'][0]['user'][
         'id'] == 1010 and response.message['results'][0]['quota'][
             'cpu'] == 132
예제 #2
0
    def take_action(self, parsed_args):
        column_headers = ('uuid', 'name', 'provider', 'quota_cpu', 'quota_memory', 'quota_storage')
        api = AtmosphereAPI(self.app_args.auth_token, base_url=self.app_args.base_url, timeout=self.app_args.api_server_timeout, verify=self.app_args.verify_cert)
        data = api.get_identities()
        identities = []
        if data.ok:
            for identity in data.message['results']:
                identities.append((
                    identity['uuid'],
                    identity['user']['username'],
                    identity['provider']['name'],
                    identity['quota']['cpu'],
                    identity['quota']['memory'],
                    identity['quota']['storage']
                ))

        return (column_headers, tuple(identities))
예제 #3
0
 def test_getting_identities_when_response_is_not_ok(self):
     api = AtmosphereAPI('token', base_url=self.mock_users_bad_base_url)
     response = api.get_identities()
     assert not response.ok