summaryrefslogtreecommitdiff
path: root/test/aa.rb
blob: f785900f9f49fce33a722be929463db1d6cf622b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
require_relative "setup.rb"

class AATest < MiniTest::Test

  def self.test_order
    :alpha
  end

  def test_0_login
    res = RestClientWrapper.post(File.join($host,"aa/authenticate"),{:username=>"guest", :password => "guest"},{:Accept => "text/plain"})
    assert_equal res.code, 200
    assert_equal res.size, 62
    @@token = res
  end
  
  def test_1_logout
    assert @@token
    assert_equal @@token.size, 62
    res = RestClientWrapper.post(File.join($host,"aa/logout"),{:subjectid=>@@token},{:Accept => "text/plain"})
    assert_equal res.code, 200
    assert_equal res, "Successfully logged out. \n"
    res = RestClientWrapper.post(File.join($host,"aa/logout"),{:subjectid=>@@token},{:Accept => "text/plain"})
    assert_equal res.code, 200
    assert_equal res, "Logout failed.\n"
  end  

end