This repository was archived by the owner on May 6, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhandle_orders.feature
More file actions
55 lines (47 loc) · 2.46 KB
/
Copy pathhandle_orders.feature
File metadata and controls
55 lines (47 loc) · 2.46 KB
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
Feature: Handle Orders
In order facilitate the automation of freshly spawned nodes
I want to be able to take a baseline node and provide a proper node JSON
Scenario: Default usage banner
Given I request GET "/usage"
Then I should see "Welcome to Waitress"
Scenario: List orders
Given the following order
| mac_address | node |
| B2-E7-D1-A7-61-9D | {"scaffold": {"hostname": "some-node-name"}} |
| B2-E7-D1-A7-61-3E | {"scaffold": {"hostname": "another-node-name"}} |
| B2-E7-D1-A7-61-5B | {"scaffold": {"hostname": "that-node-name"}} |
And I request GET "/"
Then I should see "Waitress Current Orders"
And I should see "B2-E7-D1-A7-61-9D"
And I should see "B2-E7-D1-A7-61-3E"
And I should see "B2-E7-D1-A7-61-5B"
Scenario: Fetch a node from a MAC Address
Given the following order
| mac_address | node |
| B2-E7-D1-A7-61-9D | {"scaffold": {"hostname": "some-node-name"}} |
When I request GET "/B2-E7-D1-A7-61-9D"
Then I should see JSON: {"scaffold": {"hostname": "some-node-name"}}
And the database should not have a key for "B2-E7-D1-A7-61-9D"
Scenario: Fetch a node where that doesn't exist
Given the database is empty
When I request GET "/B2-E7-D1-A7-61-9D"
Then I should see JSON: {"Status": "Are you sure you have an order up? I can't seem to find it."}
Scenario: Create an order from a MAC Address and node JSON
Given the database is empty
When I POST the following order
| mac_address | node |
| B2-E7-D1-A7-61-F1 | {"scaffold": {"hostname": "another-node-name"}} |
Then I should see JSON: {"Status": "Order up for B2-E7-D1-A7-61-F1."}
And the database should have a key for "B2-E7-D1-A7-61-F1"
Scenario: Create an order without a MAC Address
Given the database is empty
When I POST the following order
| node |
| {"scaffold": {"hostname": "another-node-name"}} |
Then I should see JSON: {"Status": "Malformed order. I need a mac_address and a node JSON to take your order."}
Scenario: Create an order without a node
Given the database is empty
When I POST the following order
| mac_address |
| B2-E7-D1-A7-61-F1 |
Then I should see JSON: {"Status": "Malformed order. I need a mac_address and a node JSON to take your order."}