test/rest_api_test.rb in ardtweeno-0.4.0 vs test/rest_api_test.rb in ardtweeno-0.5.0
- old
+ new
@@ -102,32 +102,32 @@
end
# Test retrieval of zones
def test_retrieve_zones
- get "/api/v1/zones", params={:zonename=>"testzone0", :key=>"1230aea77d7bd38898fec74a75a87738dea9f657"}
+ get "/api/v1/zones", params={:key=>"1230aea77d7bd38898fec74a75a87738dea9f657"}
json = JSON.parse(last_response.body)
- assert_equal(1, json["found"])
+ assert_equal(2, json["found"])
assert_equal(2, json["total"])
get "/api/v1/zones", params={:zonename=>"testzonez", :key=>"1230aea77d7bd38898fec74a75a87738dea9f657"}
json = JSON.parse(last_response.body)
- assert_equal(0, json["found"])
+ assert_equal(2, json["found"])
assert_equal(2, json["total"])
- get "/api/v1/zones", params={:key=>"1230aea77d7bd38898fec74a75a87738dea9f657"}
+ get "/api/v1/zones", params={:key=>"455a807bb34b1976bac820b07c263ee81bd267cc"}
json = JSON.parse(last_response.body)
- assert_equal(2, json["found"])
+ assert_equal(1, json["found"])
assert_equal(2, json["total"])
- get "/api/v1/zones/testzone0", params={:zonename=>"testzone0", :key=>"1230aea77d7bd38898fec74a75a87738dea9f657"}
+ get "/api/v1/zones/testzone0", params={:key=>"455a807bb34b1976bac820b07c263ee81bd267cc"}
json = JSON.parse(last_response.body)
assert_equal(1, json["found"])
assert_equal(2, json["total"])
- get "/api/v1/zones/testzonez", params={:zonename=>"testzonez", :key=>"1230aea77d7bd38898fec74a75a87738dea9f657"}
+ get "/api/v1/zones/testzonez", params={:key=>"79a7c75758879243418fe2c87ec7d5d4e1451129"}
json = JSON.parse(last_response.body)
assert_equal(0, json["found"])
assert_equal(2, json["total"])
end
@@ -230,27 +230,29 @@
# Test the system start parser command
def test_system_start
get "/api/v1/system/start", params={:node=>"node1", :key=>"1230aea77d7bd38898fec74a75a87738dea9f657"}
- assert_equal("The Ardtweeno system is launching, this will take a moment...", last_response.body)
+ assert_equal('{"response":true,"running":true}', last_response.body)
assert last_response.ok?
# Test call with invalid key fails
- get "/api/v1/system/start", params={:node=>"node1", :key=>"898fec74a75a87738dea9f657"}
- assert not(last_response.ok?)
+ get "/api/v1/system/start", params={:node=>"node1", :key=>"1230aea77d7bd38898fec74a75a87738dea9f657"}
+ assert_equal('{"response":false,"running":true}', last_response.body)
+ assert last_response.ok?
end
# Test the system stop parser command
def test_system_stop
get "/api/v1/system/stop", params={:node=>"node1", :key=>"1230aea77d7bd38898fec74a75a87738dea9f657"}
- assert_equal("The Ardtweeno system is shutting down, this will take a moment...", last_response.body)
+ assert_equal('{"response":true,"running":false}', last_response.body)
assert last_response.ok?
# Test call with invalid key fails
- get "/api/v1/system/stop", params={:node=>"node1", :key=>"898fec74a75a87738dea9f657"}
- assert not(last_response.ok?)
+ get "/api/v1/system/stop", params={:node=>"node1", :key=>"1230aea77d7bd38898fec74a75a87738dea9f657"}
+ assert_equal('{"response":false,"running":false}', last_response.body)
+ assert last_response.ok?
end
# Test the system config command
def test_system_config
\ No newline at end of file