Skip to content

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

Merged
miketaylr merged 3 commits intomasterfrom
issues/2406/1
Apr 19, 2018
Merged

Fixes #2406. Fix KeyError when building details template.#2407
miketaylr merged 3 commits intomasterfrom
issues/2406/1

Conversation

@miketaylr
Copy link
Copy Markdown
Member

My bad...

@TravisBuddy
Copy link
Copy Markdown

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
Copy Markdown
Member Author

r? @karlcow

Copy link
Copy Markdown
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
Copy Markdown
Member Author

Thanks.

Ah yes, let me do that. Tests++

@miketaylr
Copy link
Copy Markdown
Member Author

ok! tests added (also for get_details)

Copy link
Copy Markdown
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.

Comment thread tests/unit/test_form.py Outdated
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.

Comment thread tests/unit/test_form.py Outdated
"""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