Skip to content

converted test asserts of generics-test to pytest #4715

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 30, 2016

Conversation

auvipy
Copy link
Member

@auvipy auvipy commented Nov 29, 2016

@xordoquy I am not sure if my assertion is done in wrong way or whats the reason of test fails?
suggestion?

Copy link
Member

@kevin-brown kevin-brown left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a failing test that was caused by an error during the conversion.

@@ -530,8 +530,8 @@ def test_dynamic_serializer_form_in_browsable_api(self):
view = DynamicSerializerView.as_view()
request = factory.get('/')
response = view(request).render()
self.assertContains(response, 'field_b')
self.assertNotContains(response, 'field_a')
assert response is 'field_b'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be field_b in response. Right now it's doing an is check, which is definitely not what we were doing before.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that assertContains doesn't actually have a Python equivalent. It's a custom Django assertion that works based on the response content.

@auvipy
Copy link
Member Author

auvipy commented Nov 30, 2016

that didn't work either and initially i did what you suggested. SO keeping them as is for now.

@xordoquy
Copy link
Collaborator

Should be something like:

content = response.content.decode('utf8')
assert 'field_b' in content
assert 'field_a' not in content

@xordoquy
Copy link
Collaborator

ace !

@auvipy
Copy link
Member Author

auvipy commented Nov 30, 2016

I guess ready to go 🗡️

@xordoquy
Copy link
Collaborator

yes we are. I was just ensuring we couldn't use response.data instead but we're good.
Thanks a lot of all the work !

@xordoquy xordoquy merged commit 4c41f2b into encode:master Nov 30, 2016
@auvipy auvipy deleted the pytest4 branch November 30, 2016 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants