Irritatingly one wants bytes and one wants unicode under python3.
from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse
from django.test import TestCase
-from django.utils.encoding import smart_text
+from django.utils.encoding import smart_text, smart_bytes
from .models import SequencingRun, Sequencer, FlowCell, FileType
from samples.models import HTSUser
from .models import SequencingRun, Sequencer, FlowCell, FileType
from samples.models import HTSUser
url = '/lane/{}'.format(self.lane.id)
response = self.client.get(url)
url = '/lane/{}'.format(self.lane.id)
response = self.client.get(url)
- rdfbody = smart_text(response.content)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.status_code, 200)
- status = validate_xhtml(rdfbody)
+ status = validate_xhtml(smart_bytes(response.content))
if status is not None:
self.assertTrue(status)
if status is not None:
self.assertTrue(status)
- load_string_into_model(model, 'rdfa', rdfbody)
+ load_string_into_model(model, 'rdfa', smart_text(response.content))
errmsgs = list(inference.run_validation())
self.assertEqual(len(errmsgs), 0)
errmsgs = list(inference.run_validation())
self.assertEqual(len(errmsgs), 0)
from django.core.exceptions import ValidationError
from django.test import TestCase, RequestFactory
from django.core.exceptions import ValidationError
from django.test import TestCase, RequestFactory
-from django.utils.encoding import smart_text, smart_str
+from django.utils.encoding import smart_text, smart_str, smart_bytes
from .models import Affiliation, ExperimentType, Species, Library
from .views import library_dict
from .models import Affiliation, ExperimentType, Species, Library
from .views import library_dict
response = self.client.get(library.get_absolute_url())
self.assertEqual(response.status_code, 200)
response = self.client.get(library.get_absolute_url())
self.assertEqual(response.status_code, 200)
- content = smart_text(response.content)
- load_string_into_model(model, 'rdfa', content)
+ load_string_into_model(model, 'rdfa', smart_text(response.content))
body = """prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix libns: <http://jumpgate.caltech.edu/wiki/LibraryOntology#>
body = """prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix libns: <http://jumpgate.caltech.edu/wiki/LibraryOntology#>
self.assertEqual(fromTypedNode(r['made_by']),
library.made_by)
self.assertEqual(fromTypedNode(r['made_by']),
library.made_by)
- state = validate_xhtml(content)
+ state = validate_xhtml(smart_bytes(response.content))
if state is not None:
self.assertTrue(state)
if state is not None:
self.assertTrue(state)