1
- Feature : Create-Retrieve-Update-Delete with custom attribute
1
+ Feature : Create-Retrieve-Update-Delete with a Overridden Operation context
2
2
In order to use an hypermedia API
3
3
As a client software developer
4
4
I need to be able to retrieve, create, update and delete JSON-LD encoded resources.
5
5
6
6
@createSchema
7
7
Scenario : Create a resource
8
- When I send a "POST" request to "/custom_attribute_dummies " with body:
8
+ When I send a "POST" request to "/overridden_operation_dummies " with body:
9
9
"""
10
10
{
11
- "name": "My Custom Attribute Dummy",
11
+ "name": "My Overridden Operation Dummy",
12
12
"description" : "Gerard",
13
13
"alias": "notWritable"
14
14
}
@@ -19,52 +19,63 @@ Feature: Create-Retrieve-Update-Delete with custom attribute
19
19
And the JSON should be equal to:
20
20
"""
21
21
{
22
- "@context": "/contexts/CustomAttributeDummy ",
23
- "@id": "/custom_attribute_dummies /1",
24
- "@type": "CustomAttributeDummy ",
25
- "name": "My Custom Attribute Dummy",
22
+ "@context": "/contexts/OverriddenOperationDummy ",
23
+ "@id": "/overridden_operation_dummies /1",
24
+ "@type": "OverriddenOperationDummy ",
25
+ "name": "My Overridden Operation Dummy",
26
26
"alias": null,
27
27
"description": "Gerard"
28
28
}
29
29
"""
30
30
31
31
Scenario : Get a resource
32
- When I send a "GET" request to "/custom_attribute_dummies /1"
32
+ When I send a "GET" request to "/overridden_operation_dummies /1"
33
33
Then the response status code should be 200
34
34
And the response should be in JSON
35
35
And the header "Content-Type" should be equal to "application/ld+json"
36
36
And the JSON should be equal to:
37
37
"""
38
38
{
39
- "@context": "/contexts/CustomAttributeDummy ",
40
- "@id": "/custom_attribute_dummies /1",
41
- "@type": "CustomAttributeDummy ",
42
- "name": "My Custom Attribute Dummy",
39
+ "@context": "/contexts/OverriddenOperationDummy ",
40
+ "@id": "/overridden_operation_dummies /1",
41
+ "@type": "OverriddenOperationDummy ",
42
+ "name": "My Overridden Operation Dummy",
43
43
"alias": null,
44
44
"description": "Gerard"
45
45
}
46
46
"""
47
47
48
+ Scenario : Get a resource in XML
49
+ When I add "Accept" header equal to "application/xml"
50
+ And I send a "GET" request to "/overridden_operation_dummies/1"
51
+ Then the response status code should be 200
52
+ And the header "Content-Type" should be equal to "application/xml"
53
+ And the response should be equal to
54
+ """
55
+ <?xml version="1.0"?>
56
+ <response><name>My Overridden Operation Dummy</name><alias/><description>Gerard</description></response>
57
+ """
58
+
48
59
Scenario : Get a not found exception
49
- When I send a "GET" request to "/custom_attribute_dummies /42"
60
+ When I send a "GET" request to "/overridden_operation_dummies /42"
50
61
Then the response status code should be 404
51
62
52
63
Scenario : Get a collection
53
- When I send a "GET" request to "/custom_attribute_dummies "
64
+ When I send a "GET" request to "/overridden_operation_dummies "
54
65
Then the response status code should be 200
55
66
And the response should be in JSON
56
67
And the header "Content-Type" should be equal to "application/ld+json"
57
68
And the JSON should be equal to:
58
69
"""
59
70
{
60
- "@context": "/contexts/CustomAttributeDummy ",
61
- "@id": "\/custom_attribute_dummies ",
71
+ "@context": "/contexts/OverriddenOperationDummy ",
72
+ "@id": "\/overridden_operation_dummies ",
62
73
"@type": "hydra:Collection",
63
74
"hydra:member": [
64
75
{
65
- "@id": "\/custom_attribute_dummies \/1",
66
- "@type": "CustomAttributeDummy ",
67
- "name": "My Custom Attribute Dummy",
76
+ "@id": "\/overridden_operation_dummies \/1",
77
+ "@type": "OverriddenOperationDummy ",
78
+ "name": "My Overridden Operation Dummy",
68
79
"alias": null,
69
80
"description": "Gerard"
70
81
}
@@ -74,10 +85,10 @@ Feature: Create-Retrieve-Update-Delete with custom attribute
74
85
"""
75
86
76
87
Scenario : Update a resource
77
- When I send a "PUT" request to "/custom_attribute_dummies /1" with body:
88
+ When I send a "PUT" request to "/overridden_operation_dummies /1" with body:
78
89
"""
79
90
{
80
- "@id": "/custom_attribute_dummies /1",
91
+ "@id": "/overridden_operation_dummies /1",
81
92
"name": "A nice dummy",
82
93
"alias": "Dummy"
83
94
}
@@ -88,32 +99,33 @@ Feature: Create-Retrieve-Update-Delete with custom attribute
88
99
And the JSON should be equal to:
89
100
"""
90
101
{
91
- "@context": "/contexts/CustomAttributeDummy ",
92
- "@id": "/custom_attribute_dummies /1",
93
- "@type": "CustomAttributeDummy ",
102
+ "@context": "/contexts/OverriddenOperationDummy ",
103
+ "@id": "/overridden_operation_dummies /1",
104
+ "@type": "OverriddenOperationDummy ",
94
105
"alias": "Dummy",
95
106
"description": "Gerard"
96
107
}
97
108
"""
98
109
99
110
Scenario : Get the final resource
100
- When I send a "GET" request to "/custom_attribute_dummies /1"
111
+ When I send a "GET" request to "/overridden_operation_dummies /1"
101
112
Then the response status code should be 200
102
113
And the response should be in JSON
103
114
And the header "Content-Type" should be equal to "application/ld+json"
104
115
And the JSON should be equal to:
105
116
"""
106
117
{
107
- "@context": "/contexts/CustomAttributeDummy ",
108
- "@id": "/custom_attribute_dummies /1",
109
- "@type": "CustomAttributeDummy ",
110
- "name": "My Custom Attribute Dummy",
118
+ "@context": "/contexts/OverriddenOperationDummy ",
119
+ "@id": "/overridden_operation_dummies /1",
120
+ "@type": "OverriddenOperationDummy ",
121
+ "name": "My Overridden Operation Dummy",
111
122
"alias": "Dummy",
112
123
"description": "Gerard"
113
124
}
114
125
"""
126
+
115
127
@dropSchema
116
128
Scenario : Delete a resource
117
- When I send a "DELETE" request to "/custom_attribute_dummies /1"
129
+ When I send a "DELETE" request to "/overridden_operation_dummies /1"
118
130
Then the response status code should be 204
119
131
And the response should be empty
0 commit comments