fixtures :users, :email_addresses, :members, :member_roles, :roles, :projects
test "GET /users.xml should return users" do
+ users = User.active.order('login')
+ users.last.update(twofa_scheme: 'totp')
get '/users.xml', :headers => credentials('admin')
assert_response :success
assert_equal 'application/xml', response.media_type
assert_select 'users' do
- users = User.active.order('login')
assert_select 'user', :count => users.size do |nodeset|
nodeset.zip(users) do |user_element, user|
assert_select user_element, 'id', :text => user.id.to_s
assert_select user_element, 'updated_on', :text => user.updated_on.iso8601
+ assert_select user_element, 'twofa_scheme', :text => user.twofa_scheme.to_s
# No one has changed password.
assert_select user_element, 'passwd_changed_on', :text => ''
+
+ if user == users.last
+ assert_select user_element, 'twofa_scheme', :text => 'totp'
+ else
+ assert_select user_element, 'twofa_scheme', :text => ''
+ end
end
end
end
end
test "GET /users.json should return users" do
+ users = User.active.order('login')
+ users.last.update(twofa_scheme: 'totp')
get '/users.json', :headers => credentials('admin')
assert_response :success
# No one has changed password.
assert_nil user_json['passwd_changed_on']
+
+ if user == users.last
+ assert_equal 'totp', user_json['twofa_scheme']
+ else
+ assert_nil user_json['twofa_scheme']
+ end
end
end
assert_select 'user id', :text => '2'
assert_select 'user updated_on', :text => Time.zone.parse('2006-07-19T20:42:15Z').iso8601
assert_select 'user passwd_changed_on', :text => ''
+ assert_select 'user twofa_scheme', :text => ''
end
test "GET /users/:id.json should return the user" do
assert_equal 2, json['user']['id']
assert_equal Time.zone.parse('2006-07-19T20:42:15Z').iso8601, json['user']['updated_on']
assert_nil json['user']['passwd_changed_on']
+ assert_nil json['user']['twofa_scheme']
end
test "GET /users/:id.xml with include=memberships should include memberships" do