MCPcopy
hub / github.com/fabiolb/fabio / createBasicAuthFile

Function createBasicAuthFile

auth/basic_test.go:39–51  ·  view source on GitHub ↗
(contents string, t *testing.T)

Source from the content-addressed store, hash-verified

37}
38
39func createBasicAuthFile(contents string, t *testing.T) (string, error) {
40 dir := t.TempDir()
41
42 filename := fmt.Sprintf("%s/%s", dir, uuid.NewUUID())
43
44 err := os.WriteFile(filename, []byte(contents), 0666)
45
46 if err != nil {
47 return "", fmt.Errorf("could not write password file: %s", err)
48 }
49
50 return filename, nil
51}
52
53func createBasicAuth(user string, password string, t *testing.T) (AuthScheme, error) {
54 contents := fmt.Sprintf("%s:%s", user, password)

Callers 4

TestLoadAuthSchemesFunction · 0.85
createBasicAuthFunction · 0.85
TestNewBasicAuthFunction · 0.85

Calls 1

NewUUIDFunction · 0.92

Tested by

no test coverage detected