From 235b1847badc6c0288caffcc1e9f138c688c9769 Mon Sep 17 00:00:00 2001 From: Zack Hobson Date: Sun, 22 Dec 2013 22:02:32 -0800 Subject: rename net test --- test/net_test.rb | 41 +++++++++++++++++++++++++++++++++++++++++ test/timesheet_resource_test.rb | 41 ----------------------------------------- 2 files changed, 41 insertions(+), 41 deletions(-) create mode 100644 test/net_test.rb delete mode 100644 test/timesheet_resource_test.rb diff --git a/test/net_test.rb b/test/net_test.rb new file mode 100644 index 0000000..c4e39e1 --- /dev/null +++ b/test/net_test.rb @@ -0,0 +1,41 @@ +require 'test_helper' + +class NetTest < HCl::TestCase + + def setup + FakeWeb.allow_net_connect = false + HCl::Net.configure \ + 'login' => 'bob', + 'password' => 'secret', + 'subdomain' => 'bobclock', + 'ssl' => true + end + + def test_configure + assert_equal 'bob', HCl::Net.login + assert_equal 'secret', HCl::Net.password + assert_equal 'bobclock', HCl::Net.subdomain + assert_equal true, HCl::Net.ssl + end + + def test_http_get + FakeWeb.register_uri(:get, "https://bob:secret@bobclock.harvestapp.com/foo", + :body => 'gotten!'.inspect) + body = HCl::Net.get 'foo' + assert_equal 'gotten!', body + end + + def test_http_post + FakeWeb.register_uri(:post, "https://bob:secret@bobclock.harvestapp.com/foo", + :body => 'posted!'.inspect) + body = HCl::Net.post 'foo', {pizza:'taco'} + assert_equal 'posted!', body + end + + def test_http_delete + FakeWeb.register_uri(:delete, "https://bob:secret@bobclock.harvestapp.com/foo", + :body => 'wiped!'.inspect) + body = HCl::Net.delete 'foo' + assert_equal 'wiped!', body + end +end diff --git a/test/timesheet_resource_test.rb b/test/timesheet_resource_test.rb deleted file mode 100644 index 7397c0e..0000000 --- a/test/timesheet_resource_test.rb +++ /dev/null @@ -1,41 +0,0 @@ -require 'test_helper' - -class TimesheetResourceTest < HCl::TestCase - - def setup - FakeWeb.allow_net_connect = false - HCl::Net.configure \ - 'login' => 'bob', - 'password' => 'secret', - 'subdomain' => 'bobclock', - 'ssl' => true - end - - def test_configure - assert_equal 'bob', HCl::Net.login - assert_equal 'secret', HCl::Net.password - assert_equal 'bobclock', HCl::Net.subdomain - assert_equal true, HCl::Net.ssl - end - - def test_http_get - FakeWeb.register_uri(:get, "https://bob:secret@bobclock.harvestapp.com/foo", - :body => 'gotten!'.inspect) - body = HCl::Net.get 'foo' - assert_equal 'gotten!', body - end - - def test_http_post - FakeWeb.register_uri(:post, "https://bob:secret@bobclock.harvestapp.com/foo", - :body => 'posted!'.inspect) - body = HCl::Net.post 'foo', {pizza:'taco'} - assert_equal 'posted!', body - end - - def test_http_delete - FakeWeb.register_uri(:delete, "https://bob:secret@bobclock.harvestapp.com/foo", - :body => 'wiped!'.inspect) - body = HCl::Net.delete 'foo' - assert_equal 'wiped!', body - end -end -- cgit v1.2.3