Sha256: eb6a8e058f7694cfb8569af5684362af9b666a90dd93b51ab137c43580363806

Contents?: true

Size: 719 Bytes

Versions: 7

Compression:

Stored size: 719 Bytes

Contents

ENV['RAILS_ENV'] ||= 'test'
require 'coveralls'
Coveralls.wear!

require 'test/unit'
require 'openseek-api'

class AuthenticationTest < Test::Unit::TestCase
  include Fairdom::OpenbisApi

  def setup
    @as_endpoint = 'https://openbis-api.fair-dom.org/openbis/openbis'
    @username = 'apiuser'
    @password = 'apiuser'
  end

  def test_successful_authentication
    au = Authentication.new(@username, @password, @as_endpoint)
    session_token = au.login
    assert_not_nil session_token['token']
  end

  def test_failed_authentication
    invalid_password = 'blabla'
    au = Authentication.new(@username, invalid_password, @as_endpoint)
    assert_raise OpenbisQueryException do
      au.login
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
openseek-api-0.17.4 test/authentication_test.rb
openseek-api-0.17.3 test/authentication_test.rb
openseek-api-0.17.2 test/authentication_test.rb
openseek-api-0.17.1 test/authentication_test.rb
openseek-api-0.11.1 test/authentication_test.rb
openseek-api-0.11.0 test/authentication_test.rb
openseek-api-0.9.2 test/authentication_test.rb