Skip to content

Commit

Permalink
Fix restrictor of projector-message and -countdown (#419)
Browse files Browse the repository at this point in the history
Also make sure the tests use not meeting id 1

fixes #417
  • Loading branch information
ostcar committed Feb 10, 2022
1 parent bdc0118 commit a50ae68
Show file tree
Hide file tree
Showing 32 changed files with 375 additions and 363 deletions.
42 changes: 21 additions & 21 deletions internal/restrict/collection/agenda_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func TestAgendaModeA(t *testing.T) {
a.Modes("A"),
false,
`---
agenda_item/1/meeting_id: 1
agenda_item/1/meeting_id: 30
`,
)

Expand All @@ -26,9 +26,9 @@ func TestAgendaModeA(t *testing.T) {
a.Modes("A"),
true,
`---
agenda_item/1/meeting_id: 1
agenda_item/1/meeting_id: 30
`,
withPerms(1, perm.AgendaItemCanManage),
withPerms(30, perm.AgendaItemCanManage),
)

testCase(
Expand All @@ -38,10 +38,10 @@ func TestAgendaModeA(t *testing.T) {
false,
`---
agenda_item/1:
meeting_id: 1
meeting_id: 30
is_hidden: true
`,
withPerms(1, perm.AgendaItemCanSeeInternal),
withPerms(30, perm.AgendaItemCanSeeInternal),
)

testCase(
Expand All @@ -51,10 +51,10 @@ func TestAgendaModeA(t *testing.T) {
true,
`---
agenda_item/1:
meeting_id: 1
meeting_id: 30
is_hidden: false
`,
withPerms(1, perm.AgendaItemCanSeeInternal),
withPerms(30, perm.AgendaItemCanSeeInternal),
)

testCase(
Expand All @@ -64,11 +64,11 @@ func TestAgendaModeA(t *testing.T) {
false,
`---
agenda_item/1:
meeting_id: 1
meeting_id: 30
is_hidden: true
is_internal: true
`,
withPerms(1, perm.AgendaItemCanSee),
withPerms(30, perm.AgendaItemCanSee),
)

testCase(
Expand All @@ -78,11 +78,11 @@ func TestAgendaModeA(t *testing.T) {
false,
`---
agenda_item/1:
meeting_id: 1
meeting_id: 30
is_hidden: false
is_internal: true
`,
withPerms(1, perm.AgendaItemCanSee),
withPerms(30, perm.AgendaItemCanSee),
)

testCase(
Expand All @@ -92,11 +92,11 @@ func TestAgendaModeA(t *testing.T) {
false,
`---
agenda_item/1:
meeting_id: 1
meeting_id: 30
is_hidden: true
is_internal: false
`,
withPerms(1, perm.AgendaItemCanSee),
withPerms(30, perm.AgendaItemCanSee),
)

testCase(
Expand All @@ -106,18 +106,18 @@ func TestAgendaModeA(t *testing.T) {
true,
`---
agenda_item/1:
meeting_id: 1
meeting_id: 30
is_hidden: false
is_internal: false
`,
withPerms(1, perm.AgendaItemCanSee),
withPerms(30, perm.AgendaItemCanSee),
)
}

func TestAgendaModeB(t *testing.T) {
var a collection.AgendaItem
ds := `---
agenda_item/1/meeting_id: 1
agenda_item/1/meeting_id: 30
`

testCase(
Expand All @@ -126,7 +126,7 @@ func TestAgendaModeB(t *testing.T) {
a.Modes("B"),
true,
ds,
withPerms(1, perm.AgendaItemCanSeeInternal),
withPerms(30, perm.AgendaItemCanSeeInternal),
)

testCase(
Expand All @@ -141,7 +141,7 @@ func TestAgendaModeB(t *testing.T) {
func TestAgendaModeC(t *testing.T) {
var a collection.AgendaItem
ds := `---
agenda_item/1/meeting_id: 1
agenda_item/1/meeting_id: 30
`

testCase(
Expand All @@ -150,7 +150,7 @@ func TestAgendaModeC(t *testing.T) {
a.Modes("C"),
false,
ds,
withPerms(1, perm.AgendaItemCanSeeInternal),
withPerms(30, perm.AgendaItemCanSeeInternal),
)

testCase(
Expand All @@ -159,7 +159,7 @@ func TestAgendaModeC(t *testing.T) {
a.Modes("C"),
false,
ds,
withPerms(1, perm.AgendaItemCanSee),
withPerms(30, perm.AgendaItemCanSee),
)

testCase(
Expand All @@ -168,7 +168,7 @@ func TestAgendaModeC(t *testing.T) {
a.Modes("C"),
true,
ds,
withPerms(1, perm.AgendaItemCanManage),
withPerms(30, perm.AgendaItemCanManage),
)

testCase(
Expand Down
8 changes: 4 additions & 4 deletions internal/restrict/collection/assignment_candidate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ func TestAssignmentCandidateModeA(t *testing.T) {
assignment_candidate/1/assignment_id: 7
assignment/7:
meeting_id: 1
meeting_id: 30
agenda_item_id: 5
agenda_item/5/meeting_id: 1
agenda_item/5/meeting_id: 30
`

testCase(
Expand All @@ -25,7 +25,7 @@ func TestAssignmentCandidateModeA(t *testing.T) {
a.Modes("A"),
true,
ds,
withPerms(1, perm.AssignmentCanSee),
withPerms(30, perm.AssignmentCanSee),
)

testCase(
Expand All @@ -34,7 +34,7 @@ func TestAssignmentCandidateModeA(t *testing.T) {
a.Modes("A"),
true,
ds,
withPerms(1, perm.AgendaItemCanSee),
withPerms(30, perm.AgendaItemCanSee),
)

testCase(
Expand Down
40 changes: 19 additions & 21 deletions internal/restrict/collection/assignment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ func TestAssignmentModeA(t *testing.T) {
false,
`---
assignment/1:
meeting_id: 1
meeting/1/committee_id: 404
meeting_id: 30
`,
)

Expand All @@ -30,9 +28,9 @@ func TestAssignmentModeA(t *testing.T) {
true,
`---
assignment/1:
meeting_id: 1
meeting_id: 30
`,
withPerms(1, perm.AssignmentCanSee),
withPerms(30, perm.AssignmentCanSee),
)

testCase(
Expand All @@ -43,17 +41,17 @@ func TestAssignmentModeA(t *testing.T) {
`---
assignment/1:
agenda_item_id: 30
meeting_id: 1
meeting_id: 30
list_of_speakers_id: 15
agenda_item/30:
meeting_id: 1
meeting_id: 30
list_of_speakers/15:
id: 15
meeting_id: 1
meeting_id: 30
`,
withPerms(1, perm.AgendaItemCanSee),
withPerms(30, perm.AgendaItemCanSee),
)

testCase(
Expand All @@ -64,15 +62,15 @@ func TestAssignmentModeA(t *testing.T) {
`---
assignment/1:
agenda_item_id: 30
meeting_id: 1
meeting_id: 30
list_of_speakers_id: 15
agenda_item/30:
meeting_id: 1
meeting_id: 30
list_of_speakers/15:
id: 15
meeting_id: 1
meeting_id: 30
`,
)

Expand All @@ -83,12 +81,12 @@ func TestAssignmentModeA(t *testing.T) {
false,
`---
assignment/1:
meeting_id: 1
meeting_id: 30
agenda_item/30:
meeting_id: 1
meeting_id: 30
`,
withPerms(1, perm.AgendaItemCanSee),
withPerms(30, perm.AgendaItemCanSee),
)
}

Expand All @@ -102,7 +100,7 @@ func TestAssignmentModeB(t *testing.T) {
false,
`---
assignment/1:
meeting_id: 1
meeting_id: 30
list_of_speakers_id: 404
`,
)
Expand All @@ -114,9 +112,9 @@ func TestAssignmentModeB(t *testing.T) {
true,
`---
assignment/1:
meeting_id: 1
meeting_id: 30
`,
withPerms(1, perm.AssignmentCanSee),
withPerms(30, perm.AssignmentCanSee),
)

testCase(
Expand All @@ -127,13 +125,13 @@ func TestAssignmentModeB(t *testing.T) {
`---
assignment/1:
agenda_item_id: 30
meeting_id: 1
meeting_id: 30
list_of_speakers_id: 404
agenda_item/30:
meeting_id: 1
meeting_id: 30
list_of_speakers_id: 404
`,
withPerms(1, perm.AgendaItemCanSee),
withPerms(30, perm.AgendaItemCanSee),
)
}
22 changes: 11 additions & 11 deletions internal/restrict/collection/chat_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ func TestChatGroupModeA(t *testing.T) {
c.Modes("A"),
false,
`---
chat_group/1/meeting_id: 1
meeting/1/id: 1
chat_group/1/meeting_id: 30
meeting/30/id: 30
`,
)

Expand All @@ -27,11 +27,11 @@ func TestChatGroupModeA(t *testing.T) {
c.Modes("A"),
true,
`---
chat_group/1/meeting_id: 1
chat_group/1/meeting_id: 30
meeting/1/id: 1
meeting/30/id: 30
`,
withPerms(1, perm.ChatCanManage),
withPerms(30, perm.ChatCanManage),
)

testCase(
Expand All @@ -41,13 +41,13 @@ func TestChatGroupModeA(t *testing.T) {
true,
`---
chat_group/1:
meeting_id: 1
meeting_id: 30
read_group_ids: [4]
meeting/1/id: 1
meeting/30/id: 1
group/4/id: 4
user/1/group_$1_ids: [4]
user/1/group_$30_ids: [4]
`,
)

Expand All @@ -58,13 +58,13 @@ func TestChatGroupModeA(t *testing.T) {
true,
`---
chat_group/1:
meeting_id: 1
meeting_id: 30
write_group_ids: [4]
meeting/1/id: 1
meeting/30/id: 1
group/4/id: 4
user/1/group_$1_ids: [4]
user/1/group_$30_ids: [4]
`,
)
}
Loading

0 comments on commit a50ae68

Please sign in to comment.