mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-09 00:05:21 +01:00
api validation, more tests
This commit is contained in:
parent
544e8db722
commit
e9b5f8d9f8
2 changed files with 60 additions and 1 deletions
|
|
@ -669,6 +669,7 @@ class TestDocumentApi(DirectoriesMixin, APITestCase):
|
|||
self.assertEqual(v1.filter_rules.count(), 0)
|
||||
|
||||
|
||||
|
||||
class TestBulkEdit(DirectoriesMixin, APITestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
|
@ -891,7 +892,7 @@ class TestBulkEdit(DirectoriesMixin, APITestCase):
|
|||
doc2 = Document.objects.get(id=self.doc2.id)
|
||||
self.assertEqual(doc2.document_type, self.dt1)
|
||||
|
||||
def test_api_invalid_tag(self):
|
||||
def test_api_add_invalid_tag(self):
|
||||
self.assertEqual(list(self.doc2.tags.all()), [self.t1])
|
||||
response = self.client.post("/api/documents/bulk_edit/", json.dumps({
|
||||
"documents": [self.doc2.id],
|
||||
|
|
@ -901,3 +902,14 @@ class TestBulkEdit(DirectoriesMixin, APITestCase):
|
|||
self.assertEqual(response.status_code, 400)
|
||||
|
||||
self.assertEqual(list(self.doc2.tags.all()), [self.t1])
|
||||
|
||||
def test_api_delete_invalid_tag(self):
|
||||
self.assertEqual(list(self.doc2.tags.all()), [self.t1])
|
||||
response = self.client.post("/api/documents/bulk_edit/", json.dumps({
|
||||
"documents": [self.doc2.id],
|
||||
"method": "remove_tag",
|
||||
"parameters": {'tag': 345657}
|
||||
}), content_type='application/json')
|
||||
self.assertEqual(response.status_code, 400)
|
||||
|
||||
self.assertEqual(list(self.doc2.tags.all()), [self.t1])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue