use crate::services::github_issues::GitHubIssuesService;
use crate::services::pdmt_github_integration::PdmtGitHubService;
pub struct GitHubMcpIntegration;
impl GitHubMcpIntegration {
#[provable_contracts_macros::contract("pmat-core.yaml", equation = "check_compliance")]
pub fn create_github_service(token: &str) -> Result<GitHubIssuesService, String> {
GitHubIssuesService::new(token)
.map_err(|e| format!("Failed to create GitHub service: {}", e))
}
#[provable_contracts_macros::contract("pmat-core.yaml", equation = "check_compliance")]
pub fn create_pdmt_service() -> PdmtGitHubService {
PdmtGitHubService::new()
}
}
#[cfg_attr(coverage_nightly, coverage(off))]
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_github_mcp_integration() {
let integration = GitHubMcpIntegration;
let pdmt_service = GitHubMcpIntegration::create_pdmt_service();
let result = GitHubMcpIntegration::create_github_service("");
assert!(result.is_err());
}
#[test]
fn test_create_pdmt_service() {
let service = GitHubMcpIntegration::create_pdmt_service();
let _ = service;
}
#[test]
fn test_create_github_service_with_empty_token() {
let result = GitHubMcpIntegration::create_github_service("");
assert!(result.is_err());
let err = result.unwrap_err();
assert!(err.contains("Failed to create GitHub service") || err.contains("token"));
}
#[test]
fn test_create_github_service_with_whitespace_token() {
let result = GitHubMcpIntegration::create_github_service(" ");
let _ = result;
}
#[test]
fn test_create_github_service_with_valid_looking_token() {
let result = GitHubMcpIntegration::create_github_service("ghp_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
let _ = result;
}
#[test]
fn test_create_github_service_error_message_format() {
let result = GitHubMcpIntegration::create_github_service("");
if let Err(err) = result {
assert!(err.starts_with("Failed to create GitHub service"));
}
}
#[test]
fn test_github_mcp_integration_struct_exists() {
let _ = GitHubMcpIntegration;
}
#[test]
fn test_pdmt_service_multiple_creations() {
let service1 = GitHubMcpIntegration::create_pdmt_service();
let service2 = GitHubMcpIntegration::create_pdmt_service();
let _ = (service1, service2);
}
}
#[cfg_attr(coverage_nightly, coverage(off))]
#[cfg(test)]
mod property_tests {
use proptest::prelude::*;
proptest! {
#[test]
fn basic_property_stability(_input in ".*") {
prop_assert!(true);
}
#[test]
fn module_consistency_check(_x in 0u32..1000) {
prop_assert!(_x < 1001);
}
}
}