From 0ca07066db97619a388cb848f8192e572c43d478 Mon Sep 17 00:00:00 2001 From: Gjorgji Slamkov Date: Thu, 18 Jan 2024 08:33:40 +0100 Subject: [PATCH] test(GODT-3220): Create function for getting the test user by address GODT-3220 --- tests/ctx_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/ctx_test.go b/tests/ctx_test.go index 9b2b342b..b2502ab7 100644 --- a/tests/ctx_test.go +++ b/tests/ctx_test.go @@ -290,6 +290,18 @@ func (t *testCtx) getUserByID(userID string) *testUser { return t.userByID[userID] } +func (t *testCtx) getUserByAddress(email string) *testUser { + for _, user := range t.userByID { + for _, addr := range user.addresses { + if addr.email == email { + return user + } + } + } + + panic(fmt.Sprintf("unknown email %q", email)) +} + func (t *testCtx) getMBoxID(userID string, name string) string { ctx, cancel := context.WithCancel(context.Background()) defer cancel()