mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-21 10:29:29 -05:00
Update api default version to newest
This commit is contained in:
parent
bb96b5f98e
commit
2e956b0f13
@ -171,7 +171,6 @@ class TestCustomFieldsAPI(DirectoriesMixin, APITestCase):
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
headers={"Accept": "application/json; version=7"},
|
|
||||||
content_type="application/json",
|
content_type="application/json",
|
||||||
)
|
)
|
||||||
self.assertEqual(resp.status_code, status.HTTP_201_CREATED)
|
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",
|
content_type="application/json",
|
||||||
)
|
)
|
||||||
self.assertEqual(resp.status_code, status.HTTP_200_OK)
|
self.assertEqual(resp.status_code, status.HTTP_200_OK)
|
||||||
@ -249,7 +247,6 @@ class TestCustomFieldsAPI(DirectoriesMixin, APITestCase):
|
|||||||
|
|
||||||
resp = self.client.patch(
|
resp = self.client.patch(
|
||||||
f"{self.ENDPOINT}{custom_field_select.id}/",
|
f"{self.ENDPOINT}{custom_field_select.id}/",
|
||||||
headers={"Accept": "application/json; version=7"},
|
|
||||||
data=json.dumps(
|
data=json.dumps(
|
||||||
{
|
{
|
||||||
"extra_data": {
|
"extra_data": {
|
||||||
@ -562,7 +559,6 @@ class TestCustomFieldsAPI(DirectoriesMixin, APITestCase):
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
headers={"Accept": "application/json; version=7"},
|
|
||||||
format="json",
|
format="json",
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -981,7 +977,6 @@ class TestCustomFieldsAPI(DirectoriesMixin, APITestCase):
|
|||||||
|
|
||||||
resp = self.client.patch(
|
resp = self.client.patch(
|
||||||
f"/api/documents/{doc.id}/",
|
f"/api/documents/{doc.id}/",
|
||||||
headers={"Accept": "application/json; version=7"},
|
|
||||||
data={
|
data={
|
||||||
"custom_fields": [
|
"custom_fields": [
|
||||||
{"field": custom_field_select.id, "value": "not an option"},
|
{"field": custom_field_select.id, "value": "not an option"},
|
||||||
|
@ -2029,31 +2029,37 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
|||||||
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
|
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
|
||||||
self.assertEqual(Tag.objects.get(id=response.data["id"]).color, "#a6cee3")
|
self.assertEqual(Tag.objects.get(id=response.data["id"]).color, "#a6cee3")
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
self.client.get(f"/api/tags/{response.data['id']}/", format="json").data[
|
self.client.get(
|
||||||
"colour"
|
f"/api/tags/{response.data['id']}/",
|
||||||
],
|
headers={"Accept": "application/json; version=1"},
|
||||||
|
format="json",
|
||||||
|
).data["colour"],
|
||||||
1,
|
1,
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_tag_color(self):
|
def test_tag_color(self):
|
||||||
response = self.client.post(
|
response = self.client.post(
|
||||||
"/api/tags/",
|
"/api/tags/",
|
||||||
{"name": "tag", "colour": 3},
|
data={"name": "tag", "colour": 3},
|
||||||
|
headers={"Accept": "application/json; version=1"},
|
||||||
format="json",
|
format="json",
|
||||||
)
|
)
|
||||||
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
|
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
|
||||||
self.assertEqual(Tag.objects.get(id=response.data["id"]).color, "#b2df8a")
|
self.assertEqual(Tag.objects.get(id=response.data["id"]).color, "#b2df8a")
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
self.client.get(f"/api/tags/{response.data['id']}/", format="json").data[
|
self.client.get(
|
||||||
"colour"
|
f"/api/tags/{response.data['id']}/",
|
||||||
],
|
headers={"Accept": "application/json; version=1"},
|
||||||
|
format="json",
|
||||||
|
).data["colour"],
|
||||||
3,
|
3,
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_tag_color_invalid(self):
|
def test_tag_color_invalid(self):
|
||||||
response = self.client.post(
|
response = self.client.post(
|
||||||
"/api/tags/",
|
"/api/tags/",
|
||||||
{"name": "tag", "colour": 34},
|
data={"name": "tag", "colour": 34},
|
||||||
|
headers={"Accept": "application/json; version=1"},
|
||||||
format="json",
|
format="json",
|
||||||
)
|
)
|
||||||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
|
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):
|
def test_tag_color_custom(self):
|
||||||
tag = Tag.objects.create(name="test", color="#abcdef")
|
tag = Tag.objects.create(name="test", color="#abcdef")
|
||||||
self.assertEqual(
|
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,
|
1,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -341,7 +341,7 @@ REST_FRAMEWORK = {
|
|||||||
"rest_framework.authentication.SessionAuthentication",
|
"rest_framework.authentication.SessionAuthentication",
|
||||||
],
|
],
|
||||||
"DEFAULT_VERSIONING_CLASS": "rest_framework.versioning.AcceptHeaderVersioning",
|
"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
|
# Make sure these are ordered and that the most recent version appears
|
||||||
# last
|
# last
|
||||||
"ALLOWED_VERSIONS": ["1", "2", "3", "4", "5", "6", "7"],
|
"ALLOWED_VERSIONS": ["1", "2", "3", "4", "5", "6", "7"],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user