-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #91 from fabiante/feat/add-ctx-to-test-driver
- Loading branch information
Showing
10 changed files
with
64 additions
and
38 deletions.
There are no files selected for viewing
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,6 @@ | ||
package driver | ||
|
||
type Driver interface { | ||
// WithAuth sets the authentication context to be used by this driver. | ||
WithAuth() | ||
} |
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
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
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
package dsl | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
"github.com/fabiante/persurl/app" | ||
|
@@ -11,22 +12,22 @@ import ( | |
// GivenExistingPURL ensures that a PURL is known to the application. | ||
// | ||
// This is done by simply creating it. | ||
func GivenExistingPURL(t *testing.T, service AdminAPI, purl *PURL) { | ||
path, err := service.SavePURL(purl) | ||
func GivenExistingPURL(ctx context.Context, t *testing.T, service AdminAPI, purl *PURL) { | ||
path, err := service.SavePURL(ctx, purl) | ||
require.NoError(t, err, "saving purl failed") | ||
require.NotEmpty(t, path) | ||
} | ||
|
||
// GivenExistingDomain ensures that a Domain is known to the application. | ||
// | ||
// This currently is a no-op since domains can't explicitly be created. | ||
func GivenExistingDomain(t *testing.T, service AdminAPI, domain string) { | ||
err := service.CreateDomain(domain) | ||
func GivenExistingDomain(ctx context.Context, t *testing.T, service AdminAPI, domain string) { | ||
err := service.CreateDomain(ctx, domain) | ||
require.NoError(t, err, "creating domain failed") | ||
} | ||
|
||
// GivenSomeUser creates a user and returns the key for it. | ||
func GivenSomeUser(t *testing.T, userService *app.UserService) *models.UserKey { | ||
func GivenSomeUser(_ context.Context, t *testing.T, userService *app.UserService) *models.UserKey { | ||
user, err := userService.CreateUser("[email protected]") | ||
require.NoError(t, err) | ||
|
||
|
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
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
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
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
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
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