Closed Bug 1435895 Opened 7 years ago Closed 7 years ago

Refactor tests to remove JSON encoding and content-type from tests that don't exercise it

Categories

(Conduit :: Lando, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mars, Unassigned)

Details

(Keywords: conduit-backlog, conduit-triaged)

Attachments

(1 file)

Many of our API tests have extra calls to json.dumps() and content_type='application/json'. For example: response = client.post( '/landings', data=json.dumps({ 'revision_id': 'D1', 'diff_id': diff_id }), headers=auth0_mock.mock_headers, content_type='application/json' ) To increase test readability we should try to include only lines in the tests that describe the behaviour we want to test. Since all calls to the API are JSON-encoded the calls to json.dumps() and content_type can be removed without hiding what the test does. Flask 0.13 (unreleased at the time of writing) has a 'json=' keyword argument to client.post() that removes the extra lines.
Attachment #8948550 - Attachment description: Add json-enabled test client → tests: add json-enabled test client
Keywords: conduit-triaged
Whiteboard: [lando-backlog-tests]
Assignee: mars → nobody
Comment on attachment 8948550 [details] tests: add json-enabled test client Steven MacLeod [:smacleod] has approved the revision. https://phabricator.services.mozilla.com/D552
Attachment #8948550 - Flags: review+
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Keywords: conduit-backlog
Whiteboard: [lando-backlog-tests]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: