Sha256: dd7cb35727d9aa242b325f00c87391cf125ac5961cc7da0e34f1b831f75f6f2b
Contents?: true
Size: 1.96 KB
Versions: 16
Compression:
Stored size: 1.96 KB
Contents
require 'helper' describe OwaspZap::Auth do before do @auth = OwaspZap::Auth.new end it "should have context 1" do assert_equal(@auth.ctx,1) end it "should have base on localhost" do assert_equal @auth.base,"http://127.0.0.1:8080/JSON" end end describe "Auth view methods" do before do @h = OwaspZap::Auth.new @methods = [:login_url, :logout_url, :login_data, :logout_data, :logged_in_indicator, :logged_out_indicator] @methods.each do |m| m_str = m.to_s m_str.extend OwaspZap::StringExtension m_str = m_str.camel_case stub_request(:get, "http://127.0.0.1:8080/JSON/auth/view/#{m_str}/?zapapiformat=JSON&contextId=1").to_return(:status => 200, :body => "{\"Result\":\"OK\"}" , :headers => {}) end end it "should request all view methods" do @methods.each do |m| m_str = m.to_s m_str.extend OwaspZap::StringExtension m_str = m_str.camel_case @h.send(m) assert_requested :get,"http://127.0.0.1:8080/JSON/auth/view/#{m_str}/?zapapiformat=JSON&contextId=1" end end end describe "Login/Logout" do before do @h = OwaspZap::Auth.new stub_request(:get, "http://127.0.0.1:8080/JSON/auth/action/logout/?zapapiformat=JSON&contextId=1").to_return(:status => 200, :body => "{\"Result\":\"OK\"}" , :headers => {}) stub_request(:get, "http://127.0.0.1:8080/JSON/auth/action/login/?zapapiformat=JSON&contextId=1").to_return(:status => 200, :body => "{\"Result\":\"OK\"}" , :headers => {}) end it "should call the login url" do @h.login assert_requested :get,"http://127.0.0.1:8080/JSON/auth/action/login/?zapapiformat=JSON&contextId=1" end it "should call the logout url" do @h.logout assert_requested :get,"http://127.0.0.1:8080/JSON/auth/action/logout/?zapapiformat=JSON&contextId=1" end end
Version data entries
16 entries across 16 versions & 1 rubygems