Harden LMS and exam-prep gates so only STUDENT is enforced, and return FREE effective_access_tier for OPEN_LEARNER so clients do not show paywall locks. Co-authored-by: Cursor <cursoragent@cursor.com>
25 lines
951 B
Go
25 lines
951 B
Go
package domain
|
|
|
|
import "testing"
|
|
|
|
func TestEffectiveContentAccessTier(t *testing.T) {
|
|
if got := EffectiveContentAccessTier(ContentAccessFree, ContentAccessFree); got != ContentAccessFree {
|
|
t.Fatalf("expected FREE, got %s", got)
|
|
}
|
|
if got := EffectiveContentAccessTier(ContentAccessFree, ContentAccessPremium); got != ContentAccessPremium {
|
|
t.Fatalf("expected PREMIUM, got %s", got)
|
|
}
|
|
if got := EffectiveContentAccessTier(ContentAccessPremium, ContentAccessFree); got != ContentAccessPremium {
|
|
t.Fatalf("expected cascaded PREMIUM, got %s", got)
|
|
}
|
|
}
|
|
|
|
func TestContentAccessTierForRole_openLearnerAlwaysFree(t *testing.T) {
|
|
if got := ContentAccessTierForRole(RoleOpenLearner, ContentAccessPremium); got != ContentAccessFree {
|
|
t.Fatalf("OPEN_LEARNER expected FREE, got %s", got)
|
|
}
|
|
if got := ContentAccessTierForRole(RoleStudent, ContentAccessPremium); got != ContentAccessPremium {
|
|
t.Fatalf("STUDENT expected PREMIUM, got %s", got)
|
|
}
|
|
}
|