Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbertDeVries2 committed Jun 27, 2023
1 parent 366f652 commit bdceb36
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
17 changes: 6 additions & 11 deletions buildpack/databroker/business_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,15 @@ def _put_client_config(url, auth_token, version, dependencies_json_str):
}

session = requests.Session()
retries = Retry(total=2,
backoff_factor=0.1,
status_forcelist=[ 500, 502, 503, 504 ])
retries = Retry(total=2, backoff_factor=0.1, status_forcelist=[500, 502, 503, 504])
adapter = HTTPAdapter(max_retries=retries)
session.mount('https://', adapter)
session.mount("https://", adapter)

resp = session.put(
url=url,
headers=headers,
json={
"dependencies": dependencies_json_str
},
timeout=30
json={"dependencies": dependencies_json_str},
timeout=30,
)
resp.raise_for_status()
return resp.text
Expand All @@ -75,11 +71,10 @@ def _read_dependencies_json_as_str():
with open(file_path) as f:
return f.read()
except FileNotFoundError:
logging.error(
"Business Events: dependencies.json not found %s", file_path
)
logging.error("Business Events: dependencies.json not found %s", file_path)
raise


def _get_config(vcap_services, existing_constants):
be_config = {}
try:
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/test_databroker_business_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ def _verify_vcap_info(self, is_apply_limits_present=True):
mock.MagicMock(return_value=self.expected_client_config),
), mock.patch(
"buildpack.databroker.business_events._read_dependencies_json_as_str",
mock.MagicMock(return_value="")) as mock_read_dependencies_json_as_str:
mock.MagicMock(return_value=""),
) as mock_read_dependencies_json_as_str:
business_events_cfg = business_events._get_config(
util.get_vcap_services_data(),
self.module_constants_with_metrics,
Expand Down

0 comments on commit bdceb36

Please sign in to comment.