def relationship_with_10_records(org): lm = factories.LogicModule(name='Products Service', endpoint_name='products') lmm = factories.LogicModuleModel( logic_module_endpoint_name=lm.endpoint_name, model='Product', endpoint='/products/', lookup_field_name='uuid') lm_document = factories.LogicModule(name='Document Service', endpoint_name='documents') lmm_document = factories.LogicModuleModel( logic_module_endpoint_name=lm_document.endpoint_name, model='Document', endpoint='/documents/', lookup_field_name='uuid') relationship = factories.Relationship(origin_model=lmm, related_model=lmm_document, key='product_document_relationship') for _ in range(10): factories.JoinRecord.create(relationship=relationship, record_uuid=uuid.uuid4(), record_id=None, related_record_uuid=uuid.uuid4(), related_record_id=None, organization=org) return relationship
def relationship(): lm = factories.LogicModule(name='Products Service', endpoint_name='products') lmm = factories.LogicModuleModel(logic_module_endpoint_name=lm.endpoint_name, model='Product', endpoint='/products/') lm_document = factories.LogicModule(name='Document Service', endpoint_name='documents') lmm_document = factories.LogicModuleModel(logic_module_endpoint_name=lm_document.endpoint_name, model='Document', endpoint='/documents/') return factories.Relationship(origin_model=lmm, related_model=lmm_document, key='product_document_relationship')
def relationship_with_local(): lm = factories.LogicModule(name='Products Service', endpoint_name='products') lmm = factories.LogicModuleModel(logic_module_endpoint_name=lm.endpoint_name, model='Product', endpoint='/products/') lmm_org = factories.LogicModuleModel(logic_module_endpoint_name='core', model='Organization', endpoint='/organization/', lookup_field_name='organization_uuid', is_local=True) return factories.Relationship(origin_model=lmm, related_model=lmm_org, key='product_document_relationship')
def relationship2(relationship): lmm = relationship.origin_model # Products model from 1st relationship lm_location = factories.LogicModule(name='Location Service', endpoint_name='location') lmm_location = factories.LogicModuleModel( logic_module_endpoint_name=lm_location.endpoint_name, model='Location', endpoint='/siteprofile/') return factories.Relationship(origin_model=lmm, related_model=lmm_location, key='location_relationship')
def datamesh(): lm1 = factories.LogicModule.create(name='location', endpoint_name='location', endpoint='http://locationservice:8080') lm2 = factories.LogicModule.create(name='documents', endpoint_name='documents', endpoint='http://documentservice:8080') lmm1 = factories.LogicModuleModel( logic_module_endpoint_name=lm1.endpoint_name, model='SiteProfile', endpoint='/siteprofiles/', lookup_field_name='uuid') lmm2 = factories.LogicModuleModel( logic_module_endpoint_name=lm2.endpoint_name, model='Document', endpoint='/documents/', lookup_field_name='id') relationship = factories.Relationship(origin_model=lmm1, related_model=lmm2, key='documents') return lm1, lm2, relationship