use of org.hyperledger.fabric_ca.sdk.MockHFCAClient in project fabric-sdk-java by hyperledger.
the class HFCAClientIT method testMockEnrollNoCert.
@Ignore
@Test
public void testMockEnrollNoCert() throws Exception {
thrown.expect(EnrollmentException.class);
thrown.expectMessage("failed enrollment for user");
MockHFCAClient mockClient = MockHFCAClient.createNewInstance(testConfig.getIntegrationTestsSampleOrg(TEST_WITH_INTEGRATION_ORG).getCALocation(), testConfig.getIntegrationTestsSampleOrg(TEST_WITH_INTEGRATION_ORG).getCAProperties());
mockClient.setCryptoSuite(crypto);
SampleUser user = getEnrolledUser(TEST_ADMIN_ORG);
mockClient.setHttpPostResponse("{\"success\":true}");
mockClient.enroll(user.getName(), user.getEnrollmentSecret());
}
use of org.hyperledger.fabric_ca.sdk.MockHFCAClient in project fabric-sdk-java by hyperledger.
the class HFCAClientIT method testMockReenrollNoResult.
@Test
public void testMockReenrollNoResult() throws Exception {
thrown.expect(EnrollmentException.class);
// thrown.expectMessage("failed");
MockHFCAClient mockClient = MockHFCAClient.createNewInstance(testConfig.getIntegrationTestsSampleOrg(TEST_WITH_INTEGRATION_ORG).getCALocation(), testConfig.getIntegrationTestsSampleOrg(TEST_WITH_INTEGRATION_ORG).getCAProperties());
mockClient.setCryptoSuite(crypto);
SampleUser user = getEnrolledUser(TEST_ADMIN_ORG);
mockClient.setHttpPostResponse("{\"success\":true}");
mockClient.reenroll(user);
}
use of org.hyperledger.fabric_ca.sdk.MockHFCAClient in project fabric-sdk-java by hyperledger.
the class HFCAClientIT method testMockEnrollNoResult.
@Test
public void testMockEnrollNoResult() throws Exception {
thrown.expect(EnrollmentException.class);
thrown.expectMessage("response did not contain a result");
MockHFCAClient mockClient = MockHFCAClient.createNewInstance(testConfig.getIntegrationTestsSampleOrg(TEST_WITH_INTEGRATION_ORG).getCALocation(), testConfig.getIntegrationTestsSampleOrg(TEST_WITH_INTEGRATION_ORG).getCAProperties());
mockClient.setCryptoSuite(crypto);
SampleUser user = getEnrolledUser(TEST_ADMIN_ORG);
mockClient.setHttpPostResponse("{\"success\":true}");
mockClient.enroll(user.getName(), user.getEnrollmentSecret());
}
use of org.hyperledger.fabric_ca.sdk.MockHFCAClient in project fabric-sdk-java by hyperledger.
the class HFCAClientIT method testMockEnrollSuccessFalse.
@Test
public void testMockEnrollSuccessFalse() throws Exception {
thrown.expect(EnrollmentException.class);
thrown.expectMessage("failed enrollment for user");
MockHFCAClient mockClient = MockHFCAClient.createNewInstance(testConfig.getIntegrationTestsSampleOrg(TEST_WITH_INTEGRATION_ORG).getCALocation(), testConfig.getIntegrationTestsSampleOrg(TEST_WITH_INTEGRATION_ORG).getCAProperties());
mockClient.setCryptoSuite(crypto);
SampleUser user = getEnrolledUser(TEST_ADMIN_ORG);
mockClient.setHttpPostResponse("{\"success\":false}");
mockClient.enroll(user.getName(), user.getEnrollmentSecret());
}
use of org.hyperledger.fabric_ca.sdk.MockHFCAClient in project fabric-sdk-java by hyperledger.
the class HFCAClientIT method testMockEnrollWithMessages.
@Test
public void testMockEnrollWithMessages() throws Exception {
MockHFCAClient mockClient = MockHFCAClient.createNewInstance(testConfig.getIntegrationTestsSampleOrg(TEST_WITH_INTEGRATION_ORG).getCALocation(), testConfig.getIntegrationTestsSampleOrg(TEST_WITH_INTEGRATION_ORG).getCAProperties());
mockClient.setCryptoSuite(crypto);
SampleUser user = getEnrolledUser(TEST_ADMIN_ORG);
mockClient.setHttpPostResponse("{\"success\":true, \"result\":{\"Cert\":\"abc\"}, \"messages\":[{\"code\":123, \"message\":\"test message\"}]}");
mockClient.enroll(user.getName(), user.getEnrollmentSecret());
}
Aggregations