stash
This commit is contained in:
parent
3cd3c108de
commit
3260eefc66
2 changed files with 42 additions and 0 deletions
32
core/tickets/tests/v2/test_shipping_codes.py
Normal file
32
core/tickets/tests/v2/test_shipping_codes.py
Normal file
|
@ -0,0 +1,32 @@
|
|||
from datetime import datetime, timedelta
|
||||
|
||||
from django.test import TestCase, Client
|
||||
|
||||
from authentication.models import ExtendedUser
|
||||
from mail.models import Email, EmailAttachment
|
||||
from tickets.models import IssueThread, StateChange, Comment
|
||||
from django.contrib.auth.models import Permission
|
||||
from knox.models import AuthToken
|
||||
|
||||
|
||||
class ShippingCodeApiTest(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_issues_empty(self):
|
||||
response = self.client.get('/api/2/shipping_codes/')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(response.json(), [])
|
||||
|
||||
def test_issues_create(self):
|
||||
response = self.client.post('/api/2/shipping_codes/', {'code': '1234'})
|
||||
self.assertEqual(response.status_code, 201)
|
||||
self.assertEqual(response.json()['code'], '1234')
|
||||
self.assertEqual(response.json()['used_at'], None)
|
||||
self.assertEqual(response.json()['issue_thread'], None)
|
|
@ -247,6 +247,16 @@ class IssueApiTest(TestCase):
|
|||
self.assertEqual(timeline[1]['subject'], 'test issue')
|
||||
self.assertEqual(timeline[1]['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_post_comment_altenative(self):
|
||||
issue = IssueThread.objects.create(
|
||||
name="test issue",
|
||||
|
|
Loading…
Reference in a new issue