def test_api_account(self): """ ACCOUNT (API): Test external representation of account information """ out = get_account_info(self.account_name, **self.vo) assert self.account_name == out['account'] out = [acc['account'] for acc in list_accounts(**self.vo)] assert self.account_name in out if self.multi_vo: assert self.account.internal not in out assert '@' not in ' '.join(out)
def test_api_account(self): """ ACCOUNT (API): Test external representation of account information """ out = get_account_info(self.account_name, **self.vo) assert_equal(self.account_name, out['account']) out = [acc['account'] for acc in list_accounts(**self.vo)] assert_in(self.account_name, out) if self.multi_vo: assert_not_in(self.account.internal, out) assert_not_in('@', ' '.join(out))
def test_accounts_at_different_vos(self): """ MULTI VO (CLIENT): Test that accounts from 2nd vo don't interfere """ account_client = AccountClient() usr_uuid = str(generate_uuid()).lower()[:16] tst = 'tst-%s' % usr_uuid new = 'new-%s' % usr_uuid shr = 'shr-%s' % usr_uuid account_client.add_account(tst, 'USER', '*****@*****.**') account_client.add_account(shr, 'USER', '*****@*****.**') add_account(new, 'USER', '*****@*****.**', 'root', **self.new_vo) add_account(shr, 'USER', '*****@*****.**', 'root', **self.new_vo) account_list_tst = [a['account'] for a in account_client.list_accounts()] account_list_new = [a['account'] for a in list_accounts(filter={}, **self.new_vo)] assert_true(tst in account_list_tst) assert_false(new in account_list_tst) assert_true(shr in account_list_tst) assert_false(tst in account_list_new) assert_true(new in account_list_new) assert_true(shr in account_list_new)
def GET(self): """ list all rucio accounts. HTTP Success: 200 OK HTTP Error: 401 Unauthorized 500 InternalError :param Rucio-Account: Account identifier. :param Rucio-Auth-Token: as an 32 character hex string. :returns: A list containing all account names as dict. """ header('Content-Type', 'application/x-json-stream') filter = {} if ctx.query: filter = dict(parse_qsl(ctx.query[1:])) for account in list_accounts(filter=filter): yield render_json(**account) + "\n"
def get(self): """ list all rucio accounts. .. :quickref: Account; List all accounts. :resheader Content-Type: application/x-json-stream :status 200: OK. :status 401: Invalid auth token. :status 500: Database exception :returns: A list containing all account names as dict. """ filter = {} for k, v in request.args.items(): filter[k] = v data = "" for account in list_accounts(filter=filter): data += render_json(**account) + "\n" return Response(data, content_type="application/x-json-stream")
def GET(self): """ list all rucio accounts. HTTP Success: 200 OK HTTP Error: 401 Unauthorized 500 InternalError :param Rucio-Account: Account identifier. :param Rucio-Auth-Token: as an 32 character hex string. :returns: A list containing all account names as dict. """ header('Content-Type', 'application/x-json-stream') filter = {} if ctx.query: filter = dict(parse_qsl(ctx.query[1:])) for account in list_accounts(filter=filter): yield render_json(**account) + "\n"
def generate(_filter, vo): for account in list_accounts(filter=_filter, vo=vo): yield render_json(**account) + "\n"