generated from VLADIMIR/template
clear
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package roles
|
||||
|
||||
import "testing"
|
||||
|
||||
func Test_subject_HasRole(t *testing.T) {
|
||||
subject := NewSubject(Author, Organizer)
|
||||
|
||||
if !subject.HasRole(Author) {
|
||||
t.Errorf("HasRole(%q) = false, want true", Author)
|
||||
}
|
||||
if !subject.HasRole(Organizer) {
|
||||
t.Errorf("HasRole(%q) = false, want true", Organizer)
|
||||
}
|
||||
if subject.HasRole(Admin) {
|
||||
t.Errorf("HasRole(%q) = true, want false", Admin)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_subject_HasRoleEmpty(t *testing.T) {
|
||||
subject := NewSubject()
|
||||
|
||||
if subject.HasRole(User) {
|
||||
t.Errorf("HasRole(%q) = true, want false для субъекта без ролей", User)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user