mirage 2.4.2 → 3.0.0.alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.simplecov +6 -0
- data/Gemfile +11 -3
- data/Gemfile.lock +41 -14
- data/VERSION +1 -1
- data/features/client/clear.feature +41 -50
- data/features/client/configure.feature +2 -2
- data/features/client/put.feature +17 -6
- data/features/client/requests.feature +5 -9
- data/features/client/start.feature +19 -11
- data/features/client/stop.feature +10 -44
- data/features/server/commandline_interface/start.feature +2 -14
- data/features/server/commandline_interface/stop.feature +6 -4
- data/features/server/logging.feature +2 -2
- data/features/server/prime.feature +11 -66
- data/features/server/requests/delete.feature +34 -33
- data/features/server/requests/get.feature +21 -18
- data/features/server/save_and_revert.feature +24 -11
- data/features/server/templates/delete.feature +29 -32
- data/features/server/templates/get.feature +44 -25
- data/features/server/templates/put/put.feature +55 -78
- data/features/server/templates/put/put_with_substitutions.feature +12 -32
- data/features/server/templates/put/required_content.feature +118 -0
- data/features/step_definitions/my_steps.rb +51 -6
- data/features/support/env.rb +1 -1
- data/features/support/hooks.rb +2 -5
- data/{lib/mirage/client → features/support}/web.rb +14 -3
- data/lib/mirage/client.rb +5 -2
- data/lib/mirage/client/client.rb +22 -129
- data/lib/mirage/client/request.rb +25 -0
- data/lib/mirage/client/requests.rb +13 -0
- data/lib/mirage/client/runner.rb +4 -4
- data/lib/mirage/client/template.rb +108 -0
- data/lib/mirage/client/template_configuration.rb +22 -0
- data/lib/mirage/client/templates.rb +26 -0
- data/mirage.gemspec +42 -22
- data/mirage_server.rb +1 -135
- data/rakefile +22 -7
- data/server/app.rb +4 -0
- data/server/binary_data_checker.rb +15 -0
- data/server/helpers.rb +28 -0
- data/server/mock_response.rb +140 -58
- data/server/server.rb +167 -0
- data/spec/{cli_bridge_spec.rb → client/cli_bridge_spec.rb} +15 -11
- data/spec/client/client_spec.rb +139 -0
- data/spec/client/request_spec.rb +52 -0
- data/spec/client/requests_spec.rb +10 -0
- data/spec/{runner_spec.rb → client/runner_spec.rb} +3 -3
- data/spec/client/template_configuration_spec.rb +32 -0
- data/spec/client/template_spec.rb +241 -0
- data/spec/client/templates_spec.rb +79 -0
- data/spec/resources/binary.file +0 -0
- data/spec/server/binary_data_checker_spec.rb +22 -0
- data/spec/server/helpers_spec.rb +34 -0
- data/spec/server/mock_response_spec.rb +526 -0
- data/spec/server/server_spec.rb +132 -0
- data/spec/spec_helper.rb +61 -2
- data/test.html +12 -0
- data/test.rb +20 -17
- data/todo.lst +2 -0
- data/views/index.haml +22 -0
- data/views/response.haml +24 -0
- metadata +134 -49
- data/features/server/templates/put/put_as_default.feature +0 -42
- data/features/server/templates/put/put_with_delay.feature +0 -8
- data/features/server/templates/put/put_with_pattern.feature +0 -80
- data/lib/mirage/client/response.rb +0 -29
- data/spec/client_spec.rb +0 -38
- data/views/index.erb +0 -28
@@ -2,6 +2,8 @@
|
|
2
2
|
Feature: Mirage is started from the command line.
|
3
3
|
more than instance of Mirage can be started on different ports at the same time.
|
4
4
|
|
5
|
+
By default mirage runs on port 7001.
|
6
|
+
|
5
7
|
|
6
8
|
Scenario: Starting mirage
|
7
9
|
Given Mirage is not running
|
@@ -14,17 +16,3 @@ Feature: Mirage is started from the command line.
|
|
14
16
|
Given Mirage is not running
|
15
17
|
When I run 'mirage start -p 9001'
|
16
18
|
Then mirage should be running on 'http://localhost:9001/mirage'
|
17
|
-
|
18
|
-
|
19
|
-
Scenario: Starting multiple instances of Mirage
|
20
|
-
Given Mirage is not running
|
21
|
-
When I run 'mirage start -p 7001'
|
22
|
-
And I run 'mirage start -p 9001'
|
23
|
-
Then mirage should be running on 'http://localhost:7001/mirage'
|
24
|
-
And mirage should be running on 'http://localhost:9001/mirage'
|
25
|
-
|
26
|
-
|
27
|
-
Scenario: Starting Mirage when it is already running
|
28
|
-
Given Mirage is running
|
29
|
-
When I run 'mirage start -p 7001'
|
30
|
-
Then I should see 'Mirage is already running' on the command line
|
@@ -1,13 +1,15 @@
|
|
1
1
|
@command_line
|
2
|
-
Feature:
|
2
|
+
Feature: Mirage can be stopped from the commandline
|
3
|
+
If more than one instance of Mirage is running, you will be asked to supply the ports which represent the running instances
|
4
|
+
of mirage that you wish to stop.
|
3
5
|
|
4
|
-
Scenario:
|
6
|
+
Scenario: Stopping a single instance
|
5
7
|
Given I run 'mirage start -p 7001'
|
6
8
|
When I run 'mirage stop'
|
7
9
|
Then mirage should not be running on 'http://localhost:7001/mirage'
|
8
10
|
|
9
11
|
|
10
|
-
Scenario: Calling stop
|
12
|
+
Scenario: Calling stop when there is more than one instance running
|
11
13
|
Given I run 'mirage start -p 7001'
|
12
14
|
Given I run 'mirage start -p 9001'
|
13
15
|
When I run 'mirage stop'
|
@@ -16,7 +18,7 @@ Feature: stop
|
|
16
18
|
And mirage should be running on 'http://localhost:9001/mirage'
|
17
19
|
|
18
20
|
|
19
|
-
Scenario: stopping on a single instance
|
21
|
+
Scenario: stopping on a single instance using the port
|
20
22
|
Given I run 'mirage start -p 7001'
|
21
23
|
And I run 'mirage start -p 9001'
|
22
24
|
When I run 'mirage stop -p 7001'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Feature: Output from Mirage is stored in mirage.log.
|
2
2
|
This file is located at the root from which mirage is started.
|
3
3
|
|
4
|
-
Scenario:
|
5
|
-
Given
|
4
|
+
Scenario: Mirage logs request
|
5
|
+
Given GET is sent to 'http://localhost:7001/mirage/templates/greeting'
|
6
6
|
Then mirage.log should contain '/mirage/templates/greeting'
|
@@ -1,89 +1,34 @@
|
|
1
|
+
#TODO - rename responses directory to templates
|
1
2
|
@command_line
|
2
|
-
Feature: Mirage can be primed with a set of
|
3
|
-
By default, Mirage loads any rb files found in ./responses on startup. Mirage can also be made to load
|
4
|
-
of your choosing
|
3
|
+
Feature: Mirage can be primed with a set of templates.
|
4
|
+
By default, Mirage loads any .rb files found in ./responses on startup. Mirage can also be made to load responses from a directory
|
5
|
+
of your choosing by using the -d/--defaults option
|
5
6
|
|
6
7
|
Responses can be added to the responses directory and used to prime Mirage after Mirage has been started.
|
7
8
|
|
8
|
-
Priming
|
9
|
+
Priming causes any modifications to Mirage's current state to be lost.
|
9
10
|
|
10
11
|
|
11
|
-
Scenario:
|
12
|
+
Scenario: Using the default responses directory
|
12
13
|
Given the file 'responses/default_greetings.rb' contains:
|
13
14
|
"""
|
14
15
|
prime do |mirage|
|
15
|
-
mirage.put('greeting', 'hello')
|
16
|
-
mirage.put('leaving', 'goodbye')
|
16
|
+
mirage.templates.put('greeting', 'hello')
|
17
17
|
end
|
18
18
|
"""
|
19
19
|
And I run 'mirage start'
|
20
|
-
When
|
20
|
+
When GET is sent to 'http://localhost:7001/mirage/responses/greeting'
|
21
21
|
Then 'hello' should be returned
|
22
|
-
When I send GET to 'http://localhost:7001/mirage/responses/leaving'
|
23
|
-
Then 'goodbye' should be returned
|
24
22
|
|
25
23
|
|
26
|
-
Scenario:
|
27
|
-
Given the file './custom_responses_location/default_greetings.rb' contains:
|
28
|
-
"""
|
29
|
-
prime do |mirage|
|
30
|
-
mirage.put('greeting', 'hello')
|
31
|
-
end
|
32
|
-
"""
|
33
|
-
And I run 'mirage start -d ./custom_responses_location'
|
34
|
-
When I send GET to 'http://localhost:7001/mirage/responses/greeting'
|
35
|
-
Then 'hello' should be returned
|
36
|
-
|
37
|
-
|
38
|
-
Scenario: Mirage is started pointing with a full path for the responses
|
24
|
+
Scenario: Using a custom responses directory
|
39
25
|
Given Mirage is not running
|
40
26
|
And the file '/tmp/responses/default_greetings.rb' contains:
|
41
27
|
"""
|
42
28
|
prime do |mirage|
|
43
|
-
mirage.put('greeting', 'hello')
|
29
|
+
mirage.templates.put('greeting', 'hello')
|
44
30
|
end
|
45
31
|
"""
|
46
32
|
And I run 'mirage start --defaults /tmp/responses'
|
47
|
-
|
48
|
-
And I send GET to 'http://localhost:7001/mirage/responses/greeting'
|
33
|
+
And GET is sent to 'http://localhost:7001/mirage/responses/greeting'
|
49
34
|
Then 'hello' should be returned
|
50
|
-
|
51
|
-
|
52
|
-
Scenario: Priming mirage after its state has been modified
|
53
|
-
Given the file 'responses/default_greetings.rb' contains:
|
54
|
-
"""
|
55
|
-
prime do |mirage|
|
56
|
-
mirage.put('greeting', 'hello')
|
57
|
-
end
|
58
|
-
"""
|
59
|
-
And I run 'mirage start'
|
60
|
-
And I send DELETE to 'http://localhost:7001/mirage/templates'
|
61
|
-
And I send PUT to 'http://localhost:7001/mirage/templates/a_new_response' with request entity
|
62
|
-
"""
|
63
|
-
new response
|
64
|
-
"""
|
65
|
-
|
66
|
-
When I send PUT to 'http://localhost:7001/mirage/defaults'
|
67
|
-
When I send GET to 'http://localhost:7001/mirage/responses/greeting'
|
68
|
-
Then 'hello' should be returned
|
69
|
-
When I send GET to 'http://localhost:7001/mirage/responses/a_new_response'
|
70
|
-
Then a 404 should be returned
|
71
|
-
|
72
|
-
@command_line
|
73
|
-
Scenario: Mirage is started with a bad file
|
74
|
-
Given the file 'responses/default_greetings.rb' contains:
|
75
|
-
"""
|
76
|
-
A file with a mistake in it
|
77
|
-
"""
|
78
|
-
When I run 'mirage start'
|
79
|
-
Then I should see 'WARN: Unable to load default responses from: responses/default_greetings.rb' on the command line
|
80
|
-
|
81
|
-
|
82
|
-
Scenario: Mirage is primed with a bad file after it has been started
|
83
|
-
Given I run 'mirage start'
|
84
|
-
When the file 'responses/default_greetings.rb' contains:
|
85
|
-
"""
|
86
|
-
A file with a mistake in it
|
87
|
-
"""
|
88
|
-
And I send PUT to 'http://localhost:7001/mirage/defaults'
|
89
|
-
Then a 500 should be returned
|
@@ -1,46 +1,47 @@
|
|
1
|
-
Feature:
|
1
|
+
Feature: Tracked request data can be deleted
|
2
2
|
|
3
3
|
Background: The MockServer has already got a response for greeting and leaving on it.
|
4
|
-
Given
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
Given the following template template:
|
5
|
+
"""
|
6
|
+
{
|
7
|
+
"response":{
|
8
|
+
"body":"Hello"
|
9
|
+
}
|
10
|
+
}
|
11
|
+
"""
|
12
|
+
And 'response.body' is base64 encoded
|
13
|
+
And the template is sent using PUT to 'http://localhost:7001/mirage/templates/greeting'
|
14
|
+
|
15
|
+
Given the following template template:
|
16
|
+
"""
|
17
|
+
{
|
18
|
+
"response":{
|
19
|
+
"body":"Goodbye"
|
20
|
+
}
|
21
|
+
}
|
22
|
+
"""
|
23
|
+
And 'response.body' is base64 encoded
|
24
|
+
And the template is sent using PUT to 'http://localhost:7001/mirage/templates/leaving'
|
25
|
+
|
26
|
+
|
27
|
+
And GET is sent to 'http://localhost:7001/mirage/responses/greeting'
|
28
|
+
And GET is sent to 'http://localhost:7001/mirage/responses/leaving'
|
9
29
|
|
10
30
|
|
11
31
|
Scenario: Deleting all requests
|
12
|
-
And
|
32
|
+
And DELETE is sent to 'http://localhost:7001/mirage/requests'
|
13
33
|
|
14
|
-
When
|
34
|
+
When GET is sent to 'http://localhost:7001/mirage/requests/1'
|
15
35
|
Then a 404 should be returned
|
16
|
-
When
|
17
|
-
Then a 200 should be returned
|
18
|
-
When I send GET to 'http://localhost:7001/mirage/templates/1'
|
19
|
-
Then a 200 should be returned
|
20
|
-
|
21
|
-
|
22
|
-
When I send GET to 'http://localhost:7001/mirage/requests/2'
|
36
|
+
When GET is sent to 'http://localhost:7001/mirage/requests/2'
|
23
37
|
Then a 404 should be returned
|
24
|
-
When I send GET to 'http://localhost:7001/mirage/responses/leaving'
|
25
|
-
Then a 200 should be returned
|
26
|
-
When I send GET to 'http://localhost:7001/mirage/templates/2'
|
27
|
-
Then a 200 should be returned
|
28
38
|
|
29
39
|
|
30
|
-
Scenario: Deleting a stored request for a prticular response
|
31
|
-
And I send DELETE to 'http://localhost:7001/mirage/requests/1'
|
32
40
|
|
33
|
-
|
34
|
-
|
35
|
-
When I send GET to 'http://localhost:7001/mirage/responses/greeting'
|
36
|
-
Then a 200 should be returned
|
37
|
-
When I send GET to 'http://localhost:7001/mirage/templates/1'
|
38
|
-
Then a 200 should be returned
|
41
|
+
Scenario: Deleting a stored request for a particular response
|
42
|
+
And DELETE is sent to 'http://localhost:7001/mirage/requests/1'
|
39
43
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
When I send GET to 'http://localhost:7001/mirage/responses/leaving'
|
44
|
+
When GET is sent to 'http://localhost:7001/mirage/requests/1'
|
45
|
+
Then a 404 should be returned
|
46
|
+
When GET is sent to 'http://localhost:7001/mirage/requests/2'
|
44
47
|
Then a 200 should be returned
|
45
|
-
When I send GET to 'http://localhost:7001/mirage/templates/2'
|
46
|
-
Then a 200 should be returned
|
@@ -1,13 +1,23 @@
|
|
1
|
-
Feature: After a response has been served from Mirage, the
|
2
|
-
for testing that the correct information was sent
|
1
|
+
Feature: After a response has been served from Mirage, the request that triggered it can be retrieved. This is useful
|
2
|
+
for testing that the correct information was sent by your application code.
|
3
3
|
|
4
|
-
|
4
|
+
Use a template's ID to retrieve the last request that was last received.
|
5
5
|
|
6
|
-
If the request body contains content this is stored. Otherwise it is the query string that is stored.
|
7
6
|
|
8
7
|
Background: A template has already be put on Mirage
|
9
|
-
Given
|
10
|
-
|
8
|
+
Given the following template template:
|
9
|
+
"""
|
10
|
+
{
|
11
|
+
"request" : {
|
12
|
+
"http_method" : "post"
|
13
|
+
},
|
14
|
+
"response":{
|
15
|
+
"body":"Hello"
|
16
|
+
}
|
17
|
+
}
|
18
|
+
"""
|
19
|
+
And 'response.body' is base64 encoded
|
20
|
+
And the template is sent using PUT to 'http://localhost:7001/mirage/templates/greeting'
|
11
21
|
|
12
22
|
|
13
23
|
Scenario: Getting request data when the data was in the body.
|
@@ -15,18 +25,11 @@ Feature: After a response has been served from Mirage, the content of the reques
|
|
15
25
|
"""
|
16
26
|
Hello Mirage
|
17
27
|
"""
|
18
|
-
When
|
19
|
-
Then
|
20
|
-
|
28
|
+
When GET is sent to 'http://localhost:7001/mirage/requests/1'
|
29
|
+
Then request data should have been retrieved
|
21
30
|
|
22
|
-
Scenario: Getting request data when the data was in the query string.
|
23
|
-
Given I send POST to 'http://localhost:7001/mirage/responses/greeting' with parameters:
|
24
|
-
| surname | Davis |
|
25
|
-
| firstname | Leon |
|
26
|
-
When I send GET to 'http://localhost:7001/mirage/requests/1'
|
27
|
-
Then 'surname=Davis&firstname=Leon' should be returned
|
28
31
|
|
32
|
+
Scenario: Getting request data for a template that has not yet served a response.
|
33
|
+
Given GET is sent to 'http://localhost:7001/mirage/requests/1'
|
34
|
+
Then a 404 should be returned
|
29
35
|
|
30
|
-
Scenario: Getting request data for a template that has not been served yet.
|
31
|
-
Given I send GET to 'http://localhost:7001/mirage/requests/1'
|
32
|
-
Then a 404 should be returned
|
@@ -1,22 +1,35 @@
|
|
1
1
|
Feature: Having set up the Mirage with a number of defaults, your tests may continue to change its state.
|
2
2
|
Clearing and resetting all of your responses, potentially hundreds of times, can be time expensive.
|
3
3
|
|
4
|
-
Mirage provides the ability to save
|
4
|
+
Mirage provides the ability to save its current state and to revert back to that state.
|
5
5
|
|
6
6
|
Background: The MockServer has been setup with some default responses
|
7
|
-
Given
|
7
|
+
Given the following template template:
|
8
|
+
"""
|
9
|
+
{
|
10
|
+
"response":{
|
11
|
+
"body":"The default greeting"
|
12
|
+
}
|
13
|
+
}
|
14
|
+
"""
|
15
|
+
And 'response.body' is base64 encoded
|
16
|
+
And the template is sent using PUT to 'http://localhost:7001/mirage/templates/greeting'
|
8
17
|
|
9
18
|
|
10
19
|
Scenario: Saving Mirage and reverting it
|
11
|
-
|
20
|
+
Given PUT is sent to 'http://localhost:7001/mirage/backup'
|
21
|
+
And the following template template:
|
22
|
+
"""
|
23
|
+
{
|
24
|
+
"response":{
|
25
|
+
"body":"Changed"
|
26
|
+
}
|
27
|
+
}
|
28
|
+
"""
|
29
|
+
And 'response.body' is base64 encoded
|
30
|
+
And the template is sent using PUT to 'http://localhost:7001/mirage/templates/greeting'
|
12
31
|
|
13
|
-
|
14
|
-
And
|
15
|
-
|
16
|
-
And I send PUT to 'http://localhost:7001/mirage'
|
17
|
-
|
18
|
-
When I send GET to 'http://localhost:7001/mirage/responses/leaving'
|
19
|
-
Then a 404 should be returned
|
32
|
+
When PUT is sent to 'http://localhost:7001/mirage'
|
33
|
+
And GET is sent to 'http://localhost:7001/mirage/responses/greeting'
|
20
34
|
|
21
|
-
When I send GET to 'http://localhost:7001/mirage/responses/greeting'
|
22
35
|
Then 'The default greeting' should be returned
|
@@ -1,47 +1,44 @@
|
|
1
|
-
Feature:
|
2
|
-
also deletes any associated request data.
|
3
|
-
|
1
|
+
Feature: When a template is deleted, any tracked request data is also removed.
|
4
2
|
|
5
3
|
Background: The MockServer has already got a response for greeting and leaving on it.
|
6
|
-
Given
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
4
|
+
Given the following template template:
|
5
|
+
"""
|
6
|
+
{
|
7
|
+
"response":{
|
8
|
+
"body":"Hello"
|
9
|
+
}
|
10
|
+
}
|
11
|
+
"""
|
12
|
+
And 'response.body' is base64 encoded
|
13
|
+
And the template is sent using PUT to 'http://localhost:7001/mirage/templates/greeting'
|
14
|
+
|
15
|
+
Given the following template template:
|
16
|
+
"""
|
17
|
+
{
|
18
|
+
"response":{
|
19
|
+
"body":"Goodbye"
|
20
|
+
}
|
21
|
+
}
|
22
|
+
"""
|
23
|
+
And 'response.body' is base64 encoded
|
24
|
+
And the template is sent using PUT to 'http://localhost:7001/mirage/templates/leaving'
|
11
25
|
|
12
26
|
|
13
27
|
Scenario: Deleting all templates
|
14
|
-
Given
|
15
|
-
|
16
|
-
When I send GET to 'http://localhost:7001/mirage/requests/1'
|
17
|
-
Then a 404 should be returned
|
18
|
-
When I send GET to 'http://localhost:7001/mirage/responses/greeting'
|
28
|
+
Given DELETE is sent to 'http://localhost:7001/mirage/templates'
|
29
|
+
When GET is sent to 'http://localhost:7001/mirage/responses/greeting'
|
19
30
|
Then a 404 should be returned
|
20
|
-
When
|
21
|
-
Then a 404 should be returned
|
22
|
-
|
23
|
-
When I send GET to 'http://localhost:7001/mirage/requests/2'
|
24
|
-
Then a 404 should be returned
|
25
|
-
When I send GET to 'http://localhost:7001/mirage/responses/leaving'
|
26
|
-
Then a 404 should be returned
|
27
|
-
When I send GET to 'http://localhost:7001/mirage/templates/2'
|
31
|
+
When GET is sent to 'http://localhost:7001/mirage/responses/leaving'
|
28
32
|
Then a 404 should be returned
|
29
33
|
|
30
34
|
|
31
35
|
Scenario: Deleting a particular template
|
32
|
-
Given
|
36
|
+
Given DELETE is sent to 'http://localhost:7001/mirage/templates/1'
|
33
37
|
|
34
|
-
When
|
35
|
-
Then a 404 should be returned
|
36
|
-
When I send GET to 'http://localhost:7001/mirage/responses/greeting'
|
37
|
-
Then a 404 should be returned
|
38
|
-
When I send GET to 'http://localhost:7001/mirage/requests/1'
|
38
|
+
When GET is sent to 'http://localhost:7001/mirage/responses/greeting'
|
39
39
|
Then a 404 should be returned
|
40
40
|
|
41
|
-
When
|
42
|
-
Then a 200 should be returned
|
43
|
-
When I send GET to 'http://localhost:7001/mirage/responses/leaving'
|
44
|
-
Then a 200 should be returned
|
45
|
-
When I send GET to 'http://localhost:7001/mirage/templates/2'
|
41
|
+
When GET is sent to 'http://localhost:7001/mirage/responses/leaving'
|
46
42
|
Then a 200 should be returned
|
43
|
+
|
47
44
|
|
@@ -1,31 +1,50 @@
|
|
1
|
-
Feature:
|
2
|
-
To do this, the responses unique id is required to identify it
|
3
|
-
|
1
|
+
Feature: Templates can be retrieved by using the ID that was returned when they were created
|
4
2
|
|
5
|
-
#TODO should return headers as well
|
6
|
-
Scenario: Peeking a text based response
|
7
|
-
Given I send PUT to 'http://localhost:7001/mirage/templates/xml' with body '<xml></xml>' and headers:
|
8
|
-
| content-type | text/xml |
|
9
3
|
|
10
|
-
|
11
|
-
|
12
|
-
And the response 'content-type' should be 'text/xml'
|
13
|
-
|
14
|
-
|
15
|
-
Scenario: Peeking a file based response
|
16
|
-
Given the file 'test_file.txt' contains:
|
4
|
+
Scenario: Retrieving a template
|
5
|
+
Given the following template template:
|
17
6
|
"""
|
18
|
-
|
7
|
+
{
|
8
|
+
"response":{
|
9
|
+
"default":false,
|
10
|
+
"body":"Hello",
|
11
|
+
"delay":0,
|
12
|
+
"content_type":"text/plain",
|
13
|
+
"status":200
|
14
|
+
},
|
15
|
+
"request":{
|
16
|
+
"parameters":{
|
17
|
+
|
18
|
+
},
|
19
|
+
"body_content":[
|
20
|
+
|
21
|
+
],
|
22
|
+
"http_method":"get"
|
23
|
+
}
|
24
|
+
}
|
25
|
+
"""
|
26
|
+
And the template is sent using PUT to 'http://localhost:7001/mirage/templates/greeting'
|
27
|
+
When GET is sent to 'http://localhost:7001/mirage/templates/1'
|
28
|
+
Then the following should be returned:
|
29
|
+
"""
|
30
|
+
{
|
31
|
+
"response":{
|
32
|
+
"default":false,
|
33
|
+
"body":"Hello",
|
34
|
+
"delay":0,
|
35
|
+
"content_type":"text/plain",
|
36
|
+
"status":200
|
37
|
+
},
|
38
|
+
"request":{
|
39
|
+
"parameters":{
|
40
|
+
|
41
|
+
},
|
42
|
+
"body_content":[
|
43
|
+
|
44
|
+
],
|
45
|
+
"http_method":"get"
|
46
|
+
}
|
47
|
+
}
|
19
48
|
"""
|
20
|
-
And I send PUT to 'http://localhost:7001/mirage/templates/some/location/download' with file: test_file.txt and headers:
|
21
|
-
| X-mirage-file | true |
|
22
|
-
|
23
|
-
When I send GET to 'http://localhost:7001/mirage/templates/1'
|
24
|
-
Then the response should be the same as the content of 'test_file.txt'
|
25
|
-
|
26
|
-
|
27
|
-
Scenario: Peeking a response that does not exist
|
28
|
-
When I send GET to 'http://localhost:7001/mirage/templates/1'
|
29
|
-
Then a 404 should be returned
|
30
49
|
|
31
50
|
|