Open apoorvdixit88 opened 2 weeks ago
Where this should be tested? Could you please provide some pointer to the tests of generic_user_roles_list_for_user
for reference?
I would like to work on this issue.
Hey @vil02 , Assigning this issue to you.
Added Testing flow for generic_user_roles_list_for_user
in description, similarly we can check implementation of `generic_user_roles_list_for_org_and_extra, from where it is being invoked and which core function calls corresponding db function. We can modify the limit (after adding it) in the core function, to test it.
Feel free to ask if you have any questions.
@apoorvdixit88 Thanks for the feedback. I am still not sure how to create some automated tests.
I created #6191: could you please have brief look and tell me if it goes into right direction and approve the workflows.
The changes look fine. To test the behaviour of the limit, you can manually hit the following route after signing up.
curl 'http://localhost:8080/user/user/v2/list' \
-H 'authorization: Bearer JWT' \
For testing purposes, try setting the limit to 0(or some number, when invoking from core function) and observe how it affects the response. This will help verify that the limit functionality is working as expected.
Feature Description
Description: The function generic_user_roles_list_for_org_and_extra currently fetches all roles for a give organisation and additional parameters. To improve performance and allow better control over data retrieval, we need to add a limit parameter to restrict the number of results returned.
Task:
Possible Implementation
Option<type>
to the function signature ofgeneric_user_roles_list_for_org_and_extra
None
so that it doesn't change expected behaviour)Additional Context: This change is analogous to the
generic_user_roles_list_for_user
function, which already includes a limit parameter. You can refer to that function’s implementation for guidance.How to Test
For testing, we can check where this
generic_user_roles_list_for_user
is used, currently this function is invoked from db functionlist_user_roles_by_user_id
and this function is getting called from many core function, likelist_merchants_for_user_in_org
,list_orgs_for_user
.We can hit
user/list/merchants
api to invoke thislist_merchants_for_user_in_org
core function:Signup:
Response:
We will get intermediate token for setting up 2FA, it is skippable: Skip 2FA, we will be getting a login token:
It depicts successful signup, default one merchant_id has been created. (Baisically one org, with one merchant and one profile) Now we can call
list/merchant
:Response:
We can create more merchant accounts:
And if we try got get list it now, it will show more merchant_ids in list. Limit parameter in the function that controls how much data we need for our use case, say, sometimes we only want to get first one from list, we can just pass limit one instead of fetching whole list.
Acceptance Criteria:
Have you spent some time checking if this feature request has been raised before?
Submission Process:
Refer here for Terms and conditions for the contest.