You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, we do not have a test for GetWorkspaceRepoByWorkspaceUuidAndRepoUuid
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 the test_config.go configuration.
After spinning up the Postgres DB container:
Add this line of code on the first line and second of the test function TestGetWorkspaceRepoByWorkspaceUuidAndRepoUuid to connect to the Test DB
Create a test route using r.Get("/{workspace_uuid}/repository/{uuid}", workspaceHandlers.GetWorkspaceRepoByWorkspaceUuidAndRepoUuid) as a reference, the test route
Pass the created workspace uuid and the created repository uuid as the URL parameters
Assert that it throws a 401 error if a user is not authorized
Assert that the repository returned from the API matches the one created.
Assertions
Assert that the workspace repository returned from the API responses matches the one created
Assert that all the test passes
Acceptance Criteria
I have rebased and tested locally before submitting my PR
I can submit a PR within 1 day of taking the bounty
Context
Currently, we do not have a test for GetWorkspaceRepoByWorkspaceUuidAndRepoUuid
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:
TestGetWorkspaceRepoByWorkspaceUuidAndRepoUuid
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)
db.TestDb.CreateOrEditWorkspaceRepository(workspaceRepositoru)
e.gr.Get("/{workspace_uuid}/repository/{uuid}", workspaceHandlers.GetWorkspaceRepoByWorkspaceUuidAndRepoUuid)
as a reference, the test route401
error if a user is not authorizedAssertions
Acceptance Criteria
Here is an example Real DB Test
The text was updated successfully, but these errors were encountered: