From 019ec2f6ed7bba7f581d1096c5bbb1c406ea2538 Mon Sep 17 00:00:00 2001 From: soh_cah_toa Date: Fri, 7 Jun 2013 00:05:15 -0400 Subject: [PATCH] Added new test for attempting to add an existing rule. --- test/integration/tc_dns_rest.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/integration/tc_dns_rest.rb b/test/integration/tc_dns_rest.rb index 898d2f16a..8e74f72ae 100644 --- a/test/integration/tc_dns_rest.rb +++ b/test/integration/tc_dns_rest.rb @@ -37,6 +37,7 @@ class TC_DnsRest < Test::Unit::TestCase json, @@headers) + # Test that adding a new rule works properly assert_not_nil(rest_response.body) assert_equal(200, rest_response.code) @@ -44,6 +45,22 @@ class TC_DnsRest < Test::Unit::TestCase assert(result['success']) assert(result['id']) + + first_id = result['id'] + + rest_response = RestClient.post("#{RESTAPI_DNS}/rule?token=#{@@token}", + json, + @@headers) + + # Test that adding an existing rule returns its id + assert_not_nil(rest_response.body) + assert_equal(200, rest_response.code) + + result = JSON.parse(rest_response.body) + second_id = result['id'] + + assert(result['success']) + assert_equal(first_id, second_id) end def test_2_add_rule_bad