feat: enforce api permissions
This commit is contained in:
@@ -2,10 +2,10 @@ from apps.audit.models import OperationAuditLog
|
||||
from apps.tickets.models import Ticket
|
||||
|
||||
|
||||
def test_add_comment_to_ticket(client, db):
|
||||
def test_add_comment_to_ticket(admin_client, db):
|
||||
ticket = Ticket.objects.create(ticket_no="TK202606300010", title="A", description="A")
|
||||
|
||||
response = client.post(
|
||||
response = admin_client.post(
|
||||
f"/api/tickets/{ticket.id}/comments",
|
||||
data={
|
||||
"content": "Checked logs",
|
||||
@@ -20,10 +20,10 @@ def test_add_comment_to_ticket(client, db):
|
||||
assert ticket.comments.count() == 1
|
||||
|
||||
|
||||
def test_add_attachment_to_ticket(client, db):
|
||||
def test_add_attachment_to_ticket(admin_client, db):
|
||||
ticket = Ticket.objects.create(ticket_no="TK202606300011", title="A", description="A")
|
||||
|
||||
response = client.post(
|
||||
response = admin_client.post(
|
||||
f"/api/tickets/{ticket.id}/attachments",
|
||||
data={
|
||||
"file_name": "error.log",
|
||||
@@ -38,10 +38,10 @@ def test_add_attachment_to_ticket(client, db):
|
||||
assert response.json()["file_name"] == "error.log"
|
||||
|
||||
|
||||
def test_export_tickets_returns_csv_and_audit_log(client, db):
|
||||
def test_export_tickets_returns_csv_and_audit_log(admin_client, db):
|
||||
Ticket.objects.create(ticket_no="TK202606300012", title="Export me", description="A")
|
||||
|
||||
response = client.get("/api/tickets/export")
|
||||
response = admin_client.get("/api/tickets/export")
|
||||
|
||||
assert response.status_code == 200
|
||||
assert response["content-type"].startswith("text/csv")
|
||||
|
||||
Reference in New Issue
Block a user