gds-sso 3.0.4 → 3.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,7 +11,7 @@ class Api::UserController < ApplicationController
11
11
 
12
12
  def reauth
13
13
  user = GDS::SSO::Config.user_klass.find_by_uid(params[:uid])
14
- if user.set_remotely_signed_out!
14
+ if user.nil? || user.set_remotely_signed_out!
15
15
  head :ok
16
16
  else
17
17
  head 500
@@ -1,5 +1,5 @@
1
1
  module GDS
2
2
  module SSO
3
- VERSION = "3.0.4"
3
+ VERSION = "3.0.5"
4
4
  end
5
5
  end
@@ -69,6 +69,17 @@ describe Api::UserController, type: :controller do
69
69
  assert_equal 403, response.status
70
70
  end
71
71
 
72
+ it "should return success if user record doesn't exist" do
73
+ request.env['warden'] = mock("mock warden")
74
+ request.env['warden'].expects(:authenticate!).at_least_once.returns(true)
75
+ request.env['warden'].expects(:authenticated?).at_least_once.returns(true)
76
+ request.env['warden'].expects(:user).at_least_once.returns(GDS::SSO::ApiUser.new)
77
+
78
+ post :reauth, uid: "nonexistent-user"
79
+
80
+ assert_equal 200, response.status
81
+ end
82
+
72
83
  it "should set remotely_signed_out to true on the user" do
73
84
  # Test that it authenticates
74
85
  request.env['warden'] = mock("mock warden")