tests: improve testing by splitting tests + use six for basestring python3 compatibility

This commit is contained in:
Gagaro
2014-12-04 11:31:34 +01:00
parent 70b4f2e9b6
commit 8e912f9738
8 changed files with 58 additions and 29 deletions

View File

@@ -1,5 +1,6 @@
import json
from pyquery import PyQuery as pq
import six
from django.test import SimpleTestCase
from django.core.exceptions import ValidationError
@@ -48,7 +49,7 @@ class JSignatureWidgetTest(SimpleTestCase):
w = JSignatureWidget()
val = [{"x": [1, 2], "y": [3, 4]}]
val_prep = w.prep_value(val)
self.assertIsInstance(val_prep, basestring)
self.assertIsInstance(val_prep, six.string_types)
self.assertEquals(val, json.loads(val_prep))
def test_prep_value_correct_values_json(self):
@@ -56,7 +57,7 @@ class JSignatureWidgetTest(SimpleTestCase):
val = [{"x": [1, 2], "y": [3, 4]}]
val_str = '[{"x":[1,2], "y":[3,4]}]'
val_prep = w.prep_value(val_str)
self.assertIsInstance(val_prep, basestring)
self.assertIsInstance(val_prep, six.string_types)
self.assertEquals(val, json.loads(val_prep))
def test_prep_value_incorrect_values(self):