Skip to content

Commit

Permalink
The headers parameter was added in Django 4.2
Browse files Browse the repository at this point in the history
We can’t use it yet.
  • Loading branch information
samdoran committed Jan 5, 2024
1 parent 88a0ca6 commit a326643
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions koku/api/settings/test/cost_groups/test_query_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ def url(self):
def test_get_cost_groups(self):
"""Basic test to exercise the API endpoint"""
with schema_context(self.schema_name):
response = self.client.get(self.url, headers=self.headers)
response = self.client.get(self.url, **self.headers)
self.assertEqual(response.status_code, status.HTTP_200_OK)

def test_get_cost_groups_invalid(self):
with schema_context(self.schema_name):
response = self.client.get(self.url, {"nope": "nope"}, headers=self.headers)
response = self.client.get(self.url, {"nope": "nope"}, **self.headers)

self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)

Expand All @@ -68,7 +68,7 @@ def test_get_cost_groups_filters(self):
for filter_option, filter_value in parameter.items():
param = {f"filter[{filter_option}]": filter_value}
with schema_context(self.schema_name):
response = self.client.get(self.url, param, headers=self.headers)
response = self.client.get(self.url, param, **self.headers)
self.assertEqual(response.status_code, status.HTTP_200_OK)
data = response.data.get("data")
for item in data:
Expand Down Expand Up @@ -102,7 +102,7 @@ def test_get_cost_groups_filters_multiple(self):
with self.subTest(parameter=case["value"]):
params = {f"filter[{case['field']}]": case["value"]}
with schema_context(self.schema_name):
response = self.client.get(self.url, params, headers=self.headers)
response = self.client.get(self.url, params, **self.headers)

data = response.data.get("data")
result = {}
Expand All @@ -118,7 +118,7 @@ def test_get_cost_groups_order(self):
def spotcheck_first_data_element(option, value):
param = {f"order_by[{option}]": value}
with schema_context(self.schema_name):
response = self.client.get(self.url, param, headers=self.headers)
response = self.client.get(self.url, param, **self.headers)

return response.status_code, response.data.get("data")[0]

Expand All @@ -144,7 +144,7 @@ def test_get_cost_groups_exclude_functionality(self):
for exclude_option, exclude_value in parameter.items():
param = {f"exclude[{exclude_option}]": exclude_value}
with schema_context(self.schema_name):
response = self.client.get(self.url, param, headers=self.headers)
response = self.client.get(self.url, param, **self.headers)
self.assertEqual(response.status_code, status.HTTP_200_OK)
data = response.data.get("data")
for item in data:
Expand All @@ -169,7 +169,7 @@ def _add_additional_projects(schema_name):
_add_additional_projects(self.schema_name)
body = json.dumps(self.body_format)
with schema_context(self.schema_name):
response = self.client.delete(self.url, body, content_type="application/json", headers=self.headers)
response = self.client.delete(self.url, body, content_type="application/json", **self.headers)
current_count = OpenshiftCostCategoryNamespace.objects.filter(namespace=self.project).count()

self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
Expand Down Expand Up @@ -206,7 +206,7 @@ def test_put_new_records(self, mock_is_customer_large, mock_update_schedule):
mock_is_customer_large.return_value = False
with schema_context(self.schema_name):
body = json.dumps(self.body_format)
response = self.client.put(self.url, body, content_type="application/json", headers=self.headers)
response = self.client.put(self.url, body, content_type="application/json", **self.headers)
current_count = OpenshiftCostCategoryNamespace.objects.filter(namespace=self.project).count()

self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
Expand All @@ -226,7 +226,7 @@ def test_put_new_records_large(self, mock_is_customer_large, mock_update_schedul
mock_is_customer_large.return_value = True
with schema_context(self.schema_name):
body = json.dumps(self.body_format)
response = self.client.put(self.url, body, content_type="application/json", headers=self.headers)
response = self.client.put(self.url, body, content_type="application/json", **self.headers)
current_count = OpenshiftCostCategoryNamespace.objects.filter(namespace=self.project).count()

self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
Expand Down

0 comments on commit a326643

Please sign in to comment.