Move django TestCase classes to pytest functions

This commit is contained in:
Mauro Doglio 2017-08-04 10:44:25 +01:00
Родитель e54b4f371f
Коммит 756aac3506
2 изменённых файлов: 12 добавлений и 17 удалений

Просмотреть файл

@ -1,17 +0,0 @@
from django.core.urlresolvers import reverse
from django.test import TestCase
class HomeTests(TestCase):
def test_page_title(self):
response = self.client.get(reverse('home'))
self.assertIn('<h1>Taar Api</h1>', response.content.decode('utf-8'))
class TestContribute(TestCase):
def test_contribute_json(self):
response = self.client.get('/contribute.json')
self.assertEqual(response.status_code, 200)
self.assertEqual(response['Content-Type'], 'application/json')

Просмотреть файл

@ -0,0 +1,12 @@
from django.core.urlresolvers import reverse
def test_page_title(client):
response = client.get(reverse('home'))
assert '<h1>Taar Api</h1>' in response.content.decode('utf-8')
def test_contribute_json(client):
response = client.get('/contribute.json')
assert response.status_code == 200
assert response['Content-Type'] == 'application/json'