Skip to content
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

Fixes #2406. Fix KeyError when building details template. #2407

Merged
merged 3 commits into from
Apr 19, 2018

Conversation

miketaylr
Copy link
Member

My bad...

@TravisBuddy
Copy link

TravisBuddy commented Apr 18, 2018

Hey @miketaylr,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because something unrelated to the tests, like a problem a dependency or the build process itself.

@miketaylr
Copy link
Member Author

r? @karlcow

Copy link
Member

@karlcow karlcow left a comment

Choose a reason for hiding this comment

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

Hmm I missed that too. My bad. I had one job.

It's not testable by hand.
And there's nothing in unittest testing that.
@miketaylr Could we add a test in https://github.com/webcompat/webcompat.com/blob/cee41305fc5cda09652bd3da4e6f793320d51274/tests/unit/test_form.py for build_details.

Thanks.

@miketaylr
Copy link
Member Author

Thanks.

Ah yes, let me do that. Tests++

@miketaylr
Copy link
Member Author

ok! tests added (also for get_details)

Copy link
Member

@karlcow karlcow left a comment

Choose a reason for hiding this comment

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

Thanks for the tests @miketaylr
Really cool.

You can auto-merge after changing the variable names. Tests are passing.

self.assertEqual(actual, expected)
actual_json = form.get_details(json.dumps({'a': 'b', 'c': False}))
expected_json = '<li>a: b</li><li>c: false</li>'
self.assertEqual(actual_json, expected_json)

This comment was marked as abuse.

This comment was marked as abuse.

"""Assert we return the expected HTML, for a json object or a string."""
actual_json = form.build_details(json.dumps({'a': 'b', 'c': False}))
expected_json = '<details>\n<summary>Browser Configuration</summary>\n<ul>\n <li>a: b</li><li>c: false</li>\n</ul>\n</details>' # nopep8
self.assertEqual(actual_json, expected_json)

This comment was marked as abuse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants