Test RowAccessPolicy
(t *testing.T)
| 295 | |
| 296 | // Test RowAccessPolicy |
| 297 | func TestRowAccessPolicy(t *testing.T) { |
| 298 | tests := []struct { |
| 299 | name string |
| 300 | policy *RowAccessPolicy |
| 301 | wantLiteral string |
| 302 | wantChildren int |
| 303 | }{ |
| 304 | { |
| 305 | name: "policy without filter", |
| 306 | policy: &RowAccessPolicy{ |
| 307 | Name: "admin_policy", |
| 308 | Enabled: true, |
| 309 | }, |
| 310 | wantLiteral: "ROW ACCESS POLICY", |
| 311 | wantChildren: 0, |
| 312 | }, |
| 313 | { |
| 314 | name: "policy with filter", |
| 315 | policy: &RowAccessPolicy{ |
| 316 | Name: "user_policy", |
| 317 | Filter: &mockExpr{}, |
| 318 | Enabled: true, |
| 319 | }, |
| 320 | wantLiteral: "ROW ACCESS POLICY", |
| 321 | wantChildren: 1, |
| 322 | }, |
| 323 | } |
| 324 | |
| 325 | for _, tt := range tests { |
| 326 | t.Run(tt.name, func(t *testing.T) { |
| 327 | // Test TokenLiteral |
| 328 | if got := tt.policy.TokenLiteral(); got != tt.wantLiteral { |
| 329 | t.Errorf("RowAccessPolicy.TokenLiteral() = %v, want %v", got, tt.wantLiteral) |
| 330 | } |
| 331 | |
| 332 | // Test Children |
| 333 | children := tt.policy.Children() |
| 334 | if len(children) != tt.wantChildren { |
| 335 | t.Errorf("RowAccessPolicy.Children() count = %d, want %d", len(children), tt.wantChildren) |
| 336 | } |
| 337 | }) |
| 338 | } |
| 339 | } |
| 340 | |
| 341 | // Test StatementImpl |
| 342 | func TestStatementImpl(t *testing.T) { |
nothing calls this directly
no test coverage detected