-
Notifications
You must be signed in to change notification settings - Fork 58
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
Test : Create unit tests for User Info #94
Conversation
@codesankalp I don't know why my build test is failing it is successfully running on my local |
Don't worry about the test build. It will fail for all pull requests for now. |
@codesankalp can you tell me what should have been done to avoid the previous mistake? I rebased everything which added new commits of other contributers . Then ran the linters which modified the files so i created a new commit thought of merging it with my previous commit It got merged with all of them. |
@codesankalp nvm i got it i should have reordered commits and then squashed them |
@decon-harsh Actually you added commits after your commit. This is the previous mistake. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@codesankalp Umm but what should I compare??
|
Use the data of |
We can't, cause the data of test_user and Zulip user isn't the same. |
Add assertion for the response you get is not empty list in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested some changes @decon-harsh
@codesankalp these tests should only run when pushed to master, not on pull request. As discussed with @isabelcosta tests related to zulip api will not be done on pull request because it will require API Key. However, we can ensure that these tests passed locally or on the fork of the contributor. |
we should still be able to test zulip functionalities without using a real key 🤔 not sure how though |
@isabelcosta We can't fetch the details without passing the key. However, may be we can run these cases only on push if needed. Else you have to create an environment to pass the tokens. |
Question: Can we run specific test files on PR? On the terminal, I do As @devkapilbansal suggested we should run these tests only on push to master, a forked user must have zulip_key to run tests. |
I have done the necessary changes , was waiting for the approach on zulip_tests thought will do it together . Please Let me know what should i need to do next! |
@decon-harsh you need to mock the function calls of zulip APIs in test cases. Doing so will remove dependency of tests on |
@decon-harsh Take reference from this: #102 (comment) |
@decon-harsh can you please update this branch with |
6e82848
to
86d4a53
Compare
@isabelcosta I updated my branch with develop , which created this merge commit (the second one), How should I avoid it ? by doing git pull --rebase ? |
@decon-harsh As you have made the merge commit
This will remove your merge commit and will squash your commits also. |
I will definitely try this @codesankalp thank you |
I see now the problem 🤦🏾♀️ it's because of a recent PR. Will have a think about it! |
@decon-harsh You can use my implementation of mocking the API: #109 |
I am afraid i can't use this directly as I have to mock zulip client . For this I think I have to use patch. For some reasons I had to reinstall Postgres and now I am having some errors! I can't run server. |
What did you try @decon-harsh? Using my implementation will work, I have tried it. |
@decon-harsh @codesankalp I would suggest using responses module to patch the responses. |
@codesankalp @devkapilbansal help me in understanding me this. I have to mock the responses of a client . There is no endpoint to mock right? So I can't use responses.add(endpoint,...). There is a function get_self_zulip_id(). So i have to mock it's response. I mean the client.get_profile(). What should i do in this case? |
Yes, that is the thing I have also used @devkapilbansal. |
But you have the endpoint for zulip, right? |
@decon-harsh Any update on this? |
Sorry to keep you waiting I will do this tommorow. |
@decon-harsh Please update this. Most of the work is done you have to just mock the API. |
Closing this PR due to inactivity and not responding for giving updates. |
Description
Created Test database test_osp
Added few unit tests for User Info Get & Post, Login & Register routes.
Fixes #78
Type of Change:
Code/Quality Assurance Only
How Has This Been Tested?
Automated tests
Formatted with ./osp-qa-checks
Checklist:
Code/Quality Assurance Only