Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatting: remove unused variables #342

Merged
merged 1 commit into from
Jul 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions api/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def add_host_list(host_list):
"detail": str(e.messages),
"type": "unknown",
"host": host})
except Exception as e:
except Exception:
number_of_errors += 1
logger.exception("Error adding host", extra={"host": host})
response_host_list.append({"status": 500,
Expand Down Expand Up @@ -290,7 +290,7 @@ def find_hosts_by_hostname_or_id(account_number, hostname):
host_id = hostname
filter_list.append(Host.id == host_id)
logger.debug("Adding id (uuid) to the filter list")
except Exception as e:
except Exception:
# Do not filter using the id
logger.debug("The hostname (%s) could not be converted into a UUID",
hostname,
Expand Down
4 changes: 2 additions & 2 deletions app/auth/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def authentication_header_handler(apikey, required_scopes=None):
try:
identity = from_auth_header(apikey)
validate(identity)
except Exception as e:
except Exception:
login_failure_count.inc()
logger.debug("Failed to validate identity header value",
exc_info=True)
Expand All @@ -29,7 +29,7 @@ def bearer_token_handler(token):
try:
identity = from_bearer_token(token)
validate(identity)
except Exception as e:
except Exception:
login_failure_count.inc()
logger.debug("Failed to validate bearer token value",
exc_info=True)
Expand Down
18 changes: 5 additions & 13 deletions test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1237,31 +1237,25 @@ def test_update_fields(self):
self.assertEqual(host[key], patch_doc[key])

def test_patch_with_branch_id_parameter(self):
original_id = self.added_hosts[0].id
self.added_hosts[0].id

patch_doc = {"display_name": "branch_id_test"}

url_host_id_list = self._build_host_id_list_for_url(self.added_hosts)

test_url = f"{HOST_URL}/{url_host_id_list}?branch_id=123"

response_data = self.patch(test_url,
patch_doc,
200)
self.patch(test_url, patch_doc, 200)

def test_update_fields_on_multiple_hosts(self):
original_id = self.added_hosts[0].id

patch_doc = {"display_name": "fred_flintstone",
"ansible_host": "barney_rubble"}

url_host_id_list = self._build_host_id_list_for_url(self.added_hosts)

test_url = f"{HOST_URL}/{url_host_id_list}"

response_data = self.patch(test_url,
patch_doc,
200)
self.patch(test_url, patch_doc, 200)

response_data = self.get(test_url, 200)

Expand Down Expand Up @@ -1405,8 +1399,6 @@ def test_query_using_fqdn_one_result(self):
assert any(result["display_name"] == host.display_name for host in expected_host_list)

def test_query_using_non_existant_fqdn(self):
host_list = self.added_hosts

response = self.get(HOST_URL + "?fqdn=ROFLSAUCE.com")

self.assertEqual(len(response["results"]), 0)
Expand Down Expand Up @@ -1577,7 +1569,7 @@ def test_query_with_maching_insights_id_and_branch_id(self):

test_url = HOST_URL + "?insights_id=" + valid_insights_id + "&branch_id=123"

response = self.get(test_url, 200)
self.get(test_url, 200)


class QueryOrderTestCase(PreCreatedHostsBaseTestCase):
Expand Down Expand Up @@ -1714,7 +1706,7 @@ def test_invalid_order_how(self):
def test_only_order_how(self):
for url in self._queries_subtests_with_added_hosts():
with self.subTest(url=url):
response = self._get(url, None, "ASC", 400)
self._get(url, None, "ASC", 400)


class FactsTestCase(PreCreatedHostsBaseTestCase):
Expand Down