stash
This commit is contained in:
parent
30cdb07ee3
commit
972ad7a1d8
3 changed files with 59 additions and 2 deletions
|
@ -9,6 +9,8 @@ from tickets.models import IssueThread, StateChange, Comment
|
|||
from django.contrib.auth.models import Permission
|
||||
from knox.models import AuthToken
|
||||
|
||||
from base64 import b64encode
|
||||
|
||||
|
||||
class IssueApiTest(TestCase):
|
||||
|
||||
|
@ -285,6 +287,7 @@ class IssueApiTest(TestCase):
|
|||
content_type='application/json')
|
||||
self.assertEqual(response.status_code, 400)
|
||||
|
||||
|
||||
#def test_post_comment(self):
|
||||
# issue = IssueThread.objects.create(
|
||||
# name="test issue",
|
||||
|
@ -359,3 +362,20 @@ class IssueApiTest(TestCase):
|
|||
self.assertEqual('pending_new', timeline[0]['state'])
|
||||
self.assertEqual('assignment', timeline[1]['type'])
|
||||
self.assertEqual(self.user.username, timeline[1]['assigned_to'])
|
||||
|
||||
|
||||
class IssueSearchTest(TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.user = ExtendedUser.objects.create_user('testuser', 'test', 'test')
|
||||
self.user.user_permissions.add(*Permission.objects.all())
|
||||
self.user.save()
|
||||
self.token = AuthToken.objects.create(user=self.user)
|
||||
self.client = Client(headers={'Authorization': 'Token ' + self.token[1]})
|
||||
|
||||
def test_search(self):
|
||||
search_query = b64encode(b'abc').decode('utf-8')
|
||||
response = self.client.get(f'/api/2/evt/tickets/{search_query}/')
|
||||
self.assertEqual(200, response.status_code)
|
||||
self.assertEqual([], response.json())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue