-
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
Refactor Test For TestBountyBudgetWithdraw To Use A Real Postgres DB For The Test #1856
Closed
6 tasks
Labels
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Context
Currently, we test the
TestBountyBudgetWithdraw
with a mock database.Design
We want to refactor 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:
TestBountyBudgetWithdraw
to connect to the Test DBThe test will throw a dereference error if not connected to a DB.
TTestPollInvoice
test cases e.g.mockDb.On("ProcessBountyPayment", mock.AnythingOfType("db.NewPaymentHistory"), mock.AnythingOfType("db.NewBounty")).Return(nil)
.bHandler := NewBountyHandler(mockHttpClient, mockDb)
tobHandler := NewBountyHandler(mockHttpClient, db.TestDb)
db.TestDb.CreateOrPerson()
function e.gdb.TestDb.CreateOrEditWorkspace()
function e.gworkspace:= db.TestDb.GetWorkspaceByUuid(workspace.Uuid)
db.TestDB.CreateWorkspaceBudget()
function e.gwithdrawRequest
OrgUuid
value towokspace.Uuid
e.gauthorizedCtx
value fromauthorizedCtx := context.WithValue(ctx, auth.ContextKey, "valid-key")
toauthorizedCtx := context.WithValue(ctx, auth.ContextKey, person.OwnerPubkey)
Id
e.g.r.Post("gobounties/budget/withdraw", bountyHandler.BountyBudgetWithdraw)
db.TestDb.GetWorkspaceBudget(workspace.Uuid)
functionAssertions
Acceptance Criteria
TestBountyBudgetWithdraw
TestBountyBudgetWithdraw
refactor passesTestBountyBudgetWithdraw
should not break existing test flows.Here is an example Real DB Test
The text was updated successfully, but these errors were encountered: