def init(): init_provider() assert reset_role(email) == True # delete all old policies using acl/set API policy = "x can access x" r = untrusted.set_policy(policy) assert r['success'] is True
def init(): init_provider() assert reset_role(email) == True assert reset_role(delegate_email) == True # delete all old policies using acl/set API policy = "x can access x" r = untrusted.set_policy(policy) assert r['success'] is True # register abc.123 as delegate and set delegate rule r = role_reg(delegate_email, '9454234223', name, ["delegate"], org_id, csr) assert r['success'] == True assert r['status_code'] == 200 # register barun user as all roles r = role_reg(email, '9454234223', name, ["consumer", "onboarder", "data ingester", "delegate"], org_id, csr) assert r['success'] == True assert r['status_code'] == 200
from init import consumer from access import * from consent import role_reg import random import string init_provider() # use consumer certificate to register email = "*****@*****.**" assert reset_role(email) == True org_id = add_organization("iisc.ac.in") # delete all old policies using acl/set API policy = "x can access x" r = untrusted.set_policy(policy) assert r['success'] is True # provider ID of [email protected] provider_id = 'rbccps.org/f3dad987e514af08a4ac46cf4a41bd1df645c8cc' ##### consumer ##### resource_group = ''.join(random.choice(string.ascii_lowercase) for _ in range(10)) resource_id = provider_id + '/rs.example.com/' + resource_group # token request should fail body = {"id" : resource_id + "/someitem", "apis" : ["/ngsi-ld/v1/entities"] } r = consumer.get_token(body) assert r['success'] is False