30 Days of Postman: Day 14 (OAuth) test assertion error?

Hi :wave:

I’ve just forked Day 14 of the 30 Days of Postman training course (I’m trying to get a few days ahead) and I think I’ve found a bug in one of the “Submit your solution” tests?

In brief, the collection asks you to use OAuth authentication to connect to GitHub, and then utilize the https://api.github.com/user/repos endpoint to retrieve (and count) a list of the public-visible GitHub repositories on your account (and save to a repoCount collection variable).

However, within the tests for “Submit your solution”, it attempts to verify that my repoCount variable has a value of 30 -

let variable = collection.variable.find(variable => { return variable.key == "repoCount"})
pm.expect(variable.key, 'check collection variable name').equals("repoCount")
pm.expect(variable.value, 'check collection variable name').equals(30)

This test is failing for me, because I only have five public-visible repositories, not 30:

I could just cheat and change the test to expect 5, but then it would fail for everyone else who reaches day 14. Alternatively I suppose I could create 25 additional empty repositories… :smiley:

(I’d suggest changing it in the main codebase so that it expects the value to be >= 0; after all, there’s no guarantee that a person would necessarily have any repositories in their account.) (Edit: Raised a Pull Request with that suggestion.)

Thanks for raising this mate :trophy:

Cc @jetison

Thanks for catching that @neilstudd ! I added a comment to your pull request. Please let me know if you plan on making that update, otherwise I’ll tackle it!

@jetison No problem, I think I’ve updated that now - my first time raising a Postman PR, so I hope that I updated it correctly! (Your comment has subsequently vanished for me, so I don’t know whether I wiped it by mistake)

1 Like

Help: How to do the following.
Confirm the script is storing this data properly and [persist the data]
I tried doing Persist ALL . But how to assert initial value and current value are equal. (https://learning.postman.com/docs/sending-requests/variables/#sharing-and-persisting-data) so that INITIAL VALUE is the same as CURRENT VALUE .