opened
bacongobbler
username_0
Django Rest Framework will wrap the string with quotes because
of the JSONRenderer. Django's HttpResponse class handles the
application logs as we expect it to.

this is a port of deis/deis#5004
fix(controller): use django HttpResponse for logs
issue
created
bacongobbler
username_0
throwing on a "needs manual testing" because I've tested this fix on v1 but not on v2.
comment
created
helgi
username_1
There is no way to make DRF do what we want?
comment
created
bacongobbler
username_0
Not optimally. You'd have to create a third party PlainTextRenderer class, but then you have to figure out a way to get it to only apply to the `logs` function in the AppView.
comment
created
bacongobbler
username_0
AFAIK DRF only allows renderers to apply to the entire class or to a module function but not to a specific function in a class.
comment
created
helgi
username_1
Ah yeah I see now, http://www.django-rest-framework.org/api-guide/renderers/#example why on earth wouldn't they just include that

However applying a single render is easy `@renderer_classes((PlainTextRenderer))` decorator on the given functions
comment
created
bacongobbler
username_0
@username_1 any clue on how to compare a byte string to a regular string? Looks like more python 3 snarf again: https://travis-ci.org/deis/controller/builds/122652731#L346
comment
created
helgi
username_1
Then you are converting it wrong, a `str()` is not enough. You can also try `assertIn` or `assertContains`
comment
created
helgi
username_1
`response.content.decode(encoding='UTF-8')` would be how you convert it to a string
comment
created
helgi
username_1
`str(bytesThing, encoding='UTF-8')` might... Can't recall
comment
created
bacongobbler
username_0
comment
created
helgi
username_1
I've def used `assertContains` a few times in our tests to get past a `b'foo'` problem :) Lets use that for consistency but I'd recommend adding the `status_code` to the `contains` call so it is a "single" failure instead of 2 assertions like they are now
comment
created
bacongobbler
username_0
Jenkins really doesn't like me today. Those test failures are `ps` test failures as well as router issues, so it's unrelated to these changes.
comment
created
helgi
username_1
I've been seeing those as well on other PRs...
comment