From e527f1ae09539667cc0eb710d59bf88d686749c4 Mon Sep 17 00:00:00 2001 From: soh_cah_toa Date: Fri, 7 Jun 2013 23:09:07 -0400 Subject: [PATCH] Refactored redundant code in #test_1_add_rule_good. --- test/integration/tc_dns_rest.rb | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/test/integration/tc_dns_rest.rb b/test/integration/tc_dns_rest.rb index d3216f34e..885d5044d 100644 --- a/test/integration/tc_dns_rest.rb +++ b/test/integration/tc_dns_rest.rb @@ -38,14 +38,9 @@ class TC_DnsRest < Test::Unit::TestCase @@headers) # Test that adding a new rule works properly - assert_not_nil(rest_response.body) - assert_equal(200, rest_response.code) + check_response(rest_response) result = JSON.parse(rest_response.body) - - assert(result['success']) - assert(result['id']) - first_id = result['id'] rest_response = RestClient.post("#{RESTAPI_DNS}/rule?token=#{@@token}", @@ -53,13 +48,11 @@ class TC_DnsRest < Test::Unit::TestCase @@headers) # Test that adding an existing rule returns its id - assert_not_nil(rest_response.body) - assert_equal(200, rest_response.code) + check_response(rest_response) result = JSON.parse(rest_response.body) second_id = result['id'] - assert(result['success']) assert_equal(first_id, second_id) end @@ -339,7 +332,7 @@ class TC_DnsRest < Test::Unit::TestCase hash['type'] = 'BeEF' - # Test invalid RR + # Test that an invalid RR returns 400 assert_raise RestClient::BadRequest do rest_response = RestClient.post("#{RESTAPI_DNS}/rule?token=#{@@token}", hash.to_json,