This commit is contained in:
@@ -128,6 +128,27 @@ func TestGardenContextIsKeptInAccountAndSettingsLinks(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestProtectedDemoAccountHidesAccountMutationForms(t *testing.T) {
|
||||
app := newTestApplication(t)
|
||||
user := client.User{ID: 1, Name: "Demo", Email: "demo@example.com", Activated: true}
|
||||
data := &templateData{
|
||||
commonTemplateData: commonTemplateData{IsAuthenticated: true, IsActivated: true, CurrentUser: &user, Form: accountForm{Errors: map[string]string{}}},
|
||||
accountTemplateData: accountTemplateData{AccountProtected: true},
|
||||
}
|
||||
response := httptest.NewRecorder()
|
||||
app.render(response, http.StatusOK, "account.tmpl", data)
|
||||
body := response.Body.String()
|
||||
|
||||
if !strings.Contains(body, "Gemeinsames Demokonto") {
|
||||
t.Fatalf("protected account notice is missing: %s", body)
|
||||
}
|
||||
for _, forbidden := range []string{"action='/account/profile'", "action='/account/password'", "action='/account/email'", "Widerrufen"} {
|
||||
if strings.Contains(body, forbidden) {
|
||||
t.Errorf("protected account still offers %q: %s", forbidden, body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestAdminTemplateKeepsSelectedGardenInNavigationAndForms(t *testing.T) {
|
||||
app := newTestApplication(t)
|
||||
user := client.User{ID: 1, Name: "Alice", Activated: true, Permissions: []string{"roles:manage"}}
|
||||
|
||||
Reference in New Issue
Block a user