MCPcopy Create free account
hub / github.com/GraphLite-AI/GraphLite / test_role_lifecycle

Function test_role_lifecycle

graphlite/tests/security_role_user_tests.rs:18–46  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16
17#[test]
18fn 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]
49fn test_role_listing() {

Callers

nothing calls this directly

Calls 3

assert_query_succeedsMethod · 0.45
assert_query_failsMethod · 0.45
queryMethod · 0.45

Tested by

no test coverage detected