-
Notifications
You must be signed in to change notification settings - Fork 0
/
static-demo.feature
67 lines (59 loc) · 1.98 KB
/
static-demo.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
Feature: Demo of viewing and executing static rules
Background:
* url 'http://localhost:9000'
# Example of a static rule that was loaded from a file
Scenario:
Given path '/person/1'
When method GET
Then status 200
And header Content-Type = 'application/json'
And match response == { name : "Homer Simpson", pets : ["Snowball", "Santas Little Helper"]}
# Another example of a static expectation that was loaded from a file
Scenario:
Given path '/hello'
When method GET
Then status 200
And header Content-Type = 'application/txt'
And match response == 'hello world'
# This will fail because there is no rule for handling GET /fubar
Scenario:
Given path '/fubar'
When method GET
Then status 404
# Example scenario of a POST rule from a static file
Scenario:
Given path '/person'
And request "this is ignored for now"
When method post
Then status 201
And response.id == 12345
# Make a call and check that is added to the call history
Scenario:
# Make a call to some random non-existent uri
Given path '/atlantis'
When method GET
Then status 404
# Get the call history
Given path '/_history'
When method GET
Then status 200
And print response
And match response[*].uri contains '/atlantis'
Scenario: Get all the rules
Given path '/_rules'
When method GET
Then status 200
And header Content-Type = 'application/json'
And match response == '#[]'
* def req = response[0].request
* def resp = response[0].response
And match req == { method : '#string', uri : '#string' }
And match resp == { headers : '##object', body : '#present', status : '#number' }
Scenario: Get the details of a particular rule
Given path '/_rule/1'
When method GET
Then status 200
* def res = response.response
And match res.body == "hello world"
And match res.status == 200
And match res.headers == { "Content-Type": "application/txt" }