()
| 16 | |
| 17 | #[test] |
| 18 | fn test_role_lifecycle() { |
| 19 | let fixture = TestFixture::empty().expect("Failed to create test fixture"); |
| 20 | |
| 21 | // Test CREATE ROLE |
| 22 | fixture.assert_query_succeeds("CREATE ROLE 'data_scientist'"); |
| 23 | fixture.assert_query_succeeds("CREATE ROLE 'analyst'"); |
| 24 | fixture.assert_query_succeeds("CREATE ROLE 'viewer'"); |
| 25 | |
| 26 | // Test duplicate role creation should fail |
| 27 | fixture.assert_query_fails("CREATE ROLE 'data_scientist'", "already exists"); |
| 28 | |
| 29 | // Test CREATE ROLE IF NOT EXISTS (may not be implemented yet) |
| 30 | let if_not_exists_result = fixture.query("CREATE ROLE IF NOT EXISTS 'data_scientist'"); |
| 31 | if if_not_exists_result.is_ok() { |
| 32 | fixture.assert_query_succeeds("CREATE ROLE IF NOT EXISTS 'new_role'"); |
| 33 | } else { |
| 34 | fixture.assert_query_succeeds("CREATE ROLE 'new_role'"); |
| 35 | } |
| 36 | |
| 37 | // Test DROP ROLE |
| 38 | fixture.assert_query_succeeds("DROP ROLE 'new_role'"); |
| 39 | |
| 40 | // Test DROP ROLE IF EXISTS |
| 41 | fixture.assert_query_succeeds("DROP ROLE IF EXISTS 'nonexistent_role'"); |
| 42 | fixture.assert_query_succeeds("DROP ROLE IF EXISTS 'analyst'"); |
| 43 | |
| 44 | // Test dropping non-existent role should fail without IF EXISTS |
| 45 | fixture.assert_query_fails("DROP ROLE 'nonexistent_role'", "not found"); |
| 46 | } |
| 47 | |
| 48 | #[test] |
| 49 | fn test_role_listing() { |
nothing calls this directly
no test coverage detected