244 lines
7.6 KiB
YAML
244 lines
7.6 KiB
YAML
# These test run against the Events API with data preloaded into the datastore.
|
|
fixtures:
|
|
- ConfigFixture
|
|
- EventDataFixture
|
|
|
|
tests:
|
|
|
|
# this attempts to get all the events and checks to make sure they are valid
|
|
- name: get all events
|
|
url: /v2/events
|
|
request_headers:
|
|
X-Roles: admin
|
|
X-User-Id: user1
|
|
X-Project-Id: project1
|
|
response_headers:
|
|
content-type: application/json; charset=UTF-8
|
|
verbose: True
|
|
response_json_paths:
|
|
$[/event_type].[0].event_type: cookies_chocolate.chip
|
|
$[/event_type].[0].traits[/value].[0].value: '0'
|
|
$[/event_type].[0].traits[/value].[1].value: chocolate.chip
|
|
$[/event_type].[0].raw.nested.inside: value
|
|
$[/event_type].[1].event_type: cookies_peanut.butter
|
|
$[/event_type].[1].traits[/name].[0].name: ate
|
|
$[/event_type].[1].traits[/name].[1].name: type
|
|
$[/event_type].[1].raw.nested.inside: value
|
|
$[/event_type].[2].event_type: cookies_sugar
|
|
$[/event_type].[2].traits[/type].[0].type: integer
|
|
$[/event_type].[2].traits[/type].[1].type: string
|
|
$[/event_type].[2].raw.nested.inside: value
|
|
|
|
# this attempts to get all the events with invalid parameters and expects a 400
|
|
- name: get events with bad params
|
|
url: /v2/events?bad_Stuff_here
|
|
request_headers:
|
|
X-Roles: admin
|
|
X-User-Id: user1
|
|
X-Project-Id: project1
|
|
status: 400
|
|
|
|
# this attempts to query the events with the correct parameterized query syntax
|
|
# and expects a matching event
|
|
- name: get events that match query
|
|
url: /v2/events?q.field=event_type&q.op=eq&q.type=string&q.value=cookies_chocolate.chip
|
|
request_headers:
|
|
X-Roles: admin
|
|
X-User-Id: user1
|
|
X-Project-Id: project1
|
|
response_headers:
|
|
content-type: application/json; charset=UTF-8
|
|
response_json_paths:
|
|
$[/event_type].[0].event_type: cookies_chocolate.chip
|
|
$[/event_type].[0].traits[/value].[1].value: chocolate.chip
|
|
|
|
# this attempts to query the events with the correct data query syntax and
|
|
# expects a matching event
|
|
- name: get events that match query via data
|
|
url: /v2/events
|
|
request_headers:
|
|
content-type: application/json; charset=UTF-8
|
|
X-Roles: admin
|
|
X-User-Id: user1
|
|
X-Project-Id: project1
|
|
data:
|
|
q:
|
|
- field: event_type
|
|
op: eq
|
|
type: string
|
|
value: cookies_chocolate.chip
|
|
response_headers:
|
|
content-type: application/json; charset=UTF-8
|
|
response_json_paths:
|
|
$[/event_type].[0].event_type: cookies_chocolate.chip
|
|
$[/event_type].[0].traits[/value].[1].value: chocolate.chip
|
|
|
|
# this attempts to query the events with the correct parameterized query syntax
|
|
# but a bad field name and expects an empty list
|
|
- name: get events that match bad query
|
|
url: /v2/events?q.field=bad_field&q.op=eq&q.type=string&q.value=cookies_chocolate.chip
|
|
request_headers:
|
|
X-Roles: admin
|
|
X-User-Id: user1
|
|
X-Project-Id: project1
|
|
response_headers:
|
|
content-type: application/json; charset=UTF-8
|
|
response_strings:
|
|
- "[]"
|
|
|
|
# this attempts to query the events with the correct data query syntax and
|
|
# a bad field name and expects an empty list
|
|
- name: get events that match bad query via data
|
|
url: /v2/events
|
|
request_headers:
|
|
content-type: application/json; charset=UTF-8
|
|
X-Roles: admin
|
|
X-User-Id: user1
|
|
X-Project-Id: project1
|
|
data:
|
|
q:
|
|
- field: bad_field
|
|
op: eq
|
|
type: string
|
|
value: cookies_chocolate.chip
|
|
response_headers:
|
|
content-type: application/json; charset=UTF-8
|
|
response_strings:
|
|
- "[]"
|
|
|
|
# this attempts to query the events with the wrong data query syntax missing the
|
|
# q object but supplying the field list and a bad field name and expects a 400
|
|
- name: get events that match bad query via data list
|
|
url: /v2/events
|
|
request_headers:
|
|
content-type: application/json; charset=UTF-8
|
|
X-Roles: admin
|
|
X-User-Id: user1
|
|
X-Project-Id: project1
|
|
data:
|
|
- field: bad_field
|
|
op: eq
|
|
type: string
|
|
value: cookies_chocolate.chip
|
|
status: 400
|
|
|
|
# Get a single event by message_id should return an event
|
|
- name: get a single event
|
|
url: /v2/events/fea1b15a-1d47-4175-85a5-a4bb2c729240
|
|
request_headers:
|
|
X-Roles: admin
|
|
X-User-Id: user1
|
|
X-Project-Id: project1
|
|
response_headers:
|
|
content-type: application/json; charset=UTF-8
|
|
response_json_paths:
|
|
$.event_type: cookies_chocolate.chip
|
|
$.traits[/value].[0].value: '0'
|
|
$.traits[/value].[1].value: chocolate.chip
|
|
|
|
# Get a single event by message_id no data is present so should return a 404
|
|
- name: get a single event that does not exist
|
|
url: /v2/events/bad-id
|
|
request_headers:
|
|
X-Roles: admin
|
|
X-User-Id: user1
|
|
X-Project-Id: project1
|
|
status: 404
|
|
|
|
# Get all the event types should return a list of event types
|
|
- name: get all event types
|
|
url: /v2/event_types
|
|
request_headers:
|
|
X-Roles: admin
|
|
X-User-Id: user1
|
|
X-Project-Id: project1
|
|
response_headers:
|
|
content-type: application/json; charset=UTF-8
|
|
response_strings:
|
|
- cookies_chocolate.chip
|
|
- cookies_peanut.butter
|
|
- cookies_sugar
|
|
|
|
# Get a single event type by valid name, this API is unused and should return a 404
|
|
- name: get event types for good event_type unused api
|
|
url: /v2/event_types/cookies_chocolate.chip
|
|
request_headers:
|
|
X-Roles: admin
|
|
X-User-Id: user1
|
|
X-Project-Id: project1
|
|
status: 404
|
|
|
|
# Get a single event type by invalid name, this API is unused and should return a 404
|
|
- name: get event types for bad event_type unused api
|
|
url: /v2/event_types/bad_event_type
|
|
request_headers:
|
|
X-Roles: admin
|
|
X-User-Id: user1
|
|
X-Project-Id: project1
|
|
status: 404
|
|
|
|
# Get all traits for a valid event type should return an list of traits
|
|
- name: get all traits for event type
|
|
url: /v2/event_types/cookies_chocolate.chip/traits
|
|
request_headers:
|
|
X-Roles: admin
|
|
X-User-Id: user1
|
|
X-Project-Id: project1
|
|
response_headers:
|
|
content-type: application/json; charset=UTF-8
|
|
response_json_paths:
|
|
$.[0].type: string
|
|
$.[1].name: ate
|
|
|
|
# Get all traits for an invalid event type should return an empty list
|
|
- name: get all traits names for event type bad event type
|
|
url: /v2/event_types/bad_event_type/traits
|
|
request_headers:
|
|
X-Roles: admin
|
|
X-User-Id: user1
|
|
X-Project-Id: project1
|
|
response_headers:
|
|
content-type: application/json; charset=UTF-8
|
|
response_strings:
|
|
- "[]"
|
|
|
|
# Get all traits of type ate for a valid event type should return an list of
|
|
# traits
|
|
- name: get all traits of type ate for event type
|
|
url: /v2/event_types/cookies_chocolate.chip/traits/ate
|
|
request_headers:
|
|
X-Roles: admin
|
|
X-User-Id: user1
|
|
X-Project-Id: project1
|
|
response_headers:
|
|
content-type: application/json; charset=UTF-8
|
|
response_json_paths:
|
|
$.[0].name: ate
|
|
$.[0].value: '0'
|
|
|
|
# Get all traits of type ate for an invalid event type should return an empty
|
|
# list
|
|
- name: get all traits of type for event type bad event type
|
|
url: /v2/event_types/bad_event_type/traits/ate
|
|
request_headers:
|
|
X-Roles: admin
|
|
X-User-Id: user1
|
|
X-Project-Id: project1
|
|
response_headers:
|
|
content-type: application/json; charset=UTF-8
|
|
response_strings:
|
|
- "[]"
|
|
|
|
# Get all traits of type bad_trait_name for a valid event type should return an
|
|
# empty list
|
|
- name: get all traits of type instances for event type bad trait name
|
|
url: /v2/event_types/cookies_chocolate.chip/traits/bad_trait_name
|
|
request_headers:
|
|
X-Roles: admin
|
|
X-User-Id: user1
|
|
X-Project-Id: project1
|
|
response_headers:
|
|
content-type: application/json; charset=UTF-8
|
|
response_strings:
|
|
- "[]"
|