Documentation ¶
Overview ¶
bdd contains feature context utils.
Index ¶
- Constants
- func GetApiURL() (*url.URL, error)
- type AmqpClient
- func (c *AmqpClient) ICallRPCAxeRequest(eid string, doc *messages.PickleStepArgument_PickleDocString) error
- func (c *AmqpClient) ICallRPCWebhookRequest(eid string, doc *messages.PickleStepArgument_PickleDocString) error
- func (c *AmqpClient) IWaitTheEndOfEventProcessing() error
- func (c *AmqpClient) IWaitTheEndOfEventsProcessing(count int) error
- func (c *AmqpClient) Reset(_ *messages.Pickle)
- type ApiClient
- func (a *ApiClient) IAm(role string) error
- func (a *ApiClient) IAmAuthenticatedByApiKey(apiKey string) error
- func (a *ApiClient) IAmAuthenticatedByBasicAuth(username, password string) error
- func (a *ApiClient) IDoRequest(method, uri string) error
- func (a *ApiClient) IDoRequestWithBody(method, uri string, doc *messages.PickleStepArgument_PickleDocString) error
- func (a *ApiClient) ISaveResponse(key, value string) error
- func (a *ApiClient) ISendAnEvent(doc *messages.PickleStepArgument_PickleDocString) (err error)
- func (a *ApiClient) ResetResponse(_ *messages.Pickle)
- func (a *ApiClient) SetRequestContentType(contentType string) error
- func (a *ApiClient) TheResponseBodyShouldBe(doc *messages.PickleStepArgument_PickleDocString) error
- func (a *ApiClient) TheResponseBodyShouldContain(doc *messages.PickleStepArgument_PickleDocString) error
- func (a *ApiClient) TheResponseCodeShouldBe(code int) error
- func (a *ApiClient) TheResponseKeyShouldNotBe(path, value string) error
- func (a *ApiClient) TheResponseKeyShouldNotExist(path string) error
- func (a *ApiClient) TheResponseRawBodyShouldBe(doc *messages.PickleStepArgument_PickleDocString) error
- type MongoClient
Constants ¶
const ApiEnvURL = "API_URL"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AmqpClient ¶
type AmqpClient struct {
// contains filtered or unexported fields
}
AmqpClient represents utility struct which implements AMQP steps to feature context.
func NewAmqpClient ¶
func NewAmqpClient( exchange, key string, encoder encoding.Encoder, decoder encoding.Decoder, eventLogger zerolog.Logger, ) (*AmqpClient, error)
NewAmqpClient creates new AMQP client.
func (*AmqpClient) ICallRPCAxeRequest ¶
func (c *AmqpClient) ICallRPCAxeRequest(eid string, doc *messages.PickleStepArgument_PickleDocString) error
* Step example:
When I call RPC request to engine-axe with alarm resource/component: """ { "event_type": "ack" } """
func (*AmqpClient) ICallRPCWebhookRequest ¶
func (c *AmqpClient) ICallRPCWebhookRequest(eid string, doc *messages.PickleStepArgument_PickleDocString) error
* Step example:
When I call RPC request to engine-webhook with alarm resource/component: """ { "request": { "method": "POST", "url": "http://test-url.com" } } """
func (*AmqpClient) IWaitTheEndOfEventProcessing ¶
func (c *AmqpClient) IWaitTheEndOfEventProcessing() error
* Step example:
When I wait the end of event processing
func (*AmqpClient) IWaitTheEndOfEventsProcessing ¶
func (c *AmqpClient) IWaitTheEndOfEventsProcessing(count int) error
* Step example:
When I wait the end of 2 events processing
func (*AmqpClient) Reset ¶
func (c *AmqpClient) Reset(_ *messages.Pickle)
type ApiClient ¶
type ApiClient struct {
// contains filtered or unexported fields
}
ApiClient represents utility struct which implements API steps to feature context.
func (*ApiClient) IAmAuthenticatedByApiKey ¶
* Step example:
When I am authenticated with api key "key"
func (*ApiClient) IAmAuthenticatedByBasicAuth ¶
* Step example:
When I am authenticated with username "user" password "pass"
func (*ApiClient) IDoRequest ¶
* Step example:
When I do GET /api/v4/alarms When I do GET /api/v4/entitybasic/{{ .lastResponse._id}}
func (*ApiClient) IDoRequestWithBody ¶
func (a *ApiClient) IDoRequestWithBody(method, uri string, doc *messages.PickleStepArgument_PickleDocString) error
* Step example:
When I do POST /api/v4/event: """ { "connector" : "test_post_connector", "connector_name" : "test_post_connector_name", "source_type" : "resource", "event_type" : "check", "component" : "test_post_component", "resource" : "test_post_resource", "state" : 1, "output" : "noveo alarm" } """ When I do PUT /api/v4/entitybasics/{{ .lastResponse._id}}: """ { "state": 1 } """
func (*ApiClient) ISendAnEvent ¶
* Step example:
When I send an event: """ { "connector" : "test_post_connector", "connector_name" : "test_post_connector_name", "source_type" : "resource", "event_type" : "check", "component" : "test_post_component", "resource" : "test_post_resource", "state" : 1, "output" : "noveo alarm" } """
func (*ApiClient) ResetResponse ¶
func (a *ApiClient) ResetResponse(_ *messages.Pickle)
ResetResponse clears all saved response data.
func (*ApiClient) SetRequestContentType ¶
* Step example:
func (*ApiClient) TheResponseBodyShouldBe ¶
* Step example:
Then the response body should be: """ { "_id": "441d896b-c0bd-40f4-9926-0568f4a94ec7", "name": "Test name", "created": 1603882800 } """
func (*ApiClient) TheResponseBodyShouldContain ¶
func (a *ApiClient) TheResponseBodyShouldContain(doc *messages.PickleStepArgument_PickleDocString) error
* If some fields are not defined in step content they are ignored.
Step example:
Then the response body should contain: """ { "name": "Test name" } """
func (*ApiClient) TheResponseKeyShouldNotBe ¶
* Step example:
Then the response key "data.0.created_at" should not be "0"
func (*ApiClient) TheResponseKeyShouldNotExist ¶
* Step example:
Then the response key "data.0.created_at" should not exist
func (*ApiClient) TheResponseRawBodyShouldBe ¶
func (a *ApiClient) TheResponseRawBodyShouldBe(doc *messages.PickleStepArgument_PickleDocString) error
* Step example:
Then the response raw body should be: """ Test """
type MongoClient ¶
type MongoClient struct {
// contains filtered or unexported fields
}
MongoClient represents utility struct which implements db steps to feature context.
func NewMongoClient ¶
func NewMongoClient() (*MongoClient, error)
NewMongoClient creates new mongo client.
func (*MongoClient) AlarmShouldBeInTheDb ¶
func (c *MongoClient) AlarmShouldBeInTheDb(eid string) error
* Step example:
And an alarm test_post_resource/test_post_component should be in the db
func (*MongoClient) EntityShouldBeInTheDb ¶
func (c *MongoClient) EntityShouldBeInTheDb(eid string) error
* Step example:
And an entity test_post_resource/test_post_component should be in the db