(t *testing.T)
| 179 | } |
| 180 | |
| 181 | func TestCheckDomainCreate_BlocksAtCap(t *testing.T) { |
| 182 | store := &fakeStore{found: true, row: Limits{MaxAgents: 100, MaxDomains: 1, MaxMessagesMonth: 1, MaxStorageBytes: 1}} |
| 183 | counter := &fakeCounter{domains: 1} |
| 184 | e := newEnforcerWithReader(store, counter, defaultsForTest(), 0) |
| 185 | |
| 186 | err := e.CheckDomainCreate(context.Background(), "user1") |
| 187 | le, ok := IsLimitExceeded(err) |
| 188 | if !ok { |
| 189 | t.Fatalf("CheckDomainCreate at cap = %v, want LimitExceededError", err) |
| 190 | } |
| 191 | if le.Resource != "domains" { |
| 192 | t.Errorf("Resource = %q, want domains", le.Resource) |
| 193 | } |
| 194 | } |
| 195 | |
| 196 | func TestCheckMessageSend_BlocksOnMonthFlow(t *testing.T) { |
| 197 | store := &fakeStore{found: true, row: Limits{MaxAgents: 100, MaxDomains: 100, MaxMessagesMonth: 1000, MaxStorageBytes: 1 << 40}} |
nothing calls this directly
no test coverage detected