(t *testing.T)
| 72 | } |
| 73 | |
| 74 | func TestEnforcer_GetFallsBackToDefaultsWhenNoRow(t *testing.T) { |
| 75 | store := &fakeStore{found: false} |
| 76 | counter := &fakeCounter{} |
| 77 | e := newEnforcerWithReader(store, counter, defaultsForTest(), 0) |
| 78 | |
| 79 | got, err := e.Get(context.Background(), "user1") |
| 80 | if err != nil { |
| 81 | t.Fatalf("Get: %v", err) |
| 82 | } |
| 83 | if got.MaxAgents != 5 || got.MaxDomains != 2 || got.MaxMessagesMonth != 100 || got.MaxStorageBytes != 10_000 { |
| 84 | t.Errorf("Get fallback = %+v, want defaults", got) |
| 85 | } |
| 86 | if got.PlanCode != "default" { |
| 87 | t.Errorf("PlanCode = %q, want default", got.PlanCode) |
| 88 | } |
| 89 | if got.UpgradeURL != "" { |
| 90 | t.Errorf("UpgradeURL = %q on fallback, want empty", got.UpgradeURL) |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | func TestEnforcer_GetReturnsRowWhenPresent(t *testing.T) { |
| 95 | row := Limits{ |
nothing calls this directly
no test coverage detected