Caplin Trader 5.1.0

Class: module:ct-services/testing/PermissionServiceFixture

module:ct-services/testing/PermissionServiceFixture()

new module:ct-services/testing/PermissionServiceFixture()

Constructs a PermissionServiceFixture.

The PermissionServiceFixture serves to provide a way for tests to interact with the PermissioningService providing trading and view allow or deny permissions on tiles and instruments.

Use of the Fixture assumes that a module:ct-trading/testing/PermissioningServiceStub is registered as a service on the module:ct-core/ServiceRegistry under the namespace "ct-services/security/PermissionService".

Tests may use the PermissionServiceFixture to:

  • deny 1 click spot trading on /FX/GBPUSD when("permissions.deny => ['/FX/GBPUSD', 'TradeProtocol', 'ESP']")
    and("permissions.deny => ['/FX/GBPUSD', 'TradeType', 'SPOT']")
    ...
  • allow view permissions on /FX/GBPUSD when("permissions.allow => ['/FX/GBPUSD', null, 'VIEW']")
    ...
Implements:

Methods

canHandleProperty()

PermissionServiceFixture handles properties 'allow' and 'deny'.

Implements:
See:

doGiven(propertyName, value)

This method is used to inform listeners on the PermissioningService about the permissions change on tile or instruments.

Parameters:
Name Type Description
propertyName String

The property name.

value Variant

The value to check.

Implements:
See:

doThen(propertyName, value)

This method is called in order to assert a property's value on the system under test.

Parameters:
Name Type Description
propertyName String

The property name to assert.

value String

The value to assert.

Implements:

doWhen(propertyName, value)

This method is called in order to manipulate a property on the system under test in a when clause.

Parameters:
Name Type Description
propertyName String

The property to be changed.

value String

The new value of the property.

Implements: