How to use the fabric-ca-client/lib/IdentityService.js function in fabric-ca-client

To help you get started, we’ve selected a few fabric-ca-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hyperledger / fabric-sdk-node / test / unit / identity-service.js View on Github external
test('IdentityService: Test delete() function', (t) => {
	const client = new FabricCAClient({ protocol: 'http', hostname: '127.0.0.1', port: 7054 });
	const identity = new IdentityService(client);

	t.throws(() => {
		identity.delete();
	},
	/Missing required argument "enrollmentID", or argument "enrollmentID" is not a valid string/,
	'Must fail if missing or invalid enrollmentID argument');

	t.throws(() => {
		identity.delete('enrollmentID');
	},
	/Missing required argument "registrar"/,
	'Must fail if missing registrar argument');

	t.throws(() => {
		identity.delete('enrollmentID', {});
	},
github hyperledger / fabric-sdk-node / test / unit / identity-service.js View on Github external
test('IdentityService: Test getOne() function', (t) => {
	const client = new FabricCAClient({ protocol: 'http', hostname: '127.0.0.1', port: 7054 });
	const identity = new IdentityService(client);

	t.throws(() => {
		identity.getOne();
	},
	/Missing required argument "enrollmentID", or argument "enrollmentID" is not a valid string/,
	'Must fail if missing or invalid enrollmentID argument');

	t.throws(() => {
		identity.getOne('enrollmentID');
	},
	/Missing required argument "registrar"/,
	'Must fail if missing registrar argument');

	t.throws(() => {
		identity.getOne('enrollmentID', {});
	},
github hyperledger / fabric-sdk-node / test / unit / identity-service.js View on Github external
test('IdentityService: Test getAll() function', (t) => {
	const client = new FabricCAClient({ protocol: 'http', hostname: '127.0.0.1', port: 7054 });
	const identity = new IdentityService(client);

	t.throws(() => {
		identity.getAll();
	},
	/Missing required argument "registrar"/,
	'Must fail if missing registrar argument');

	t.throws(() => {
		identity.getAll({});
	},
	/Argument "registrar" must be an instance of the class "User"/,
	'Must fail if registrar argument is not a User object');

	t.throws(() => {
		const registrar = new User('bob');
		identity.getAll(registrar);
github hyperledger / fabric-sdk-node / test / unit / identity-service.js View on Github external
test('IdentityService: Test create() function', (t) => {
	const client = new FabricCAClient({ protocol: 'http', hostname: '127.0.0.1', port: 7054 });
	const identity = new IdentityService(client);

	t.throws(() => {
		identity.create();
	},
	/Missing required argument "req"/,
	'Must fail if missing request argument');

	t.throws(() => {
		identity.create({ enrollmentID: null });
	},
	/Missing required parameters. "req.enrollmentID", "req.affiliation" are all required./,
	'Must fail if missing req.enrollmentID and req.affiliation argument');

	t.throws(() => {
		identity.create({ enrollmentID: 'dummy', affiliation: 'dummy' });
	},
github hyperledger / fabric-sdk-node / test / unit / identity-service.js View on Github external
test('IdentityService: Test update() function', (t) => {
	const client = new FabricCAClient({ protocol: 'http', hostname: '127.0.0.1', port: 7054 });
	const identity = new IdentityService(client);

	t.throws(() => {
		identity.update();
	},
	/Missing required argument "enrollmentID", or argument "enrollmentID" is not a valid string/,
	'Must fail if missing or invalid enrollmentID argument');

	t.throws(() => {
		identity.update('enrollmentID', {});
	},
	/Missing required argument "registrar"/,
	'Must fail if missing registrar argument');

	t.throws(() => {
		identity.update('enrollmentID', {}, {});
	},