Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
soofstad committed Nov 10, 2023
1 parent e1563fc commit aefc3d0
Showing 1 changed file with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def setUp(self):
"name": "myEngine",
"description": "",
"fuelPump": {
"address": "$fuel_pump_id",
"address": "dmss://datasource2/$fuel_pump_id",
"type": SIMOS.REFERENCE.value,
"referenceType": REFERENCE_TYPES.LINK.value,
},
Expand All @@ -78,8 +78,14 @@ def setUp(self):
self.document_repository.name = "datasource"
self.document_repository.get = self.mock_get
self.document_repository.find = self.mock_find

self.document_repository2 = mock.Mock()
self.document_repository2.name = "datasource2"
self.document_repository2.get = self.mock_get2
# self.document_repository2.find = self.mock_find2

self.document_service = get_mock_document_service(
repository_provider=lambda x, y: self.document_repository,
repository_provider=lambda x, y: next((dr for dr in (self.document_repository, self.document_repository2) if dr.name == x)),
blueprint_provider=None,
)

Expand All @@ -93,7 +99,10 @@ def mock_get(self, document_id: str):
if document_id == "customer_id":
return {**self.customer}
return None

def mock_get2(self, document_id: str):
if document_id == "fuel_pump_id":
return {**self.fuel_pump}
return None
def mock_find(self, query: dict) -> list[dict]:
documents: list[dict] = [
self.car_rental_company,
Expand Down Expand Up @@ -231,3 +240,7 @@ def test_invalid_reference_to_primitive(self):
Address.from_absolute("datasource/$car_rental_company_id.cars[0].plateNumber"),
self.document_service.get_data_source,
)

def test_invalid_reference_to_primitive(self):
Address.from_absolute(address)

0 comments on commit aefc3d0

Please sign in to comment.