Skip to content

Commit 2c2ac88

Browse files
committed
Updated the API tests to avoid deprecation warnings from a new version of Tastypie (0.13.1).
- Legacy-Id: 10796
1 parent 49defdb commit 2c2ac88

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

ietf/api/tests.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
import sys
33
import json
44

5-
from django.test import Client
5+
from django.test import Client, TestCase
66
from django.conf import settings
77
from django.utils.importlib import import_module
88
from django.db import models
99

1010
from tastypie.exceptions import BadRequest
11-
from tastypie.test import ResourceTestCase
11+
from tastypie.test import ResourceTestCaseMixin
1212

1313
import debug # pyflakes:ignore
1414

@@ -18,7 +18,7 @@
1818
'ietf.ipr',
1919
)
2020

21-
class TastypieApiTestCase(ResourceTestCase):
21+
class TastypieApiTestCase(ResourceTestCaseMixin, TestCase):
2222
def __init__(self, *args, **kwargs):
2323
self.apps = {}
2424
for app_name in settings.INSTALLED_APPS:
@@ -28,7 +28,7 @@ def __init__(self, *args, **kwargs):
2828
models_path = os.path.join(os.path.dirname(app.__file__), "models.py")
2929
if os.path.exists(models_path):
3030
self.apps[name] = app
31-
super(ResourceTestCase, self).__init__(*args, **kwargs)
31+
super(TastypieApiTestCase, self).__init__(*args, **kwargs)
3232

3333
def test_api_top_level(self):
3434
client = Client(Accept='application/json')

ietf/utils/tests_restapi.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
debug.debug = True
55

66
from django.core.urlresolvers import reverse
7+
from django.test import TestCase
78

8-
from tastypie.test import ResourceTestCase
9+
from tastypie.test import ResourceTestCaseMixin
910

1011
from ietf.utils.test_data import make_test_data
1112

12-
class RestApi(ResourceTestCase):
13+
class RestApi(ResourceTestCaseMixin, TestCase):
1314
def list_recursively(self, resource, format):
1415
"""
1516
Recurse down all the app trees, retrieving all the data available. This ensures
@@ -74,4 +75,4 @@ def test_json_doc_relationships(self):
7475
value = doc[key]
7576
if isinstance(value, basestring) and value.startswith('%s/'%apitop):
7677
self.api_client.get(value, format='json')
77-
78+

0 commit comments

Comments
 (0)