stash
This commit is contained in:
parent
5af3e72218
commit
804c47a3b8
9 changed files with 66 additions and 182 deletions
|
@ -4,12 +4,12 @@ from django.test import TestCase, Client
|
|||
|
||||
from authentication.models import ExtendedUser
|
||||
from mail.models import Email, EmailAttachment
|
||||
from tickets.models import IssueThread, StateChange, Comment, ShippingCode
|
||||
from tickets.models import IssueThread, StateChange, Comment, ShippingVoucher
|
||||
from django.contrib.auth.models import Permission
|
||||
from knox.models import AuthToken
|
||||
|
||||
|
||||
class ShippingCodeApiTest(TestCase):
|
||||
class ShippingVoucherApiTest(TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
@ -20,13 +20,13 @@ class ShippingCodeApiTest(TestCase):
|
|||
self.client = Client(headers={'Authorization': 'Token ' + self.token[1]})
|
||||
|
||||
def test_issues_empty(self):
|
||||
response = self.client.get('/api/2/shipping_codes/')
|
||||
response = self.client.get('/api/2/shipping_vouchers/')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(response.json(), [])
|
||||
|
||||
def test_issues_list(self):
|
||||
ShippingCode.objects.create(code='1234', type='2kg-eu')
|
||||
response = self.client.get('/api/2/shipping_codes/')
|
||||
ShippingVoucher.objects.create(code='1234', type='2kg-eu')
|
||||
response = self.client.get('/api/2/shipping_vouchers/')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(response.json()[0]['code'], '1234')
|
||||
self.assertEqual(response.json()[0]['used_at'], None)
|
||||
|
@ -34,7 +34,7 @@ class ShippingCodeApiTest(TestCase):
|
|||
self.assertEqual(response.json()[0]['type'], '2kg-eu')
|
||||
|
||||
def test_issues_create(self):
|
||||
response = self.client.post('/api/2/shipping_codes/', {'code': '1234', 'type': '2kg-eu'})
|
||||
response = self.client.post('/api/2/shipping_vouchers/', {'code': '1234', 'type': '2kg-eu'})
|
||||
self.assertEqual(response.status_code, 201)
|
||||
self.assertEqual(response.json()['code'], '1234')
|
||||
self.assertEqual(response.json()['used_at'], None)
|
Loading…
Add table
Add a link
Reference in a new issue