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

Method assert_query_fails

graphlite/tests/testutils/cli_fixture.rs:110–143  ·  view source on GitHub ↗

Execute query via CLI and expect failure

(&self, query: &str)

Source from the content-addressed store, hash-verified

108
109 /// Execute query via CLI and expect failure
110 pub fn assert_query_fails(&self, query: &str) -> String {
111 let output = Command::new("cargo")
112 .args([
113 "run",
114 "--quiet",
115 "--package",
116 "gql-cli",
117 "--bin",
118 "graphlite",
119 "--",
120 "query",
121 ])
122 .arg("--path")
123 .arg(&self.db_path)
124 .arg("--user")
125 .arg(&self.admin_user)
126 .arg("--password")
127 .arg(&self.admin_password)
128 .arg("--format")
129 .arg("json")
130 .arg(query)
131 .env("RUST_LOG", "error") // Suppress INFO logs in CLI output
132 .output()
133 .expect("Failed to execute query");
134
135 // Query should fail
136 assert!(
137 !output.status.success(),
138 "Expected query to fail but it succeeded: {}",
139 query
140 );
141
142 String::from_utf8_lossy(&output.stderr).to_string()
143 }
144
145 /// Get unique schema name for test isolation
146 pub fn schema_name(&self) -> String {

Callers 15

test_error_handlingFunction · 0.45
test_role_lifecycleFunction · 0.45
test_user_lifecycleFunction · 0.45
test_authenticationFunction · 0.45
test_drop_schema_basicFunction · 0.45
test_ddl_error_casesFunction · 0.45
test_dml_error_casesFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected