Search in sources :

Example 1 with MockEnrollment

use of org.hyperledger.fabric.sdk.testutils.TestUtils.MockEnrollment in project fabric-sdk-java by hyperledger.

the class ClientTest method testBadEnrollmentBadKey.

@Test(expected = InvalidArgumentException.class)
public void testBadEnrollmentBadKey() throws Exception {
    HFClient client = HFClient.createNewInstance();
    client.setCryptoSuite(CryptoSuite.Factory.getCryptoSuite());
    MockUser mockUser = TestUtils.getMockUser(USER_NAME, USER_MSP_ID);
    MockEnrollment mockEnrollment = TestUtils.getMockEnrollment(null, "mockCert");
    mockUser.setEnrollment(mockEnrollment);
    client.setUserContext(mockUser);
}
Also used : MockEnrollment(org.hyperledger.fabric.sdk.testutils.TestUtils.MockEnrollment) MockUser(org.hyperledger.fabric.sdk.testutils.TestUtils.MockUser) Test(org.junit.Test)

Example 2 with MockEnrollment

use of org.hyperledger.fabric.sdk.testutils.TestUtils.MockEnrollment in project fabric-sdk-java by hyperledger.

the class ClientTest method testCryptoFactory.

// (expected = InvalidArgumentException.class)
@Test
@Ignore
public void testCryptoFactory() throws Exception {
    try {
        resetConfig();
        Assert.assertNotNull(Config.getConfig().getDefaultCryptoSuiteFactory());
        HFClient client = HFClient.createNewInstance();
        client.setCryptoSuite(CryptoSuite.Factory.getCryptoSuite());
        MockUser mockUser = TestUtils.getMockUser(USER_NAME, USER_MSP_ID);
        MockEnrollment mockEnrollment = TestUtils.getMockEnrollment(null, "mockCert");
        mockUser.setEnrollment(mockEnrollment);
        client.setUserContext(mockUser);
    } finally {
        System.getProperties().remove("org.hyperledger.fabric.sdk.crypto.default_crypto_suite_factory");
    }
}
Also used : MockEnrollment(org.hyperledger.fabric.sdk.testutils.TestUtils.MockEnrollment) MockUser(org.hyperledger.fabric.sdk.testutils.TestUtils.MockUser) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 3 with MockEnrollment

use of org.hyperledger.fabric.sdk.testutils.TestUtils.MockEnrollment in project fabric-sdk-java by hyperledger.

the class ClientTest method testBadEnrollmentBadCert.

@Test(expected = InvalidArgumentException.class)
public void testBadEnrollmentBadCert() throws Exception {
    HFClient client = HFClient.createNewInstance();
    client.setCryptoSuite(CryptoSuite.Factory.getCryptoSuite());
    MockUser mockUser = TestUtils.getMockUser(USER_NAME, USER_MSP_ID);
    MockEnrollment mockEnrollment = TestUtils.getMockEnrollment(null);
    mockUser.setEnrollment(mockEnrollment);
    client.setUserContext(mockUser);
}
Also used : MockEnrollment(org.hyperledger.fabric.sdk.testutils.TestUtils.MockEnrollment) MockUser(org.hyperledger.fabric.sdk.testutils.TestUtils.MockUser) Test(org.junit.Test)

Aggregations

MockEnrollment (org.hyperledger.fabric.sdk.testutils.TestUtils.MockEnrollment)3 MockUser (org.hyperledger.fabric.sdk.testutils.TestUtils.MockUser)3 Test (org.junit.Test)3 Ignore (org.junit.Ignore)1