Exemple #1
0
 def __init__(self, scheme=None, host=None, prefix=None,
              alternative_namespace=None, auth_client=None):
     self.version = None
     self.namespace = alternative_namespace if alternative_namespace is not None else "{}://{}".format(scheme, host)
     self.env = None
     self.config = NexusConfig(scheme, host, prefix, alternative_namespace)
     self._http_client = MockHttpClient(self.config.NEXUS_ENDPOINT, self.config.NEXUS_PREFIX, auth_client=auth_client,
                                        alternative_endpoint_writing=self.config.NEXUS_NAMESPACE)
     self.domains = DomainRepository(self._http_client)
     self.contexts = ContextRepository(self._http_client)
     self.organizations = OrganizationRepository(self._http_client)
     self.instances = InstanceRepository(self._http_client)
     self.schemas = SchemaRepository(self._http_client)
Exemple #2
0
# create organization on KG
org_repo = OrganizationRepository(nar_client)
org_repo.create(naro)
# List all organisation : new organization should be listed there
kg_organizations = org_repo.list()
[print(x) for x in kg_organizations.results]

#
# 3. Create a new domain and list it. (test_schema)
#
from pyxus.resources.repository import DomainRepository
from pyxus.resources.entity import Domain

naro_tests = Domain.create_new(organisation_name, domain_name, "Test schemas")
# create Domain on naro
domain_repo = DomainRepository(nar_client)
domain_repo.create(naro_tests)
# List all domain in naro : new organization should be listed there
naro_domains = domain_repo.list()
[str(x) for x in naro_domains.results]

#
# 4. Upload schema and read it. ('foaf_sh_schema')
#

host_schema = "http://" + host_url + "/v0/schemas/" + fpath

test_schema = {
    "@id":
    host_schema,
    "@type":
Exemple #3
0
 def setUp(self):
     logging.basicConfig(level=logging.DEBUG)
     self.repository = DomainRepository(NexusClient()._http_client)