Update api default version to newest

This commit is contained in:
shamoon 2025-01-26 07:28:07 -08:00
parent bb96b5f98e
commit 2e956b0f13
3 changed files with 20 additions and 15 deletions

View File

@ -171,7 +171,6 @@ class TestCustomFieldsAPI(DirectoriesMixin, APITestCase):
},
},
),
headers={"Accept": "application/json; version=7"},
content_type="application/json",
)
self.assertEqual(resp.status_code, status.HTTP_201_CREATED)
@ -197,7 +196,6 @@ class TestCustomFieldsAPI(DirectoriesMixin, APITestCase):
},
},
),
headers={"Accept": "application/json; version=7"},
content_type="application/json",
)
self.assertEqual(resp.status_code, status.HTTP_200_OK)
@ -249,7 +247,6 @@ class TestCustomFieldsAPI(DirectoriesMixin, APITestCase):
resp = self.client.patch(
f"{self.ENDPOINT}{custom_field_select.id}/",
headers={"Accept": "application/json; version=7"},
data=json.dumps(
{
"extra_data": {
@ -562,7 +559,6 @@ class TestCustomFieldsAPI(DirectoriesMixin, APITestCase):
},
],
},
headers={"Accept": "application/json; version=7"},
format="json",
)
@ -981,7 +977,6 @@ class TestCustomFieldsAPI(DirectoriesMixin, APITestCase):
resp = self.client.patch(
f"/api/documents/{doc.id}/",
headers={"Accept": "application/json; version=7"},
data={
"custom_fields": [
{"field": custom_field_select.id, "value": "not an option"},

View File

@ -2029,31 +2029,37 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
self.assertEqual(Tag.objects.get(id=response.data["id"]).color, "#a6cee3")
self.assertEqual(
self.client.get(f"/api/tags/{response.data['id']}/", format="json").data[
"colour"
],
self.client.get(
f"/api/tags/{response.data['id']}/",
headers={"Accept": "application/json; version=1"},
format="json",
).data["colour"],
1,
)
def test_tag_color(self):
response = self.client.post(
"/api/tags/",
{"name": "tag", "colour": 3},
data={"name": "tag", "colour": 3},
headers={"Accept": "application/json; version=1"},
format="json",
)
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
self.assertEqual(Tag.objects.get(id=response.data["id"]).color, "#b2df8a")
self.assertEqual(
self.client.get(f"/api/tags/{response.data['id']}/", format="json").data[
"colour"
],
self.client.get(
f"/api/tags/{response.data['id']}/",
headers={"Accept": "application/json; version=1"},
format="json",
).data["colour"],
3,
)
def test_tag_color_invalid(self):
response = self.client.post(
"/api/tags/",
{"name": "tag", "colour": 34},
data={"name": "tag", "colour": 34},
headers={"Accept": "application/json; version=1"},
format="json",
)
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
@ -2061,7 +2067,11 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
def test_tag_color_custom(self):
tag = Tag.objects.create(name="test", color="#abcdef")
self.assertEqual(
self.client.get(f"/api/tags/{tag.id}/", format="json").data["colour"],
self.client.get(
f"/api/tags/{tag.id}/",
headers={"Accept": "application/json; version=1"},
format="json",
).data["colour"],
1,
)

View File

@ -341,7 +341,7 @@ REST_FRAMEWORK = {
"rest_framework.authentication.SessionAuthentication",
],
"DEFAULT_VERSIONING_CLASS": "rest_framework.versioning.AcceptHeaderVersioning",
"DEFAULT_VERSION": "1",
"DEFAULT_VERSION": "7",
# Make sure these are ordered and that the most recent version appears
# last
"ALLOWED_VERSIONS": ["1", "2", "3", "4", "5", "6", "7"],