Make TestAcceptSubscription work..

..by using Django default test client instead of the one from
`rest_framework`.
This commit is contained in:
3wc 2021-04-14 21:34:31 +02:00
parent fbb58b1737
commit 7ee6ac7691

View File

@ -1,17 +1,15 @@
import json import json
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from django.test import TestCase
from django.urls import reverse from django.urls import reverse
from rest_framework.test import APIClient, APIRequestFactory, APITestCase from django.test import Client, TestCase
class TestAcceptSubscription(TestCase): class TestAcceptSubscription(TestCase):
def setUp(self): def setUp(self):
self.factory = APIRequestFactory() self.client = Client()
self.client = APIClient() self.user = get_user_model().objects.create(username='john', email='jlennon@beatles.com', password='glass onion')
self.user = get_user_model().objects.create_user(username='john', email='jlennon@beatles.com', password='glass onion') self.client.force_login(self.user)
self.client.force_authenticate(self.user)
def tearDown(self): def tearDown(self):
self.user.delete() self.user.delete()