Skip to content

Commit 63e871f

Browse files
committed
Move API test fixtures under test_data
Also remove unused imports Signed-off-by: Philippe Ombredanne <[email protected]>
1 parent ba4a115 commit 63e871f

File tree

4 files changed

+5
-9
lines changed

4 files changed

+5
-9
lines changed

vulnerabilities/tests/test_api.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,17 @@
1010

1111

1212
import os
13-
from collections import OrderedDict
1413
from random import choices
15-
from unittest.mock import MagicMock
1614
from urllib.parse import quote
1715

1816
from django.test import TestCase
1917
from django.test.client import RequestFactory
20-
from rest_framework.test import APIClient
21-
from rest_framework.test import APIRequestFactory
2218

2319
from vulnerabilities.api import PackageSerializer
2420
from vulnerabilities.models import Package
2521

2622
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
27-
TEST_DATA = os.path.join(BASE_DIR, "test_data/")
23+
TEST_DATA = os.path.join(BASE_DIR, "test_data")
2824

2925

3026
def cleaned_response(response):
@@ -75,7 +71,7 @@ def cleaned_response(response):
7571

7672

7773
class TestDebianResponse(TestCase):
78-
fixtures = ["debian.json"]
74+
fixtures = [os.path.join(TEST_DATA, "api_fixtures/debian.json")]
7975

8076
@classmethod
8177
def setUpTestData(cls):
@@ -164,7 +160,7 @@ def test_query_by_package_url_without_namespace(self):
164160

165161

166162
class APIResponseRelations(TestCase):
167-
fixtures = ["openssl.json"]
163+
fixtures = [os.path.join(TEST_DATA, "api_fixtures/openssl.json")]
168164

169165
def test_vulnerability_package_relations(self):
170166

@@ -207,7 +203,7 @@ def test_vulnerability_package_relations(self):
207203

208204

209205
class TestSerializers(TestCase):
210-
fixtures = ["debian.json"]
206+
fixtures = [os.path.join(TEST_DATA, "api_fixtures/debian.json")]
211207

212208
def test_package_serializer(self):
213209
pk = Package.objects.filter(name="mimetex")
@@ -228,7 +224,7 @@ def test_package_serializer(self):
228224

229225

230226
class TestBulkAPIResponse(TestCase):
231-
fixtures = ["github.json"]
227+
fixtures = [os.path.join(TEST_DATA, "api_fixtures/github.json")]
232228

233229
def test_bulk_packages_api(self):
234230
request_body = {

0 commit comments

Comments
 (0)