Skip to content

Commit

Permalink
test(be): add category name conflict error test
Browse files Browse the repository at this point in the history
  • Loading branch information
martinscooper committed Nov 8, 2023
1 parent e1f47c1 commit bca2b21
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions label_sleuth/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,16 @@ def raise_exception(a, b):
'category_name': category_name, 'category_id': str(category_id)}, res.get_json(),
msg="diff in create category response")

# test category name already exists conflict
res = self.client.post(f"/workspace/{workspace_name}/category",
data='{{"category_name":"{}","category_description":"{}"}}'.format(category_name,
category_description),
headers=HEADERS)
self.assertEqual(409, res.status_code, msg="Failed to add a new category to workspace")
self.assertEqual(f"A category with this name already exists: {category_name}", res.get_json()["title"],
msg="diff in create category response error")


res = self.client.get(f"/workspace/{workspace_name}/documents", headers=HEADERS)
self.assertEqual(200, res.status_code, msg="Failed to get all documents uris")
documents = res.get_json()['documents']
Expand Down

0 comments on commit bca2b21

Please sign in to comment.