On Wed, Sep 9, 2009 at 5:06 AM, Oleg Oltar <[email protected]> wrote:

> Hi!
>
> One of my tests returned following text ()
>
> The test:
> from django.test.client import Client
>  c = Client()
> resp = c.get("/")
> resp.content
>
> In [25]: resp.content
> Out[25]: '\r\n\r\n\r\n<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
> Strict//EN"

[snip]
>
> Is there a way I can convert it to normal readable text? (I need for
> example to find a string of text in this response to check if my test case
> Pass or failed)
>
>
Is there some reason you can not simply use assertContains (
http://docs.djangoproject.com/en/dev/topics/testing/#django.test.TestCase.assertContains)?
There was a bug in this method handling unicode in responses, but that has
been fixed in both 1.0.3 and 1.1:

http://code.djangoproject.com/ticket/10183

Karen

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to