Sha256: 8d55055f1cdfbc882cdec6276f601d3cbc5fc07200e9ff60ccdfe024a374d59b

Contents?: true

Size: 731 Bytes

Versions: 1

Compression:

Stored size: 731 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, true)
    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, true)
    assert_raise OpenbisQueryException do
      au.login
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
openseek-api-0.18 test/authentication_test.rb