manu-chroma / username-availability-checker

Live at : https://username-check.herokuapp.com/
96 stars 37 forks source link

Add Travis tests with pytest #32

Closed andrewda closed 6 years ago

andrewda commented 6 years ago

Closes https://github.com/manu-chroma/username-availability-checker/issues/31

jayvdb commented 6 years ago

Including "invalid_usernames" for each external website is redundant, especially with the data you have. It is one algorithm, and in that algorithm the API prevents interaction with the external website, so it needs only one set of unit tests. There is no chance of those tests failing because of changes made by the external website. The invalid username algorithm can be tested directly, hitting the actual functions used. Then one extra check that invalid usernames respond correctly over HTTP.

"working_usernames" is a confusing name. It could be "working" correctly as an available or not-available username. We need lists of "taken usernames" and "available usernames", to check each of the two possible outcomes. Per the issue description, random usernames are only a fallback for when a known available username is being reported as taken.

Use test data paramaterisation (https://docs.pytest.org/en/latest/parametrize.html ; https://docs.pytest.org/en/latest/example/parametrize.html ; plugins ) , to avoid having test methods for each website. The algorithm for most of them should be identical. Strings like 'https://soundcloud.com/{}' need to be moved into data somewhere so they can be accessed generically.

jayvdb commented 6 years ago

Also include a link to your travis build each time you want us to do a code review.

@manu-chroma , when you can, could you enable Travis on this repo.

manu-chroma commented 6 years ago

done

manu-chroma commented 6 years ago

@andrewda This is much better test than I was expecting. Great work!