Commit d29071f5 authored by Andreas Ellewsen's avatar Andreas Ellewsen
Browse files

Run black on project

parent 54cc2f87
......@@ -472,6 +472,7 @@ def test_get_bilagstype(client, requests_mock, bilagstype_data):
expected = Bilagstype.from_dict(bilagstype_data[0])
assert expected == received
def test_get_ressurs(client, base_url, requests_mock, ressurs_data):
company_id = "72"
ressurs_id = "99999"
......
......@@ -98,6 +98,7 @@ def test_bilagstype(bilagstype_data):
assert model.updated_at == bilagstype_data[0]["updatedAt"]
assert model.updated_by == bilagstype_data[0]["updatedBy"]
def test_ressurs(ressurs_data):
model = Ressurs(**ressurs_data[0])
assert model.age == ressurs_data[0]["age"]
......
......@@ -158,6 +158,7 @@ def test_bilagstyper_url_no_override_wo_trailing_slash(config_no_overrides):
url = client.urls.get_bilagstype("72", "TT")
assert url == "https://example.com/base/bilagstyper/v1/72/TT"
def test_ressurser_url_no_override_w_trailing_slash(config_no_overrides):
config_no_overrides["rest"]["base_url"] += "base/" # trailing slash
client = get_client(**config_no_overrides)
......
......@@ -546,29 +546,36 @@ class UBWClient:
return [models.Arbeidsordre.from_dict(x) for x in r]
# TODO: Extend get_arbeidsordrer to support the same partial model as the following function
def get_partial_arbeidsordrer(self, company_id: str) -> typing.List[models.PartialArbeidsordre]:
def get_partial_arbeidsordrer(
self, company_id: str
) -> typing.List[models.PartialArbeidsordre]:
url = self.urls.get_arbeidsordre(company_id)
headers = self.config.rest.endpoints.begreper.headers
r = self.get(url,
headers=headers,
params={
'select': ','.join(
['companyId',
'workOrderId',
'dateFrom',
'dateTo',
'periodFrom',
'periodTo',
'status',
'projectId',
'workOrderName',
'costCentre',
'projectManagerId',
'category1',
'lastUpdated(updatedAt,updatedBy)'])})
r = self.get(
url,
headers=headers,
params={
"select": ",".join(
[
"companyId",
"workOrderId",
"dateFrom",
"dateTo",
"periodFrom",
"periodTo",
"status",
"projectId",
"workOrderName",
"costCentre",
"projectManagerId",
"category1",
"lastUpdated(updatedAt,updatedBy)",
]
)
},
)
return [models.PartialArbeidsordre.from_dict(x) for x in r]
def get_perioder(
self,
company_id: str,
......
......@@ -608,8 +608,8 @@ class Usage(BaseModel):
def bruker_model_to_lower_camel(s: str) -> str:
"""Alias generator to avoid breaking PEP8"""
if s == 'role_and_company':
return 'rolesAndCompanies'
if s == "role_and_company":
return "rolesAndCompanies"
else:
first, *others = s.split("_")
return "".join([first.lower(), *map(str.capitalize, others)])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment