Sha256: 989139cba846be745ad0d140a6485c3d7337dbd4ecab8a66c6784f940e621c87

Contents?: true

Size: 1.03 KB

Versions: 5

Compression:

Stored size: 1.03 KB

Contents

require File.dirname(__FILE__) + '/helper'

class SessionTest < OpenX::TestCase

  test "has a URI" do
    assert_instance_of URI::HTTP, new_session.uri
  end

  test "has a URL" do
    assert_equal 'http://test.host/path/to/api', new_session('http://test.host/path/to/api').url
  end

  test "has a host" do
    assert_equal 'http://test.host', new_session('http://test.host/path/to/api').host
  end

  test "offers session-based API client (remote reference)" do
    assert_instance_of OpenX::XmlrpcSessionClient, new_session.remote
  end

  test "login working" do
    assert_nothing_raised { new_session.create(config['username'], config['password']) }
  end

  test "logout working" do
    assert_nothing_raised { new_session.create(config['username'], config['password']) }
    assert_not_nil new_session.id
    assert_nothing_raised { new_session.destroy }
    assert_nil new_session.id
  end

  private

    def config
      OpenX.configuration
    end

    def new_session(url = config['url'])
      @session ||= Session.new(url)
    end

end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
krakatoa-openx-1.9.4 test/test_session.rb
bsm-openx-1.9.4 test/test_session.rb
bsm-openx-1.9.3 test/test_session.rb
bsm-openx-1.9.2 test/test_session.rb
bsm-openx-1.9.1 test/test_session.rb