(t *testing.T)
| 23 | ) |
| 24 | |
| 25 | func TestInitRole(t *testing.T) { |
| 26 | base.SetUpTestLogging(t, base.LevelDebug, base.KeyAuth) |
| 27 | // Check initializing role with legal role name. |
| 28 | role := &roleImpl{} |
| 29 | assert.NoError(t, role.initRole("Music", channels.BaseSetOf(t, "Spotify", "Youtube"), nil)) |
| 30 | assert.Equal(t, "Music", role.Name_) |
| 31 | assert.Equal(t, channels.TimedSet{ |
| 32 | "Spotify": channels.NewVbSimpleSequence(0x1), |
| 33 | "Youtube": channels.NewVbSimpleSequence(0x1)}, role.ExplicitChannels_) |
| 34 | |
| 35 | // Check initializing role with illegal role name. |
| 36 | role = &roleImpl{} |
| 37 | assert.Error(t, role.initRole("Music/", channels.BaseSetOf(t, "Spotify", "Youtube"), nil)) |
| 38 | assert.Error(t, role.initRole("Music:", channels.BaseSetOf(t, "Spotify", "Youtube"), nil)) |
| 39 | assert.Error(t, role.initRole("Music,", channels.BaseSetOf(t, "Spotify", "Youtube"), nil)) |
| 40 | assert.Error(t, role.initRole(".", channels.BaseSetOf(t, "Spotify", "Youtube"), nil)) |
| 41 | assert.Error(t, role.initRole("\xf7,", channels.BaseSetOf(t, "Spotify", "Youtube"), nil)) |
| 42 | } |
| 43 | |
| 44 | func TestAuthorizeChannelsRole(t *testing.T) { |
| 45 | ctx := base.TestCtx(t) |
nothing calls this directly
no test coverage detected