Skip to content

Commit 2ac20a2

Browse files
committed
visualize: convert to pytest
1 parent ef6ebd4 commit 2ac20a2

File tree

2 files changed

+24
-11
lines changed

2 files changed

+24
-11
lines changed

conftest.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import pytest
2+
3+
from django.core.management import call_command
4+
5+
6+
7+
@pytest.fixture
8+
def arches(db):
9+
call_command('loaddata', 'main/fixtures/arches.json')
10+
11+
12+
@pytest.fixture
13+
def repos(db):
14+
call_command('loaddata', 'main/fixtures/repos.json')
15+
16+
17+
@pytest.fixture
18+
def package(db):
19+
# TODO(jelle): create own parameter based version
20+
call_command('loaddata', 'main/fixtures/package.json')

visualize/tests.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
from django.test import TestCase
2-
3-
4-
class VisualeTest(TestCase):
5-
fixtures = ['main/fixtures/arches.json', 'main/fixtures/repos.json',
6-
'main/fixtures/package.json']
7-
8-
def test_urls(self):
9-
for url in ['', 'by_repo/', 'by_arch/']:
10-
response = self.client.get('/visualize/{}'.format(url))
11-
self.assertEqual(response.status_code, 200)
1+
def test_urls(client, arches, repos, package):
2+
for url in ['', 'by_repo/', 'by_arch/']:
3+
response = client.get('/visualize/{}'.format(url))
4+
assert response.status_code == 200

0 commit comments

Comments
 (0)