mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-04-30 04:35:22 +08:00
Altered test, updated docs
This commit is contained in:
@@ -332,7 +332,7 @@ paths:
|
|||||||
summary: Get trait implementation details
|
summary: Get trait implementation details
|
||||||
description: Determine whether or not a specified trait is implemented (either explicitly or implicitly) within a given contract.
|
description: Determine whether or not a specified trait is implemented (either explicitly or implicitly) within a given contract.
|
||||||
tags:
|
tags:
|
||||||
- Info
|
- Smart Contracts
|
||||||
operationId: get_is_trait_implemented
|
operationId: get_is_trait_implemented
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
|
|||||||
@@ -698,23 +698,27 @@ fn integration_test_get_info() {
|
|||||||
assert!(res.get("reason").is_some());
|
assert!(res.get("reason").is_some());
|
||||||
|
|
||||||
// testing /v2/trait/<contract info>/<trait info>
|
// testing /v2/trait/<contract info>/<trait info>
|
||||||
let path = format!("{}/v2/traits/{}/{}/{}/{}/{}", &http_origin, &contract_addr, "get-info", "dummy-trait", &contract_addr, "get-info");
|
// trait does not exist
|
||||||
|
let path = format!("{}/v2/traits/{}/{}/{}/{}/{}", &http_origin, &contract_addr, "get-info", &contract_addr, "get-info", "dummy-trait");
|
||||||
eprintln!("Test: GET {}", path);
|
eprintln!("Test: GET {}", path);
|
||||||
assert_eq!(client.get(&path).send().unwrap().status(), 404);
|
assert_eq!(client.get(&path).send().unwrap().status(), 404);
|
||||||
|
|
||||||
let path = format!("{}/v2/traits/{}/{}/{}/{}/{}", &http_origin, &contract_addr, "impl-trait-contract", "trait-1", &contract_addr, "get-info");
|
// explicit trait compliance
|
||||||
|
let path = format!("{}/v2/traits/{}/{}/{}/{}/{}", &http_origin, &contract_addr, "impl-trait-contract", &contract_addr, "get-info", "trait-1");
|
||||||
let res = client.get(&path).send().unwrap().json::<GetIsTraitImplementedResponse>().unwrap();
|
let res = client.get(&path).send().unwrap().json::<GetIsTraitImplementedResponse>().unwrap();
|
||||||
eprintln!("Test: GET {}", path);
|
eprintln!("Test: GET {}", path);
|
||||||
assert!(res.is_implemented);
|
assert!(res.is_implemented);
|
||||||
|
|
||||||
let path = format!("{}/v2/traits/{}/{}/{}/{}/{}", &http_origin, &contract_addr, "impl-trait-contract", "trait-2", &contract_addr, "get-info");
|
// implicit trait compliance
|
||||||
|
let path = format!("{}/v2/traits/{}/{}/{}/{}/{}", &http_origin, &contract_addr, "impl-trait-contract", &contract_addr, "get-info", "trait-2");
|
||||||
let res = client.get(&path).send().unwrap().json::<GetIsTraitImplementedResponse>().unwrap();
|
let res = client.get(&path).send().unwrap().json::<GetIsTraitImplementedResponse>().unwrap();
|
||||||
eprintln!("Test: GET {}", path);
|
eprintln!("Test: GET {}", path);
|
||||||
assert!(res.is_implemented);
|
assert!(res.is_implemented);
|
||||||
|
|
||||||
let path = format!("{}/v2/traits/{}/{}/{}/{}/{}", &http_origin, &contract_addr, "impl-trait-contract", "trait-3", &contract_addr, "get-info");
|
// invalid trait compliance
|
||||||
|
let path = format!("{}/v2/traits/{}/{}/{}/{}/{}", &http_origin, &contract_addr, "impl-trait-contract", &contract_addr, "get-info", "trait-3");
|
||||||
eprintln!("Test: GET {}", path);
|
eprintln!("Test: GET {}", path);
|
||||||
assert_eq!(client.get(&path).send().unwrap().status(), 404);
|
assert!(!res.is_implemented);
|
||||||
},
|
},
|
||||||
_ => {},
|
_ => {},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user