[test] update for uncloud_net
This commit is contained in:
parent
165dacb7bf
commit
d2bd6ba200
1 changed files with 16 additions and 4 deletions
|
@ -13,7 +13,11 @@ from uncloud_pay.models import BillingAddress, Order
|
||||||
class VPNTests(TestCase):
|
class VPNTests(TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.user = get_user_model().objects.create_user('django-test-user', 'noreply@ungleich.ch')
|
self.user = get_user_model().objects.create_user('django-test-user', 'noreply@ungleich.ch')
|
||||||
self.admin_user = get_user_model().objects.create_user('django-test-adminuser', 'noreply-admin@ungleich.ch')
|
self.admin_user = get_user_model().objects.create_user('django-test-adminuser',
|
||||||
|
'noreply-admin@ungleich.ch')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
self.admin_user.is_staff = True
|
self.admin_user.is_staff = True
|
||||||
self.admin_user.save()
|
self.admin_user.save()
|
||||||
|
|
||||||
|
@ -62,11 +66,20 @@ class VPNTests(TestCase):
|
||||||
})
|
})
|
||||||
force_authenticate(request, user=self.user)
|
force_authenticate(request, user=self.user)
|
||||||
|
|
||||||
# we don't have a billing address -> raises error
|
# we don't have a billing address -> should raise an error
|
||||||
with self.assertRaises(ValidationError):
|
with self.assertRaises(ValidationError):
|
||||||
response = view(request)
|
response = view(request)
|
||||||
|
|
||||||
ba = BillingAddress.objects.create(owner=self.user)
|
addr = BillingAddress.objects.get_or_create(
|
||||||
|
owner=self.user,
|
||||||
|
active=True,
|
||||||
|
defaults={'organization': 'ungleich',
|
||||||
|
'name': 'Nico Schottelius',
|
||||||
|
'street': 'Hauptstrasse 14',
|
||||||
|
'city': 'Luchsingen',
|
||||||
|
'postal_code': '8775',
|
||||||
|
'country': 'CH' }
|
||||||
|
)
|
||||||
|
|
||||||
# This should work now
|
# This should work now
|
||||||
response = view(request)
|
response = view(request)
|
||||||
|
@ -76,7 +89,6 @@ class VPNTests(TestCase):
|
||||||
order = Order.objects.get(owner=self.user)
|
order = Order.objects.get(owner=self.user)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
self.user.delete()
|
self.user.delete()
|
||||||
self.admin_user.delete()
|
self.admin_user.delete()
|
||||||
|
|
Loading…
Reference in a new issue