def __save_service_source(self, tenant, service, service_source): if service_source: service_source.pop("ID") new_service_source = ServiceSourceInfo(**service_source) new_service_source.service_id = service.service_id new_service_source.team_id = tenant.tenant_id new_service_source.save()
def test_list_by_svc_share_uuids(): tenant_id = "6d1c06e1d9e84d57aeb42ea80d49018a" service_id = "560ca84003254737a426d0bd5f513afd" service_cname = "WordPress" group_id = 20 service = TenantServiceInfo() service.tenant_id = tenant_id service.service_id = service_id service.service_cname = service_cname service.save() service_source = ServiceSourceInfo() service_source.team_id = tenant_id service_source.service_id = service_id service_source.service_share_uuid = "2669c2cec6bc7bf5aab29a0ea2703d66" service_source.save() group_relation = ServiceGroupRelation() group_relation.service_id = service_id group_relation.group_id = group_id group_relation.save() from console.repositories.app import service_repo result = service_repo.list_by_svc_share_uuids( group_id, ["2669c2cec6bc7bf5aab29a0ea2703d66"]) service = result[0] assert service.get("service_id") == service_id assert service.get("service_cname") == service_cname