Skip to content

add sample validation page for wetlab #3213

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 4, 2022

Conversation

sarayupai
Copy link
Contributor

No description provided.

@coveralls
Copy link

coveralls commented Sep 20, 2022

Coverage Status

coverage: 92.853% (-0.06%) from 92.913%
when pulling cdba252 on sarayupai:sample-validation
into 17f25ed on qiita-spots:dev.

@antgonza
Copy link
Member

Thank you @Sarayu. I asked @charles-cowart for a review but could you add tests to your new code?

@charles-cowart
Copy link
Contributor

@Sarayu @antgonza Waiting on unittests. Happy to review without them if you want the feedback.

Copy link
Contributor

@charles-cowart charles-cowart left a comment

Choose a reason for hiding this comment

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

Good job! Sorry it's a little wordy.

@@ -45,5 +45,19 @@ def test_get_missing_argument(self):
response.body.decode('ascii'))


class TestSampleValidation(BaseAdminTests):
def test_get(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

As mentioned during the meeting, a good unittest should canvas the common things that might break your method/function. For example, calling post without one or both of the post_args, or giving a value for qid or snames that is obviously bad. This confirms that error-handling exists and is working properly.

Copy link
Contributor Author

@sarayupai sarayupai Oct 18, 2022

Choose a reason for hiding this comment

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

Modified unit test to also check error handling of post with invalid qid

'snames': 'SKB1.640202 SKB2.640194 BLANK.1A BLANK.1B'
}
response = self.post('/admin/sample_validation/', post_args)
self.assertEqual(response.code, 200)
Copy link
Contributor

Choose a reason for hiding this comment

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

Some coders will return 200 as long as the command executed without failure on the server-side. It's good to check the response.text and confirm it does not contain error messages and contains at least some string of text you're expecting.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Modified unit test to check that the response body contains the inputted sample names

Copy link
Contributor

@charles-cowart charles-cowart left a comment

Choose a reason for hiding this comment

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

Good job! Please just add the one comment and we're good to go!

body = response.body.decode('ascii')
for name in snames:
self.assertIn(name, body)

Copy link
Contributor

Choose a reason for hiding this comment

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

@sarayupai Good job! But note that the test is called 'test_post' and you're testing positive and negative outcomes in this test. It's not obvious to the reader why this test should return 500. You have to compare each input to realize the only difference is 2 and perhaps that's an invalid id. It would be good to add a comment here summarizing what you're doing and what you expect to see happen.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added comments indicating the positive and negative tests

@antgonza
Copy link
Member

antgonza commented Nov 2, 2022

@charles-cowart, is this ready to be merged?

@antgonza antgonza merged commit c169c6b into qiita-spots:dev Nov 4, 2022
@antgonza
Copy link
Member

antgonza commented Nov 4, 2022

Thank you @sarayupai and @charles-cowart !

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.

4 participants