add dropdown selection to change state of tickets
This commit is contained in:
parent
515648ffa8
commit
626c9f23fe
7 changed files with 166 additions and 13 deletions
|
@ -97,7 +97,7 @@ class IssueApiTest(TestCase):
|
|||
response = self.client.post('/api/2/tickets/manual/', {'name': 'test issue', 'sender': 'test',
|
||||
'recipient': 'test', 'body': 'test'})
|
||||
self.assertEqual(response.status_code, 201)
|
||||
self.assertEqual(response.json()['state'], 'new')
|
||||
self.assertEqual(response.json()['state'], 'pending_new')
|
||||
self.assertEqual(response.json()['name'], 'test issue')
|
||||
self.assertEqual(response.json()['assigned_to'], None)
|
||||
timeline = response.json()['timeline']
|
||||
|
@ -108,3 +108,35 @@ class IssueApiTest(TestCase):
|
|||
self.assertEqual(timeline[0]['subject'], 'test issue')
|
||||
self.assertEqual(timeline[0]['body'], 'test')
|
||||
|
||||
def test_post_comment(self):
|
||||
issue = IssueThread.objects.create(
|
||||
name="test issue",
|
||||
)
|
||||
response = self.client.post('/api/2/comments/', {'comment': 'test', 'issue_thread': issue.id})
|
||||
self.assertEqual(response.status_code, 201)
|
||||
self.assertEqual(response.json()['comment'], 'test')
|
||||
self.assertEqual(response.json()['issue_thread'], issue.id)
|
||||
self.assertEqual(response.json()['timestamp'], response.json()['timestamp'])
|
||||
|
||||
def test_state_change(self):
|
||||
issue = IssueThread.objects.create(
|
||||
name="test issue",
|
||||
)
|
||||
response = self.client.patch(f'/api/2/tickets/{issue.id}/', {'state': 'pending_open'}, content_type='application/json')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(response.json()['state'], 'pending_open')
|
||||
self.assertEqual(response.json()['name'], 'test issue')
|
||||
self.assertEqual(response.json()['assigned_to'], None)
|
||||
timeline = response.json()['timeline']
|
||||
self.assertEqual(len(timeline), 1)
|
||||
self.assertEqual(timeline[0]['type'], 'state')
|
||||
self.assertEqual(timeline[0]['state'], 'pending_open')
|
||||
|
||||
|
||||
def test_state_change_invalid_state(self):
|
||||
issue = IssueThread.objects.create(
|
||||
name="test issue",
|
||||
)
|
||||
response = self.client.patch(f'/api/2/tickets/{issue.id}/', {'state': 'invalid'}, content_type='application/json')
|
||||
self.assertEqual(response.status_code, 400)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue