(t *testing.T)
| 41 | } |
| 42 | |
| 43 | func TestExistingAuth(t *testing.T) { |
| 44 | ctx := t.Context() |
| 45 | u := &scalingo.User{ |
| 46 | Email: "test@example.com", |
| 47 | Username: "test", |
| 48 | } |
| 49 | authenticator := &CliAuthenticator{} |
| 50 | |
| 51 | // Before any auth |
| 52 | currentAuth, err := existingAuth(ctx) |
| 53 | require.NoError(t, err) |
| 54 | |
| 55 | var configPerHost auth.ConfigPerHostV2 |
| 56 | json.Unmarshal(currentAuth.AuthConfigPerHost, &configPerHost) |
| 57 | assert.Empty(t, configPerHost) |
| 58 | assert.True(t, currentAuth.LastUpdate.IsZero()) |
| 59 | |
| 60 | // After one auth |
| 61 | err = authenticator.StoreAuth(ctx, u, "0123456789") |
| 62 | require.NoError(t, err) |
| 63 | |
| 64 | currentAuth, err = existingAuth(ctx) |
| 65 | json.Unmarshal(currentAuth.AuthConfigPerHost, &configPerHost) |
| 66 | require.NoError(t, err) |
| 67 | assert.Len(t, configPerHost, 1) |
| 68 | assert.False(t, currentAuth.LastUpdate.IsZero()) |
| 69 | |
| 70 | clean() |
| 71 | } |
nothing calls this directly
no test coverage detected