🎨 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() {
|
if release_binary.exists() {
|
||||||
release_binary
|
release_binary
|
||||||
} else {
|
} else {
|
||||||
PathBuf::from(&target_dir)
|
PathBuf::from(&target_dir).join("debug").join("cull-gmail")
|
||||||
.join("debug")
|
|
||||||
.join("cull-gmail")
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Fallback for other scenarios
|
// Fallback for other scenarios
|
||||||
@@ -71,7 +69,7 @@ mod test_utils {
|
|||||||
if !binary_path.exists() {
|
if !binary_path.exists() {
|
||||||
return Err(std::io::Error::new(
|
return Err(std::io::Error::new(
|
||||||
std::io::ErrorKind::NotFound,
|
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
|
// 1. Command succeeds with real credentials
|
||||||
// 2. Command fails but found the config files (not "config file not found")
|
// 2. Command fails but found the config files (not "config file not found")
|
||||||
// 3. Command fails at OAuth/authentication step (normal for mock data)
|
// 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 config_found =
|
||||||
let auth_related_failure = stderr.contains("OAuth") ||
|
!stderr.contains("config file not found") && !stderr.contains("No such file");
|
||||||
stderr.contains("authentication") ||
|
let auth_related_failure = stderr.contains("OAuth")
|
||||||
stderr.contains("token") ||
|
|| stderr.contains("authentication")
|
||||||
stderr.contains("credentials") ||
|
|| stderr.contains("token")
|
||||||
stderr.contains("client");
|
|| stderr.contains("credentials")
|
||||||
|
|| stderr.contains("client");
|
||||||
|
|
||||||
assert!(
|
assert!(
|
||||||
output.status.success() || config_found || auth_related_failure,
|
output.status.success() || config_found || auth_related_failure,
|
||||||
"Command failed unexpectedly. Exit code: {:?}, stderr: {}",
|
"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");
|
let legacy_config_path = legacy_dir.join("cull-gmail.toml");
|
||||||
fs::write(&legacy_config_path, mock_config_toml()).expect("Failed to write legacy config");
|
fs::write(&legacy_config_path, mock_config_toml()).expect("Failed to write legacy config");
|
||||||
let legacy_creds_path = legacy_dir.join("credential.json");
|
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
|
// Add environment variables to prevent long hangs during OAuth attempts
|
||||||
let mut env_vars = HashMap::new();
|
let mut env_vars = HashMap::new();
|
||||||
@@ -545,11 +546,12 @@ mod rules_tests {
|
|||||||
// 1. Command succeeds entirely, or
|
// 1. Command succeeds entirely, or
|
||||||
// 2. Fails with auth/credentials error (normal for mock data), or
|
// 2. Fails with auth/credentials error (normal for mock data), or
|
||||||
// 3. Fails but config was found (not "config file not found")
|
// 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 config_processed =
|
||||||
let auth_failure = stderr.contains("credentials") ||
|
!stderr.contains("config file not found") && !stderr.contains("No such file");
|
||||||
stderr.contains("authentication") ||
|
let auth_failure = stderr.contains("credentials")
|
||||||
stderr.contains("OAuth") ||
|
|| stderr.contains("authentication")
|
||||||
stderr.contains("token");
|
|| stderr.contains("OAuth")
|
||||||
|
|| stderr.contains("token");
|
||||||
let credential_issue = stderr.contains("could not read path");
|
let credential_issue = stderr.contains("could not read path");
|
||||||
|
|
||||||
// The main goal is to test that the rules subcommand works and config is processed
|
// 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)
|
// Optional: check for expected error types (but don't require them)
|
||||||
let has_expected_errors = output.status.success() ||
|
let has_expected_errors = output.status.success()
|
||||||
stderr.contains("timeout") ||
|
|| stderr.contains("timeout")
|
||||||
stderr.contains("network") ||
|
|| stderr.contains("network")
|
||||||
stderr.contains("connection") ||
|
|| stderr.contains("connection")
|
||||||
stderr.contains("authentication") ||
|
|| stderr.contains("authentication")
|
||||||
stderr.contains("OAuth") ||
|
|| stderr.contains("OAuth")
|
||||||
stderr.contains("credentials");
|
|| stderr.contains("credentials");
|
||||||
|
|
||||||
// Log additional info for debugging if needed
|
// Log additional info for debugging if needed
|
||||||
if !has_expected_errors {
|
if !has_expected_errors {
|
||||||
@@ -801,7 +803,7 @@ mod error_handling_tests {
|
|||||||
let mut perms = metadata.permissions();
|
let mut perms = metadata.permissions();
|
||||||
perms.set_mode(0o000);
|
perms.set_mode(0o000);
|
||||||
fs::set_permissions(&legacy_config_path, perms).ok()
|
fs::set_permissions(&legacy_config_path, perms).ok()
|
||||||
})
|
}),
|
||||||
];
|
];
|
||||||
restrict_both.iter().any(|result| result.is_some())
|
restrict_both.iter().any(|result| result.is_some())
|
||||||
}
|
}
|
||||||
@@ -822,12 +824,11 @@ mod error_handling_tests {
|
|||||||
if permission_change_worked {
|
if permission_change_worked {
|
||||||
// If permissions were successfully restricted, expect permission-related errors
|
// If permissions were successfully restricted, expect permission-related errors
|
||||||
assert!(
|
assert!(
|
||||||
!output.status.success() && (
|
!output.status.success()
|
||||||
stderr.contains("permission") ||
|
&& (stderr.contains("permission")
|
||||||
stderr.contains("access") ||
|
|| stderr.contains("access")
|
||||||
stderr.contains("denied") ||
|
|| stderr.contains("denied")
|
||||||
stderr.contains("Permission denied")
|
|| stderr.contains("Permission denied")),
|
||||||
),
|
|
||||||
"Expected permission error when config file is unreadable. Exit code: {exit_code}, stderr: {stderr}"
|
"Expected permission error when config file is unreadable. Exit code: {exit_code}, stderr: {stderr}"
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user