(t *testing.T)
| 103 | } |
| 104 | |
| 105 | func TestValidateUserEmail(t *testing.T) { |
| 106 | |
| 107 | ctx := base.TestCtx(t) |
| 108 | bucket := base.GetTestBucket(t) |
| 109 | defer bucket.Close(ctx) |
| 110 | |
| 111 | dataStore := bucket.GetSingleDataStore() |
| 112 | |
| 113 | auth := NewTestAuthenticator(t, dataStore, nil, DefaultAuthenticatorOptions(ctx)) |
| 114 | badEmails := []string{"", "foo", "foo@", "@bar", "foo@bar@buzz"} |
| 115 | for _, e := range badEmails { |
| 116 | assert.False(t, IsValidEmail(e), "Shouldn't validate as email: %q", e) |
| 117 | } |
| 118 | goodEmails := []string{"foo@bar", "foo.99@bar.com", "f@bar.exampl-3.com."} |
| 119 | for _, e := range goodEmails { |
| 120 | assert.True(t, IsValidEmail(e), "Should validate as email: %q", e) |
| 121 | } |
| 122 | user, err := auth.NewUser("ValidName", "letmein", nil) |
| 123 | require.NoError(t, err) |
| 124 | require.Error(t, user.SetEmail("foo")) |
| 125 | require.NoError(t, user.SetEmail("foo@example.com")) |
| 126 | } |
| 127 | |
| 128 | func TestUserPasswords(t *testing.T) { |
| 129 | ctx := base.TestCtx(t) |
nothing calls this directly
no test coverage detected