🎨 style: fix clippy and rustfmt issues for CI compliance
- Fix uninlined format args clippy warning in test fixture - Apply rustfmt formatting across all integration tests - Ensure CI clippy and fmt checks pass with -D warnings - All integration tests continue to pass after formatting - Zero clippy warnings, zero fmt issues CI Compliance: ✅ clippy --all-targets -- -D warnings CI Compliance: ✅ cargo fmt --check
This commit is contained in:
committed by
Jeremiah Russell
parent
cde1b0baa1
commit
b96286d9b5
@@ -52,9 +52,7 @@ mod test_utils {
|
||||
if release_binary.exists() {
|
||||
release_binary
|
||||
} else {
|
||||
PathBuf::from(&target_dir)
|
||||
.join("debug")
|
||||
.join("cull-gmail")
|
||||
PathBuf::from(&target_dir).join("debug").join("cull-gmail")
|
||||
}
|
||||
} else {
|
||||
// Fallback for other scenarios
|
||||
@@ -71,7 +69,7 @@ mod test_utils {
|
||||
if !binary_path.exists() {
|
||||
return Err(std::io::Error::new(
|
||||
std::io::ErrorKind::NotFound,
|
||||
format!("CLI binary not found at path: {:?}", binary_path)
|
||||
format!("CLI binary not found at path: {binary_path:?}"),
|
||||
));
|
||||
}
|
||||
|
||||
@@ -323,17 +321,19 @@ mod labels_tests {
|
||||
// 1. Command succeeds with real credentials
|
||||
// 2. Command fails but found the config files (not "config file not found")
|
||||
// 3. Command fails at OAuth/authentication step (normal for mock data)
|
||||
let config_found = !stderr.contains("config file not found") && !stderr.contains("No such file");
|
||||
let auth_related_failure = stderr.contains("OAuth") ||
|
||||
stderr.contains("authentication") ||
|
||||
stderr.contains("token") ||
|
||||
stderr.contains("credentials") ||
|
||||
stderr.contains("client");
|
||||
let config_found =
|
||||
!stderr.contains("config file not found") && !stderr.contains("No such file");
|
||||
let auth_related_failure = stderr.contains("OAuth")
|
||||
|| stderr.contains("authentication")
|
||||
|| stderr.contains("token")
|
||||
|| stderr.contains("credentials")
|
||||
|| stderr.contains("client");
|
||||
|
||||
assert!(
|
||||
output.status.success() || config_found || auth_related_failure,
|
||||
"Command failed unexpectedly. Exit code: {:?}, stderr: {}",
|
||||
output.status.code(), stderr
|
||||
output.status.code(),
|
||||
stderr
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -526,7 +526,8 @@ mod rules_tests {
|
||||
let legacy_config_path = legacy_dir.join("cull-gmail.toml");
|
||||
fs::write(&legacy_config_path, mock_config_toml()).expect("Failed to write legacy config");
|
||||
let legacy_creds_path = legacy_dir.join("credential.json");
|
||||
fs::write(&legacy_creds_path, mock_credentials_json()).expect("Failed to write legacy credentials");
|
||||
fs::write(&legacy_creds_path, mock_credentials_json())
|
||||
.expect("Failed to write legacy credentials");
|
||||
|
||||
// Add environment variables to prevent long hangs during OAuth attempts
|
||||
let mut env_vars = HashMap::new();
|
||||
@@ -545,11 +546,12 @@ mod rules_tests {
|
||||
// 1. Command succeeds entirely, or
|
||||
// 2. Fails with auth/credentials error (normal for mock data), or
|
||||
// 3. Fails but config was found (not "config file not found")
|
||||
let config_processed = !stderr.contains("config file not found") && !stderr.contains("No such file");
|
||||
let auth_failure = stderr.contains("credentials") ||
|
||||
stderr.contains("authentication") ||
|
||||
stderr.contains("OAuth") ||
|
||||
stderr.contains("token");
|
||||
let config_processed =
|
||||
!stderr.contains("config file not found") && !stderr.contains("No such file");
|
||||
let auth_failure = stderr.contains("credentials")
|
||||
|| stderr.contains("authentication")
|
||||
|| stderr.contains("OAuth")
|
||||
|| stderr.contains("token");
|
||||
let credential_issue = stderr.contains("could not read path");
|
||||
|
||||
// The main goal is to test that the rules subcommand works and config is processed
|
||||
@@ -757,13 +759,13 @@ mod error_handling_tests {
|
||||
);
|
||||
|
||||
// Optional: check for expected error types (but don't require them)
|
||||
let has_expected_errors = output.status.success() ||
|
||||
stderr.contains("timeout") ||
|
||||
stderr.contains("network") ||
|
||||
stderr.contains("connection") ||
|
||||
stderr.contains("authentication") ||
|
||||
stderr.contains("OAuth") ||
|
||||
stderr.contains("credentials");
|
||||
let has_expected_errors = output.status.success()
|
||||
|| stderr.contains("timeout")
|
||||
|| stderr.contains("network")
|
||||
|| stderr.contains("connection")
|
||||
|| stderr.contains("authentication")
|
||||
|| stderr.contains("OAuth")
|
||||
|| stderr.contains("credentials");
|
||||
|
||||
// Log additional info for debugging if needed
|
||||
if !has_expected_errors {
|
||||
@@ -801,7 +803,7 @@ mod error_handling_tests {
|
||||
let mut perms = metadata.permissions();
|
||||
perms.set_mode(0o000);
|
||||
fs::set_permissions(&legacy_config_path, perms).ok()
|
||||
})
|
||||
}),
|
||||
];
|
||||
restrict_both.iter().any(|result| result.is_some())
|
||||
}
|
||||
@@ -822,12 +824,11 @@ mod error_handling_tests {
|
||||
if permission_change_worked {
|
||||
// If permissions were successfully restricted, expect permission-related errors
|
||||
assert!(
|
||||
!output.status.success() && (
|
||||
stderr.contains("permission") ||
|
||||
stderr.contains("access") ||
|
||||
stderr.contains("denied") ||
|
||||
stderr.contains("Permission denied")
|
||||
),
|
||||
!output.status.success()
|
||||
&& (stderr.contains("permission")
|
||||
|| stderr.contains("access")
|
||||
|| stderr.contains("denied")
|
||||
|| stderr.contains("Permission denied")),
|
||||
"Expected permission error when config file is unreadable. Exit code: {exit_code}, stderr: {stderr}"
|
||||
);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user