-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
118 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,40 @@ | ||
mod common; | ||
|
||
use rstest::*; | ||
use snos::sharp::SharpClient; | ||
use common::os_pie_string; | ||
use rstest::rstest; | ||
use snos::sharp::{CairoJobStatus, InvalidReason, SharpClient, SharpPie}; | ||
|
||
const _TEST_CAIRO_JOB_ID: &str = "3a24bbca-ad75-49d5-8ced-12796c6c0738"; | ||
const NEW_CAIRO_JOB: &str = "59b5138d-4c6e-49d3-9234-6495223acb43"; | ||
#[rstest] | ||
fn sharp_submit_pie(os_pie_string: String) { | ||
let sharp_client = SharpClient::default(); | ||
let submit_resp = sharp_client.submit_pie(SharpPie::EncodedPie(os_pie_string)).unwrap(); | ||
println!("{submit_resp:?}"); | ||
|
||
// #[rstest] | ||
// fn sharp_client_submit(setup_pie: CairoPie) { | ||
// // TODO: implement mocks here, so as to not overwhelm the SHARP | ||
// let sharp_client = SharpClient::default(); | ||
// let submit_resp = sharp_client.submit_pie(setup_pie).unwrap(); | ||
// assert_eq!(submit_resp.cairo_job_key.unwrap().as_bytes().len(), 16); | ||
// } | ||
let job_id = submit_resp.cairo_job_key.unwrap().to_string(); | ||
let status_resp = sharp_client.get_status(&job_id).unwrap(); | ||
println!("RESP: {status_resp:?}"); | ||
} | ||
|
||
#[rstest] | ||
fn sharp_client_status() { | ||
fn sharp_get_status() { | ||
let good_cairo_job_id = "3a24bbca-ad75-49d5-8ced-12796c6c0738"; | ||
|
||
let sharp_client = SharpClient::default(); | ||
let submit_resp = sharp_client.get_status(NEW_CAIRO_JOB).unwrap(); | ||
println!("{submit_resp:?}"); | ||
let status_resp = sharp_client.get_status(good_cairo_job_id).unwrap(); | ||
|
||
assert_eq!(submit_resp.version.unwrap(), 1); | ||
assert!(submit_resp.validation_done.unwrap()); | ||
assert_eq!(1, status_resp.version); | ||
assert_eq!(CairoJobStatus::PROCESSED, status_resp.status); | ||
} | ||
|
||
#[rstest] | ||
fn prove_os_run() { | ||
fn sharp_get_status_err() { | ||
let bad_cairo_job_id = "43454c8e-8f43-444f-aab2-edab05bef512"; | ||
|
||
let sharp_client = SharpClient::default(); | ||
let pie = std::fs::read_to_string("tests/common/data/output_pie.b64").unwrap(); | ||
let submit_resp = sharp_client.submit_pie(snos::sharp::SharPie::EncodedPie(pie)).unwrap(); | ||
println!("{submit_resp:?}"); | ||
let status_resp = sharp_client.get_status(bad_cairo_job_id).unwrap(); | ||
println!("STATUS: {:?}", status_resp); | ||
|
||
assert_eq!(1, status_resp.version); | ||
assert_eq!(CairoJobStatus::INVALID, status_resp.status); | ||
assert_eq!(InvalidReason::SECURITY_CHECK_FAILURE, status_resp.invalid_reason.unwrap()); | ||
} |
Oops, something went wrong.