-
Notifications
You must be signed in to change notification settings - Fork 80
/
Config.feature
80 lines (72 loc) · 3.84 KB
/
Config.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
68
69
70
71
72
73
74
75
76
77
78
79
80
@Commands @Config
Feature: Config
The config command allows a user to get and set config values and is supported through the "/repos/{repository}/config" endpoint
The command must be executed using the HTTP GET or POST methods
Scenario: Verify wrong HTTP method issues 405 "Method not allowed"
Given There is an empty repository named repo1
When I call "DELETE /repos/repo1/config"
Then the response status should be '405'
And the response allowed methods should be "GET,POST"
Scenario: Config outside of a repository issues 404 "Not found"
Given There is an empty multirepo server
When I call "GET /repos/repo1/config"
Then the response status should be '404'
And the response ContentType should be "text/plain"
And the response body should contain "Repository not found"
Scenario: Config POST without specifying a key issues a 400 status code
Given There is an empty repository named repo1
When I call "POST /repos/repo1/config"
Then the response status should be '400'
And the xpath "/response/error/text()" contains "You must specify the key when setting a config key."
Scenario: Config POST without specifying a value issues a 400 status code
Given There is an empty repository named repo1
When I call "POST /repos/repo1/config?name=user.name"
Then the response status should be '400'
And the xpath "/response/error/text()" contains "You must specify the value when setting a config key."
Scenario: Config POST with a name and value in the url sets the config entry and GET retrieves the set value
Given There is an empty repository named repo1
When I call "POST /repos/repo1/config?name=user.name&value=myUser"
Then the response status should be '200'
And the xpath "/response/success/text()" equals "true"
When I call "GET /repos/repo1/config?name=user.name"
Then the response status should be '200'
And the xpath "/response/value/text()" equals "myUser"
Scenario: Config POST with a name and value as json sets the config entry and GET retrieves the set value
Given There is an empty repository named repo1
When I "POST" content-type "application/json" to "/repos/repo1/config" with
"""
{
"name":"user.name",
"value":"myUser"
}
"""
Then the response status should be '200'
And the xpath "/response/success/text()" equals "true"
When I call "GET /repos/repo1/config?name=user.name"
Then the response status should be '200'
And the xpath "/response/value/text()" equals "myUser"
Scenario: Config POST with a name and value as xml sets the config entry and GET retrieves the set value
Given There is an empty repository named repo1
When I "POST" content-type "application/xml" to "/repos/repo1/config" with
"""
<params>
<name>user.name</name>
<value>myUser</value>
</params>
"""
Then the response status should be '200'
And the xpath "/response/success/text()" equals "true"
When I call "GET /repos/repo1/config?name=user.name"
Then the response status should be '200'
And the xpath "/response/value/text()" equals "myUser"
Scenario: Config GET without a name will list all config entries
Given There is an empty repository named repo1
When I call "POST /repos/repo1/config?name=config.value1&value=myValue1"
And I call "POST /repos/repo1/config?name=config.value2&value=myValue2"
When I call "GET /repos/repo1/config"
Then the response status should be '200'
And the xpath "/response/success/text()" equals "true"
And the response body should contain "config.value1"
And the response body should contain "myValue1"
And the response body should contain "config.value2"
And the response body should contain "myValue2"