Sha256: e3dcddd46a6f70602d36eb0ba7ec4a70454df093bd6fe2f05af47aba358f9a6a

Contents?: true

Size: 1.24 KB

Versions: 9

Compression:

Stored size: 1.24 KB

Contents

require File.expand_path('../../test_helper.rb', __FILE__)

class TestTokenAuth < Test::Unit::TestCase

  def setup
    Rockstar.lastfm = {"api_secret" => 'secret', "api_key" => 'api'}
    @auth = Rockstar::TokenAuth.new(:username => 'chunky', :token => 'bacon')
  end
  
  test 'should require a user' do
    assert_raises(ArgumentError) { Rockstar::SimpleAuth.new(:token => 'bacon') }
  end
  
  test 'should require a password' do
    assert_raises(ArgumentError) { Rockstar::SimpleAuth.new(:user => 'chunky') }
  end
  
  test 'should have the right client id' do
    assert_equal('rck', @auth.client_id)
  end
  
  test 'should have the right version' do
    assert_equal(Rockstar::Version, @auth.client_ver)
  end
  
  test 'should handshake successfully' do
    @auth.handshake!
    assert_equal('OK', @auth.status)
  end
  
  test 'should get a session id' do
    @auth.handshake!
    assert_equal('17E61E13454CDD8B68E8D7DEEEDF6170', @auth.session_id)
  end
  
  test 'should get a now playing url' do
    @auth.handshake!
    assert_equal('http://62.216.251.203:80/nowplaying', @auth.now_playing_url)
  end
  
  test 'should get a submission url' do
    @auth.handshake!
    assert_equal('http://62.216.251.205:80/protocol_1.2', @auth.submission_url)
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
rockstar-0.6.3 test/unit/test_tokenauth.rb
rockstar-0.6.2 test/unit/test_tokenauth.rb
rockstar-custom-0.6.1 test/unit/test_tokenauth.rb
rockstar-0.6.1 test/unit/test_tokenauth.rb
rockstar-0.6.0 test/unit/test_tokenauth.rb
rockstar-0.5.2 test/unit/test_tokenauth.rb
rockstar-0.5.1 test/unit/test_tokenauth.rb
rockstar-0.5.0 test/unit/test_tokenauth.rb
rockstar-0.4.2 test/unit/test_tokenauth.rb