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: unify newlines by Black’s standards #360

Merged
merged 1 commit into from
Jul 24, 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
3 changes: 0 additions & 3 deletions app/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


class InventoryException(Exception):
def __init__(self, status=400, title=None, detail=None, type="about:blank"):
self.status = status
Expand All @@ -13,6 +11,5 @@ def to_json(self):


class InputFormatException(InventoryException):

def __init__(self, detail):
InventoryException.__init__(self, title="Bad Request", detail=detail)
1 change: 1 addition & 0 deletions app/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class ContextualFilter(logging.Filter):
to explicitly retrieve/pass around the request id for each
log message.
"""

def filter(self, log_record):
try:
log_record.request_id = threadctx.request_id
Expand Down
1 change: 0 additions & 1 deletion tasks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@


class NullProducer:

def send(self, topic, value=None):
logger.debug("NullProducer - logging message: topic (%s) - message: %s" %
(topic, value))
Expand Down
15 changes: 0 additions & 15 deletions test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ def _response_check(self, response, status, return_response_as_json):


class DBAPITestCase(BaseAPITestCase):

@classmethod
def setUpClass(cls):
"""
Expand Down Expand Up @@ -717,7 +716,6 @@ def test_create_host_with_invalid_ansible_host(self):


class ResolveDisplayNameOnCreationTestCase(DBAPITestCase):

def test_create_host_without_display_name_and_without_fqdn(self):
"""
This test should verify that the display_name is set to the id
Expand Down Expand Up @@ -776,7 +774,6 @@ def test_create_host_without_display_name_and_with_fqdn(self):


class BulkCreateHostsTestCase(DBAPITestCase):

def _get_valid_auth_header(self):
return build_valid_auth_header()

Expand Down Expand Up @@ -862,7 +859,6 @@ def _test_get_page(page, expected_count=1):


class CreateHostsWithSystemProfileTestCase(DBAPITestCase, PaginationTestCase):

def _valid_system_profile(self):
return {"number_of_cpus": 1,
"number_of_sockets": 2,
Expand Down Expand Up @@ -1212,7 +1208,6 @@ def create_hosts(self):


class PatchHostTestCase(PreCreatedHostsBaseTestCase):

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

Expand Down Expand Up @@ -1307,7 +1302,6 @@ def test_invalid_host_id(self):


class DeleteHostsTestCase(PreCreatedHostsBaseTestCase):

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

Expand All @@ -1317,7 +1311,6 @@ def test_create_then_delete(self):
self.get(url, 200)

class MockEmitEvent:

def __init__(self):
self.events = []

Expand Down Expand Up @@ -1420,7 +1413,6 @@ def test_query_using_display_name_substring(self):


class QueryByHostIdTestCase(PreCreatedHostsBaseTestCase, PaginationTestCase):

def _base_query_test(self, host_id_list, expected_host_list):
url = f"{HOST_URL}/{host_id_list}"
response = self.get(url)
Expand Down Expand Up @@ -1505,7 +1497,6 @@ def test_query_invalid_paging_parameters(self):


class QueryByHostnameOrIdTestCase(PreCreatedHostsBaseTestCase):

def _base_query_test(self, query_value, expected_number_of_hosts):
test_url = HOST_URL + "?hostname_or_id=" + query_value

Expand Down Expand Up @@ -1538,7 +1529,6 @@ def test_query_using_non_existent_id(self):


class QueryByInsightsIdTestCase(PreCreatedHostsBaseTestCase):

def _test_url(self, query_value):
return HOST_URL + "?insights_id=" + query_value

Expand Down Expand Up @@ -1573,7 +1563,6 @@ def test_query_with_maching_insights_id_and_branch_id(self):


class QueryOrderTestCase(PreCreatedHostsBaseTestCase):

def _queries_subtests_with_added_hosts(self):
host_id_list = [host.id for host in self.added_hosts]
url_host_id_list = ",".join(host_id_list)
Expand All @@ -1598,7 +1587,6 @@ def _get(self, base_url, order_by=None, order_how=None, status=200):


class QueryOrderWithAdditionalHostTestCase(QueryOrderTestCase):

def setUp(self):
super().setUp()
host_wrapper = HostWrapper()
Expand All @@ -1621,7 +1609,6 @@ def _added_hosts_by_display_name_asc(self):
# Hosts with same display_name are ordered by updated descending
self.added_hosts[3],
self.added_hosts[0],

self.added_hosts[1],
self.added_hosts[2]
)
Expand All @@ -1630,7 +1617,6 @@ def _added_hosts_by_display_name_desc(self):
return (
self.added_hosts[2],
self.added_hosts[1],

# Hosts with same display_name are ordered by updated descending
self.added_hosts[3],
self.added_hosts[0]
Expand Down Expand Up @@ -1692,7 +1678,6 @@ def tests_hosts_are_ordered_by_display_name_descending(self):


class QueryOrderBadRequestsTestCase(QueryOrderTestCase):

def test_invalid_order_by(self):
for url in self._queries_subtests_with_added_hosts():
with self.subTest(url=url):
Expand Down
5 changes: 1 addition & 4 deletions test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class ApiOperationTestCase(TestCase):
Test the API operation decorator that increments the request counter with every
call.
"""

@patch("api.api_request_count.inc")
def test_counter_is_incremented(self, inc):
@api_operation
Expand Down Expand Up @@ -183,7 +184,6 @@ def test_account_number_is_not_set_for_trusted_system(self):


class ConfigTestCase(TestCase):

def test_configuration_with_env_vars(self):
app_name = "brontocrane"
path_prefix = "r/slaterock/platform"
Expand Down Expand Up @@ -237,7 +237,6 @@ def test_config_development_settings(self):


class HostOrderHowTestCase(TestCase):

def test_asc(self):
column = Mock()
result = _order_how(column, "ASC")
Expand All @@ -259,7 +258,6 @@ def test_error(self):
@patch("api.host._order_how")
@patch("api.host.Host.modified_on")
class HostParamsToOrderByTestCase(TestCase):

def test_default_is_updated_desc(self, modified_on, order_how):
actual = _params_to_order_by(None, None)
expected = (modified_on.desc.return_value,)
Expand Down Expand Up @@ -307,7 +305,6 @@ def test_order_by_display_name_desc(self, display_name, modified_on, order_how):


class HostParamsToOrderByErrorsTestCase(TestCase):

def test_order_by_bad_field_raises_error(self):
with self.assertRaises(ValueError):
_params_to_order_by(Mock(), "fqdn")
Expand Down