-
Notifications
You must be signed in to change notification settings - Fork 45
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
Build badgeKit API client #26
Comments
Thanks for this too @aid29! |
No problem! Like to work on this. |
But may not finished before Mozilla Global Sprint, what is your plan on Sprint? |
During the sprint, I'd like to finish everything in Short Term on the Roadmap: #17 Just to clarify, this issue is separating the badgekit code out of app.js into a separate module? We are technically already using badgekit-api-client (http://github.com/mozilla/badgekit-api-client) to interface with the badgekit-api |
Yes, that's right. We can call it "BadgerService" or something which use badgekit-api-client. |
@acabunoc I found this request parameter :badges is not used in this endpoint. https://github.com/mozillascience/PaperBadger/blob/master/src/app.js#L279 |
Hi @audy "nock" is great! Where you find the url "/systems/badgekit/badges?archived=any" which you have faked for calling by BadgeClientApi? |
I don't recall. I think I looked at the tests for badgekit-api. |
@audy when I tried to stub this endpoint "/systems/badgekit/badges?archived=any" with some fake JSON or real badge JSON, the badge Client always return '{}' If you don't 'nock' this endpoint, definitely the Client return a error. Do you have successfully cheat badge Client to return some JSON data? |
1 similar comment
@audy when I tried to stub this endpoint "/systems/badgekit/badges?archived=any" with some fake JSON or real badge JSON, the badge Client always return '{}' If you don't 'nock' this endpoint, definitely the Client return a error. Do you have successfully cheat badge Client to return some JSON data? |
I think I need read more BadgeClientAPi source code to understand what happen there, maybe try a integration test with real Badge server in this issue first. |
Hey @aid29, this might help you: Also: https://github.com/mozilla/badgekit-api/tree/master/docs Thanks for looking into this! |
Also, this is the badgekit-api instance we have running / we are using on http://paperbadger.herokuapp.com/: http://badgekit-api-sciencelab.herokuapp.com/ We successfully fetch / store badges from there. Can you make sure you have the correct environment variables? |
@acabunoc When I connect the project to http://badgekit-api-sciencelab.herokuapp.com/, everything is worked. But I think audy's solution is cool, so I tried to make the badgekit-api-client talking to a "nock" http server in the test. but it's failed. badgekit-api-client always return a empty json. I will start writing the tests against the http://badgekit-api-sciencelab.herokuapp.com/ Better to change the tests running against a local badgekit server late. |
…geClient and Servicce, comment out the api.js test (config conflict with env.dist)
…clean up the app.js (the creation is not working? )
Hi @acabunoc I have pushed my branch for #26, please have a look.
All the feedback or question are welcome, thanks. |
Hey @aid29! Can you make a pull request? https://guides.github.com/activities/hello-world/#pr Thanks! |
I agree. This is a better approach. |
The build are failed on CI https://travis-ci.org/mozillascience/PaperBadger/builds/67547510 |
You can encrypt the key and store it in |
Hey both! I added the relevant environment variables to Travis -- not sure if this is the best approach BADGES_ENDPOINT |
…s from system only
…geClient and Servicce, comment out the api.js test (config conflict with env.dist)
…clean up the app.js (the creation is not working? )
…s from system only
resolved with #67! |
* master: use src/environments.js #26 Fix a error come from git rebase process #26 push Travis to build ... #26 load all the test's necessaire environment variables from system only #26 tidy up the code and package.json #26 lint and clean up the codes #26 refactoring the create Badge code to BadgeService, clean up the app.js (the creation is not working? ) #26 use Habitat to load the enviroment variables in BadgeClient and Servicce, comment out the api.js test (config conflict with env.dist) #26 refactroing all the badges read endpoints + IT #26 3 endpoints works with IT #26 wip 2 endpoints worked with IT #26 wip
Extract the codes using the badgeKit API to a separated client class, make easy to test this client against real api server or a fake one.
The text was updated successfully, but these errors were encountered: