generated from mrz1836/go-template
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(SPV-1298): utxo endpoint tests (#834)
- Loading branch information
1 parent
993421a
commit e776a4b
Showing
3 changed files
with
65 additions
and
80 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package utxos_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/bitcoin-sv/spv-wallet/actions/testabilities" | ||
"github.com/bitcoin-sv/spv-wallet/engine/tester/fixtures" | ||
) | ||
|
||
func TestUserUTXOs(t *testing.T) { | ||
t.Run("return UTXOs for user", func(t *testing.T) { | ||
// given: | ||
given, then := testabilities.New(t) | ||
cleanup := given.StartedSPVWallet() | ||
defer cleanup() | ||
|
||
// and: | ||
client := given.HttpClient().ForGivenUser(fixtures.Sender) | ||
|
||
// when: | ||
res, _ := client.R().Get("/api/v1/utxos") | ||
|
||
// then: | ||
then.Response(res). | ||
IsOK(). | ||
WithJSONf(`{ | ||
"content": [], | ||
"page": { | ||
"number": 1, | ||
"size": 50, | ||
"totalElements": 0, | ||
"totalPages": 0 | ||
} | ||
}`) | ||
|
||
}) | ||
|
||
t.Run("try to return UTXOs for admin", func(t *testing.T) { | ||
// given: | ||
given, then := testabilities.New(t) | ||
cleanup := given.StartedSPVWallet() | ||
defer cleanup() | ||
client := given.HttpClient().ForAdmin() | ||
|
||
// when: | ||
res, _ := client.R().Get("/api/v1/utxos") | ||
|
||
// then: | ||
then.Response(res).IsUnauthorizedForAdmin() | ||
}) | ||
|
||
t.Run("return UTXOs for anonymous", func(t *testing.T) { | ||
// given: | ||
given, then := testabilities.New(t) | ||
cleanup := given.StartedSPVWallet() | ||
defer cleanup() | ||
client := given.HttpClient().ForAnonymous() | ||
|
||
// when: | ||
res, _ := client.R().Get("/api/v1/utxos") | ||
|
||
// then: | ||
then.Response(res).IsUnauthorized() | ||
}) | ||
} |
This file was deleted.
Oops, something went wrong.