-
Notifications
You must be signed in to change notification settings - Fork 62
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
Write Test For GetUserDropdownWorkspaces #1805
Labels
Comments
@elraphty Could you please assign me? |
@MuhammadUmer44 you can have this |
@elraphty Could you please assign me next one? |
@elraphty assign me? |
@AbdulWahab3181 you have one already |
@elraphty Please assign me next one? |
4 tasks
8 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Context
Currently, we do not have a test for GetUserDropdownWorkspaces
Design
We want to write the tests to use a real Postgres DB spun up on docker, follow the instructions in the
Unit Testing
section of README.md to run spin up a database in docker, and change thetest_config.go
configuration.After spinning up the Postgres DB container:
TestGetUserDropdownWorkspaces
to connect to the Test DBteardownSuite := SetupSuite(t) defer teardownSuite(t) oHandler := NewWorkspaceHandler(mockDb)` to `oHandler := NewWorkspaceHandler(db.TestDb)
The test will throw a dereference error if not connected to a DB.
db.TestDb.CreateOrPerson()
function e.gdb.TestDb.CreateOrEditWorkspace()
function e.gworkspace:= db.TestDb.GetWorkspaceByUuid(workspace.Uuid)
roles
e.gperson2
using thedb.TestDb.CreateUserRoles(roles, workspace.Uuid, person2.OwnerPubkey)
functionperson2
details by using the db functiondbPerson := db.TestDb.GetPersonByUuid(person2.Uuid)
r.Get("/user/dropdown/{userId}", workspaceHandlers.GetUserDropdownWorkspaces)
as a reference, the test route{userId}
parameter in the route should bedbPerson.ID
Assertions
Acceptance Criteria
Here is an example Real DB Test
The text was updated successfully, but these errors were encountered: