Commit 6229b6dc authored by Karen Bjørndalen's avatar Karen Bjørndalen
Browse files

Format code with black and change variable names in Ressurs model to snake_case

parent 3a64aee9
Pipeline #47582 passed with stage
in 2 minutes and 17 seconds
......@@ -202,10 +202,12 @@ def pytest_collection_modifyitems(config, items):
if "integration" in item.keywords:
item.add_marker(skip_integration)
@pytest.fixture
def ressurs_data():
return load_json_file("ressurs.json")
@pytest.fixture
def ressurser_data():
return load_json_file("ressurser.json")
......@@ -360,14 +360,9 @@ def test_ubw_client_config():
endpoints.get_konteringsregel("72", 12)
== "https://example.com/konteringsregler/v1/72/12"
)
assert (
endpoints.get_ressurser("72")
== "https://example.com/ressurser/v1/72"
)
assert (
endpoints.get_ressurser("72", 12)
== "https://example.com/ressurser/v1/72/12"
)
assert endpoints.get_ressurser("72") == "https://example.com/ressurser/v1/72"
assert endpoints.get_ressurser("72", 12) == "https://example.com/ressurser/v1/72/12"
def test_map_transaction():
transaction = Transaction(
......@@ -424,6 +419,7 @@ def test_map_transaction_null_dates():
assert mapped["DueDate"] == null_date
assert mapped["ComplDelay"] == null_date
def test_get_ressurs(client, base_url, requests_mock, ressurs_data):
company_id = "72"
ressurs_id = "99999"
......@@ -435,6 +431,7 @@ def test_get_ressurs(client, base_url, requests_mock, ressurs_data):
expected = Ressurs.from_dict(ressurs_data[0])
assert expected == received
def test_get_ressurser(client, base_url, requests_mock, ressurser_data):
company_id = "72"
requests_mock.get(
......
......@@ -316,7 +316,7 @@ def test_get_ressurser(service_config):
@pytest.mark.integration
def test_get_ressurs(service_config):
person_id = "99999";
person_id = "99999"
client = get_client(**service_config)
ressurs = client.get_ressurs("72", person_id)
assert ressurs
......
......@@ -85,13 +85,14 @@ def test_konto(konto_data):
assert model.period_to == konto_data[0]["periodTo"]
assert model.status == konto_data[0]["status"]
def test_ressurs(ressurs_data):
model = Ressurs(**ressurs_data[0])
assert model.age == ressurs_data[0]["age"]
assert model.companyId == ressurs_data[0]["companyId"]
assert model.languageCode == ressurs_data[0]["languageCode"]
assert model.personId == ressurs_data[0]["personId"]
assert model.personName == ressurs_data[0]["personName"]
assert model.personnelType == ressurs_data[0]["personnelType"]
assert model.company_id == ressurs_data[0]["companyId"]
assert model.language_code == ressurs_data[0]["languageCode"]
assert model.person_id == ressurs_data[0]["personId"]
assert model.person_name == ressurs_data[0]["personName"]
assert model.personnel_type == ressurs_data[0]["personnelType"]
assert model.status == ressurs_data[0]["status"]
assert model.workflowState == ressurs_data[0]["workflowState"]
assert model.workflow_state == ressurs_data[0]["workflowState"]
......@@ -144,6 +144,7 @@ def test_konteringsregel_url_no_override_wo_trailing_slash(config_no_overrides):
url = client.urls.get_konteringsregel("72", "2")
assert url == "https://example.com/base/konteringsregler/v1/72/2"
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)
......
......@@ -112,7 +112,6 @@ class Endpoints:
str(konto),
)
def get_koststed(self, company_id: str, koststed: str):
return self._prepend_base_url(
self.rest.endpoints.koststeder.url or "koststeder/v1",
......
......@@ -855,18 +855,19 @@ class Konteringsregel(BaseModel):
alias_generator = to_lower_camel
allow_population_by_field_name = True
class Ressurs(BaseModel):
age: int
birthDate: datetime.datetime
companyId: str
dateFrom: datetime.datetime
dateTo: datetime.datetime
languageCode: str
personId: str
personName: str
personnelType: str
birth_date: datetime.datetime
company_id: str
date_from: datetime.datetime
date_to: datetime.datetime
language_code: str
person_id: str
person_name: str
personnel_type: str
status: str
workflowState: str
workflow_state: str
class Config:
alias_generator = to_lower_camel
......
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