Skip to content
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

Backend [Unit Test] db/config.go UserHasManageBountyRoles, UserHasAccess, CheckUser, & RolesCheck #1562

Closed
2 tasks
elraphty opened this issue Feb 27, 2024 · 13 comments · Fixed by #1605
Closed
2 tasks
Assignees
Labels
backend go Pull requests that update Go code Posted testing
Milestone

Comments

@elraphty
Copy link
Contributor

Context

We are trying to increase the test coverage for our Golang backend.

File to to test

db/config.go

Design

Write tests for the database config functions, the test should:

  • RolesCheck: Should test that it returns true when a user has a role (Mock user roles)
  • RolesCHeck: Should test that it returns false when a use does not have a role (Mock user roles)
  • CheckUser: This should test that a user cannot add himself to a role, if in the user roles, one of the owner_pubkey belongs to the user return false else return true
  • UserHasAccess: Should test that if the user is the admin of an organization returns true
  • UserHasAccess: Should test that if the user is not the organization admin, and the user has the required role it should return true, else it should return false
  • UserHasManageBountyRoles: Should test that if the user is the organization admin return true
  • UserHasManageBountyRoles: Should test that if the user has all bounty roles return true, else return false.

Bounty Roles

var ManageBountiesGroup = []string{AddBounty, UpdateBounty, DeleteBounty, PayBounty}
RolesCheck
CheckUser
UserHasAccess
UserHasManageBountyRoles

Add tests to db/config_test.go

Acceptance Criteria

  • I have rebased and tested locally before submitting my PR
  • I can submit a PR within 2 days of taking the bounty

References

Here is an example backend test

@elraphty elraphty added backend go Pull requests that update Go code testing labels Feb 27, 2024
@elraphty elraphty added this to the UCI Tests milestone Feb 27, 2024
@AbdulWahab3181
Copy link
Contributor

AbdulWahab3181 commented Feb 27, 2024

@ecurrencyhodler Could you please assign me?

@ecurrencyhodler ecurrencyhodler moved this from 🆕 New to 🧨 To Do in Bounties Platform Feb 27, 2024
@arimusdev
Copy link

@ecurrencyhodler assign me please

@ecurrencyhodler
Copy link
Contributor

ecurrencyhodler commented Feb 28, 2024

Can you submit a PR in 2 days? @arimusdev

@hkarani
Copy link
Contributor

hkarani commented Feb 28, 2024

Hey @ecurrencyhodler I can take this on.

@Jagmohan2k
Copy link

Jagmohan2k commented Feb 28, 2024

@ecurrencyhodler assign can get PR in 2 days

@arimusdev
Copy link

arimusdev commented Feb 28, 2024

Can you submit a PR in 2 days? @arimusdev

yes,I can finish in 2 days

@ecurrencyhodler
Copy link
Contributor

@arimusdev will you submit a PR soon?

@gouravmpk
Copy link
Contributor

@ecurrencyhodler Assign

@AbdulWahab3181
Copy link
Contributor

@ecurrencyhodler Could you please assign me?

@hkarani
Copy link
Contributor

hkarani commented Mar 2, 2024

I can work on this @ecurrencyhodler , I have no other pending assigned bounties.

@ecurrencyhodler
Copy link
Contributor

@gouravmpk this is yours.

@AbdulWahab3181
Copy link
Contributor

AbdulWahab3181 commented Mar 5, 2024

@ecurrencyhodler could you please assign me?

@Fog3211
Copy link
Contributor

Fog3211 commented Mar 6, 2024

assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment