diff options
author | Teddy Wing | 2017-11-17 01:26:13 +0100 |
---|---|---|
committer | Teddy Wing | 2017-11-17 01:26:13 +0100 |
commit | 6a2f2232cb3bd26e512c1383a581544bc0aef731 (patch) | |
tree | a2a71d0e97db2c2432d86349c1ba3f4dc3758ae3 /src/jenkins.rs | |
parent | 5d18b165bca8dea2b0f09b61df2069a4336a4ff2 (diff) | |
download | kipper-6a2f2232cb3bd26e512c1383a581544bc0aef731.tar.bz2 |
jenkins.rs: Add `jenkins_console_url_path()`
A new function that will return the URL to the Jenkins "Console" page
given the URL of a Jenkins job.
We'll be using this to pass with the GitHub status request as the
`target_url`.
Diffstat (limited to 'src/jenkins.rs')
-rw-r--r-- | src/jenkins.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/jenkins.rs b/src/jenkins.rs index 2cd4858..67e6c20 100644 --- a/src/jenkins.rs +++ b/src/jenkins.rs @@ -281,6 +281,10 @@ pub fn result_from_job(status: Option<String>) -> JobStatus { } } +pub fn jenkins_console_url_path(job_url: &String) -> String { + format!("{}console", job_url) +} + fn jenkins_request_client(user_id: &String, token: &String) -> Result<reqwest::Client, Box<Error>> { let credentials = auth_credentials(user_id.to_owned(), token.to_owned()); @@ -446,4 +450,14 @@ mod tests { JobStatus::Pending ); } + + #[test] + fn jenkins_console_url_path_returns_url_to_console_page() { + assert_eq!( + jenkins_console_url_path( + &"https://jenkins.example.com/job/changes-branches/15/".to_owned() + ), + "https://jenkins.example.com/job/changes-branches/15/console" + ); + } } |