diff --git a/libindy/tests/ledger.rs b/libindy/tests/ledger.rs index b20ee0afff..5c6f9ff82b 100644 --- a/libindy/tests/ledger.rs +++ b/libindy/tests/ledger.rs @@ -42,7 +42,7 @@ use self::openssl::hash::{MessageDigest, Hasher}; use self::sodiumoxide::crypto::secretbox; use utils::domain::anoncreds::schema::{Schema, SchemaV1}; -use utils::domain::anoncreds::credential_definition::{CredentialDefinitionV1}; +use utils::domain::anoncreds::credential_definition::CredentialDefinitionV1; use utils::domain::anoncreds::revocation_registry_definition::RevocationRegistryDefinitionV1; use utils::domain::anoncreds::revocation_registry::RevocationRegistryV1; use utils::domain::anoncreds::revocation_registry_delta::RevocationRegistryDeltaV1; @@ -808,18 +808,19 @@ mod high_cases { "primary":{ "n":"1", "s":"2", - "rms":"3", - "r":{"name":"1"}, + "r":{"name":"1","master_secret":"3"}, "rctxt":"1", "z":"1" } } }"#; - let expected_result = r#""operation":{"ref":1,"data":{"primary":{"n":"1","s":"2","rms":"3","r":{"name":"1"},"rctxt":"1","z":"1"}},"type":"102","signature_type":"CL","tag":"TAG_1"}"#; + let expected_result = r#"{"ref":1,"data":{"primary":{"n":"1","s":"2","r":{"name":"1","master_secret":"3"},"rctxt":"1","z":"1"}},"type":"102","signature_type":"CL","tag":"TAG_1"}"#; let cred_def_request = LedgerUtils::build_cred_def_txn(IDENTIFIER, cred_def_json).unwrap(); - assert!(cred_def_request.contains(&expected_result)); + + assert_eq!(serde_json::from_str::(&cred_def_request).unwrap()["operation"].as_object().unwrap(), + serde_json::from_str::(&expected_result).unwrap().as_object().unwrap()); } #[test] diff --git a/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Ledger/LedgerBuildRequest.mm b/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Ledger/LedgerBuildRequest.mm index a9c62c9f81..330d6043ea 100644 --- a/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Ledger/LedgerBuildRequest.mm +++ b/wrappers/ios/libindy-pod/Indy-demoTests/Case Tests/Ledger/LedgerBuildRequest.mm @@ -223,8 +223,7 @@ - (void)testBuildCredDefRequestWorksForCorrectDataJson { @"primary": @{ @"n": @"1", @"s": @"2", - @"rms": @"3", - @"r": @{@"height": @"1"}, + @"r": @{@"height": @"1",@"master_secret": @"1"}, @"rctxt": @"1", @"z": @"1" } diff --git a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/CredDefRequestsTest.java b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/CredDefRequestsTest.java index 2aa4f78f61..61147f87ac 100644 --- a/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/CredDefRequestsTest.java +++ b/wrappers/java/src/test/java/org/hyperledger/indy/sdk/ledger/CredDefRequestsTest.java @@ -10,6 +10,7 @@ import java.util.concurrent.TimeUnit; import static org.hamcrest.CoreMatchers.isA; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; public class CredDefRequestsTest extends LedgerIntegrationTest { @@ -29,18 +30,17 @@ public void testBuildCredDefRequestWorks() throws Exception { " \"primary\": {\n" + " \"n\": \"1\",\n" + " \"s\": \"2\",\n" + - " \"rms\": \"3\",\n" + - " \"r\": {\"name\": \"1\"},\n" + + " \"r\": {\"name\": \"1\",\"master_secret\": \"3\"},\n" + " \"rctxt\": \"1\",\n" + " \"z\": \"1\"\n" + " }\n" + " }\n" + " }"; - String expectedResult = "\"operation\": {\n" + + String expectedResult = "{\n" + " \"ref\": 1,\n" + " \"data\": {\n" + - " \"primary\": {\"n\": \"1\", \"s\": \"2\", \"rms\": \"3\", \"r\": {\"name\": \"1\"}, \"rctxt\": \"1\", \"z\": \"1\"}\n" + + " \"primary\": {\"n\": \"1\", \"s\": \"2\", \"r\": {\"name\": \"1\",\"master_secret\": \"3\"}, \"rctxt\": \"1\", \"z\": \"1\"}\n" + " },\n" + " \"type\": \"102\",\n" + " \"signature_type\": \"CL\",\n" + @@ -49,7 +49,7 @@ public void testBuildCredDefRequestWorks() throws Exception { String credDefRequest = Ledger.buildCredDefRequest(DID, data).get(); - assertTrue(credDefRequest.replaceAll("\\s+", "").contains(expectedResult.replaceAll("\\s+", ""))); + assertTrue(new JSONObject(credDefRequest).getJSONObject("operation").similar(new JSONObject(expectedResult))); } @Test diff --git a/wrappers/python/tests/ledger/test_build_cred_def_request.py b/wrappers/python/tests/ledger/test_build_cred_def_request.py index 9cca8fca57..600f633a43 100644 --- a/wrappers/python/tests/ledger/test_build_cred_def_request.py +++ b/wrappers/python/tests/ledger/test_build_cred_def_request.py @@ -16,8 +16,7 @@ async def test_build_cred_def_request_works_for_correct_data_json(did_trustee): "primary": { "n": "1", "s": "2", - "rms": "3", - "r": {"name": "1"}, + "r": {"name": "1", "master_secret": "3"}, "rctxt": "1", "z": "1" } @@ -29,7 +28,7 @@ async def test_build_cred_def_request_works_for_correct_data_json(did_trustee): "operation": { "ref": 1, "data": { - "primary": {"n": "1", "s": "2", "rms": "3", "r": {"name": "1"}, "rctxt": "1", "z": "1"} + "primary": {"n": "1", "s": "2", "r": {"name": "1", "master_secret": "3"}, "rctxt": "1", "z": "1"} }, "type": "102", "signature_type": "CL",