annotate test/unit/user_test.rb @ 864:2465362d1b56 bug_145

Close obsolete branch bug_145
author Chris Cannam
date Wed, 11 May 2011 11:57:41 +0100
parents 94944d00e43c
children af80e5618e9b
rev   line source
Chris@0 1 # redMine - project management software
Chris@0 2 # Copyright (C) 2006 Jean-Philippe Lang
Chris@0 3 #
Chris@0 4 # This program is free software; you can redistribute it and/or
Chris@0 5 # modify it under the terms of the GNU General Public License
Chris@0 6 # as published by the Free Software Foundation; either version 2
Chris@0 7 # of the License, or (at your option) any later version.
Chris@0 8 #
Chris@0 9 # This program is distributed in the hope that it will be useful,
Chris@0 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
Chris@0 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Chris@0 12 # GNU General Public License for more details.
Chris@0 13 #
Chris@0 14 # You should have received a copy of the GNU General Public License
Chris@0 15 # along with this program; if not, write to the Free Software
Chris@0 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Chris@0 17
Chris@0 18 require File.dirname(__FILE__) + '/../test_helper'
Chris@0 19
Chris@0 20 class UserTest < ActiveSupport::TestCase
Chris@0 21 fixtures :users, :members, :projects, :roles, :member_roles, :auth_sources
Chris@0 22
Chris@0 23 def setup
Chris@0 24 @admin = User.find(1)
Chris@0 25 @jsmith = User.find(2)
Chris@0 26 @dlopper = User.find(3)
Chris@0 27 end
Chris@0 28
Chris@0 29 test 'object_daddy creation' do
Chris@0 30 User.generate_with_protected!(:firstname => 'Testing connection')
Chris@0 31 User.generate_with_protected!(:firstname => 'Testing connection')
Chris@0 32 assert_equal 2, User.count(:all, :conditions => {:firstname => 'Testing connection'})
Chris@0 33 end
Chris@0 34
Chris@0 35 def test_truth
Chris@0 36 assert_kind_of User, @jsmith
Chris@0 37 end
Chris@1 38
Chris@1 39 def test_mail_should_be_stripped
Chris@1 40 u = User.new
Chris@1 41 u.mail = " foo@bar.com "
Chris@1 42 assert_equal "foo@bar.com", u.mail
Chris@1 43 end
Chris@0 44
Chris@0 45 def test_create
Chris@0 46 user = User.new(:firstname => "new", :lastname => "user", :mail => "newuser@somenet.foo")
Chris@0 47
Chris@0 48 user.login = "jsmith"
Chris@0 49 user.password, user.password_confirmation = "password", "password"
Chris@0 50 # login uniqueness
Chris@0 51 assert !user.save
Chris@0 52 assert_equal 1, user.errors.count
Chris@0 53
Chris@0 54 user.login = "newuser"
Chris@0 55 user.password, user.password_confirmation = "passwd", "password"
Chris@0 56 # password confirmation
Chris@0 57 assert !user.save
Chris@0 58 assert_equal 1, user.errors.count
Chris@0 59
Chris@0 60 user.password, user.password_confirmation = "password", "password"
Chris@0 61 assert user.save
Chris@0 62 end
chris@37 63
chris@37 64 context "User#before_create" do
chris@37 65 should "set the mail_notification to the default Setting" do
chris@37 66 @user1 = User.generate_with_protected!
chris@37 67 assert_equal 'only_my_events', @user1.mail_notification
chris@37 68
chris@37 69 with_settings :default_notification_option => 'all' do
chris@37 70 @user2 = User.generate_with_protected!
chris@37 71 assert_equal 'all', @user2.mail_notification
chris@37 72 end
chris@37 73 end
chris@37 74 end
Chris@0 75
Chris@0 76 context "User.login" do
Chris@0 77 should "be case-insensitive." do
Chris@0 78 u = User.new(:firstname => "new", :lastname => "user", :mail => "newuser@somenet.foo")
Chris@0 79 u.login = 'newuser'
Chris@0 80 u.password, u.password_confirmation = "password", "password"
Chris@0 81 assert u.save
Chris@0 82
Chris@0 83 u = User.new(:firstname => "Similar", :lastname => "User", :mail => "similaruser@somenet.foo")
Chris@0 84 u.login = 'NewUser'
Chris@0 85 u.password, u.password_confirmation = "password", "password"
Chris@0 86 assert !u.save
Chris@0 87 assert_equal I18n.translate('activerecord.errors.messages.taken'), u.errors.on(:login)
Chris@0 88 end
Chris@0 89 end
Chris@0 90
Chris@0 91 def test_mail_uniqueness_should_not_be_case_sensitive
Chris@0 92 u = User.new(:firstname => "new", :lastname => "user", :mail => "newuser@somenet.foo")
Chris@0 93 u.login = 'newuser1'
Chris@0 94 u.password, u.password_confirmation = "password", "password"
Chris@0 95 assert u.save
Chris@0 96
Chris@0 97 u = User.new(:firstname => "new", :lastname => "user", :mail => "newUser@Somenet.foo")
Chris@0 98 u.login = 'newuser2'
Chris@0 99 u.password, u.password_confirmation = "password", "password"
Chris@0 100 assert !u.save
Chris@0 101 assert_equal I18n.translate('activerecord.errors.messages.taken'), u.errors.on(:mail)
Chris@0 102 end
Chris@0 103
Chris@0 104 def test_update
Chris@0 105 assert_equal "admin", @admin.login
Chris@0 106 @admin.login = "john"
Chris@0 107 assert @admin.save, @admin.errors.full_messages.join("; ")
Chris@0 108 @admin.reload
Chris@0 109 assert_equal "john", @admin.login
Chris@0 110 end
Chris@0 111
Chris@0 112 def test_destroy
Chris@0 113 User.find(2).destroy
Chris@0 114 assert_nil User.find_by_id(2)
Chris@0 115 assert Member.find_all_by_user_id(2).empty?
Chris@0 116 end
Chris@0 117
Chris@0 118 def test_validate
Chris@0 119 @admin.login = ""
Chris@0 120 assert !@admin.save
Chris@0 121 assert_equal 1, @admin.errors.count
Chris@0 122 end
Chris@0 123
Chris@0 124 context "User#try_to_login" do
Chris@0 125 should "fall-back to case-insensitive if user login is not found as-typed." do
Chris@0 126 user = User.try_to_login("AdMin", "admin")
Chris@0 127 assert_kind_of User, user
Chris@0 128 assert_equal "admin", user.login
Chris@0 129 end
Chris@0 130
Chris@0 131 should "select the exact matching user first" do
Chris@0 132 case_sensitive_user = User.generate_with_protected!(:login => 'changed', :password => 'admin', :password_confirmation => 'admin')
Chris@0 133 # bypass validations to make it appear like existing data
Chris@0 134 case_sensitive_user.update_attribute(:login, 'ADMIN')
Chris@0 135
Chris@0 136 user = User.try_to_login("ADMIN", "admin")
Chris@0 137 assert_kind_of User, user
Chris@0 138 assert_equal "ADMIN", user.login
Chris@0 139
Chris@0 140 end
Chris@0 141 end
Chris@0 142
Chris@0 143 def test_password
Chris@0 144 user = User.try_to_login("admin", "admin")
Chris@0 145 assert_kind_of User, user
Chris@0 146 assert_equal "admin", user.login
Chris@0 147 user.password = "hello"
Chris@0 148 assert user.save
Chris@0 149
Chris@0 150 user = User.try_to_login("admin", "hello")
Chris@0 151 assert_kind_of User, user
Chris@0 152 assert_equal "admin", user.login
Chris@0 153 assert_equal User.hash_password("hello"), user.hashed_password
Chris@0 154 end
Chris@0 155
Chris@0 156 def test_name_format
Chris@0 157 assert_equal 'Smith, John', @jsmith.name(:lastname_coma_firstname)
Chris@0 158 Setting.user_format = :firstname_lastname
Chris@0 159 assert_equal 'John Smith', @jsmith.reload.name
Chris@0 160 Setting.user_format = :username
Chris@0 161 assert_equal 'jsmith', @jsmith.reload.name
Chris@0 162 end
Chris@0 163
Chris@0 164 def test_lock
Chris@0 165 user = User.try_to_login("jsmith", "jsmith")
Chris@0 166 assert_equal @jsmith, user
Chris@0 167
Chris@0 168 @jsmith.status = User::STATUS_LOCKED
Chris@0 169 assert @jsmith.save
Chris@0 170
Chris@0 171 user = User.try_to_login("jsmith", "jsmith")
Chris@0 172 assert_equal nil, user
Chris@0 173 end
Chris@0 174
Chris@0 175 if ldap_configured?
Chris@0 176 context "#try_to_login using LDAP" do
Chris@0 177 context "with failed connection to the LDAP server" do
Chris@0 178 should "return nil" do
Chris@0 179 @auth_source = AuthSourceLdap.find(1)
Chris@0 180 AuthSource.any_instance.stubs(:initialize_ldap_con).raises(Net::LDAP::LdapError, 'Cannot connect')
Chris@0 181
Chris@0 182 assert_equal nil, User.try_to_login('edavis', 'wrong')
Chris@0 183 end
Chris@0 184 end
Chris@0 185
Chris@0 186 context "with an unsuccessful authentication" do
Chris@0 187 should "return nil" do
Chris@0 188 assert_equal nil, User.try_to_login('edavis', 'wrong')
Chris@0 189 end
Chris@0 190 end
Chris@0 191
Chris@0 192 context "on the fly registration" do
Chris@0 193 setup do
Chris@0 194 @auth_source = AuthSourceLdap.find(1)
Chris@0 195 end
Chris@0 196
Chris@0 197 context "with a successful authentication" do
Chris@0 198 should "create a new user account if it doesn't exist" do
Chris@0 199 assert_difference('User.count') do
Chris@0 200 user = User.try_to_login('edavis', '123456')
Chris@0 201 assert !user.admin?
Chris@0 202 end
Chris@0 203 end
Chris@0 204
Chris@0 205 should "retrieve existing user" do
Chris@0 206 user = User.try_to_login('edavis', '123456')
Chris@0 207 user.admin = true
Chris@0 208 user.save!
Chris@0 209
Chris@0 210 assert_no_difference('User.count') do
Chris@0 211 user = User.try_to_login('edavis', '123456')
Chris@0 212 assert user.admin?
Chris@0 213 end
Chris@0 214 end
Chris@0 215 end
Chris@0 216 end
Chris@0 217 end
Chris@0 218
Chris@0 219 else
Chris@0 220 puts "Skipping LDAP tests."
Chris@0 221 end
Chris@0 222
Chris@0 223 def test_create_anonymous
Chris@0 224 AnonymousUser.delete_all
Chris@0 225 anon = User.anonymous
Chris@0 226 assert !anon.new_record?
Chris@0 227 assert_kind_of AnonymousUser, anon
Chris@0 228 end
Chris@0 229
Chris@0 230 should_have_one :rss_token
Chris@0 231
Chris@0 232 def test_rss_key
Chris@0 233 assert_nil @jsmith.rss_token
Chris@0 234 key = @jsmith.rss_key
Chris@0 235 assert_equal 40, key.length
Chris@0 236
Chris@0 237 @jsmith.reload
Chris@0 238 assert_equal key, @jsmith.rss_key
Chris@0 239 end
Chris@0 240
Chris@0 241
Chris@0 242 should_have_one :api_token
Chris@0 243
Chris@0 244 context "User#api_key" do
Chris@0 245 should "generate a new one if the user doesn't have one" do
Chris@0 246 user = User.generate_with_protected!(:api_token => nil)
Chris@0 247 assert_nil user.api_token
Chris@0 248
Chris@0 249 key = user.api_key
Chris@0 250 assert_equal 40, key.length
Chris@0 251 user.reload
Chris@0 252 assert_equal key, user.api_key
Chris@0 253 end
Chris@0 254
Chris@0 255 should "return the existing api token value" do
Chris@0 256 user = User.generate_with_protected!
Chris@0 257 token = Token.generate!(:action => 'api')
Chris@0 258 user.api_token = token
Chris@0 259 assert user.save
Chris@0 260
Chris@0 261 assert_equal token.value, user.api_key
Chris@0 262 end
Chris@0 263 end
Chris@0 264
Chris@0 265 context "User#find_by_api_key" do
Chris@0 266 should "return nil if no matching key is found" do
Chris@0 267 assert_nil User.find_by_api_key('zzzzzzzzz')
Chris@0 268 end
Chris@0 269
Chris@0 270 should "return nil if the key is found for an inactive user" do
Chris@0 271 user = User.generate_with_protected!(:status => User::STATUS_LOCKED)
Chris@0 272 token = Token.generate!(:action => 'api')
Chris@0 273 user.api_token = token
Chris@0 274 user.save
Chris@0 275
Chris@0 276 assert_nil User.find_by_api_key(token.value)
Chris@0 277 end
Chris@0 278
Chris@0 279 should "return the user if the key is found for an active user" do
Chris@0 280 user = User.generate_with_protected!(:status => User::STATUS_ACTIVE)
Chris@0 281 token = Token.generate!(:action => 'api')
Chris@0 282 user.api_token = token
Chris@0 283 user.save
Chris@0 284
Chris@0 285 assert_equal user, User.find_by_api_key(token.value)
Chris@0 286 end
Chris@0 287 end
Chris@0 288
Chris@0 289 def test_roles_for_project
Chris@0 290 # user with a role
Chris@0 291 roles = @jsmith.roles_for_project(Project.find(1))
Chris@0 292 assert_kind_of Role, roles.first
Chris@0 293 assert_equal "Manager", roles.first.name
Chris@0 294
Chris@0 295 # user with no role
Chris@0 296 assert_nil @dlopper.roles_for_project(Project.find(2)).detect {|role| role.member?}
Chris@0 297 end
Chris@0 298
Chris@0 299 def test_mail_notification_all
chris@37 300 @jsmith.mail_notification = 'all'
Chris@0 301 @jsmith.notified_project_ids = []
Chris@0 302 @jsmith.save
Chris@0 303 @jsmith.reload
Chris@0 304 assert @jsmith.projects.first.recipients.include?(@jsmith.mail)
Chris@0 305 end
Chris@0 306
Chris@0 307 def test_mail_notification_selected
chris@37 308 @jsmith.mail_notification = 'selected'
Chris@0 309 @jsmith.notified_project_ids = [1]
Chris@0 310 @jsmith.save
Chris@0 311 @jsmith.reload
Chris@0 312 assert Project.find(1).recipients.include?(@jsmith.mail)
Chris@0 313 end
Chris@0 314
chris@37 315 def test_mail_notification_only_my_events
chris@37 316 @jsmith.mail_notification = 'only_my_events'
Chris@0 317 @jsmith.notified_project_ids = []
Chris@0 318 @jsmith.save
Chris@0 319 @jsmith.reload
Chris@0 320 assert !@jsmith.projects.first.recipients.include?(@jsmith.mail)
Chris@0 321 end
Chris@0 322
Chris@0 323 def test_comments_sorting_preference
Chris@0 324 assert !@jsmith.wants_comments_in_reverse_order?
Chris@0 325 @jsmith.pref.comments_sorting = 'asc'
Chris@0 326 assert !@jsmith.wants_comments_in_reverse_order?
Chris@0 327 @jsmith.pref.comments_sorting = 'desc'
Chris@0 328 assert @jsmith.wants_comments_in_reverse_order?
Chris@0 329 end
Chris@0 330
Chris@0 331 def test_find_by_mail_should_be_case_insensitive
Chris@0 332 u = User.find_by_mail('JSmith@somenet.foo')
Chris@0 333 assert_not_nil u
Chris@0 334 assert_equal 'jsmith@somenet.foo', u.mail
Chris@0 335 end
Chris@0 336
Chris@0 337 def test_random_password
Chris@0 338 u = User.new
Chris@0 339 u.random_password
Chris@0 340 assert !u.password.blank?
Chris@0 341 assert !u.password_confirmation.blank?
Chris@0 342 end
Chris@0 343
Chris@0 344 context "#change_password_allowed?" do
Chris@0 345 should "be allowed if no auth source is set" do
Chris@0 346 user = User.generate_with_protected!
Chris@0 347 assert user.change_password_allowed?
Chris@0 348 end
Chris@0 349
Chris@0 350 should "delegate to the auth source" do
Chris@0 351 user = User.generate_with_protected!
Chris@0 352
Chris@0 353 allowed_auth_source = AuthSource.generate!
Chris@0 354 def allowed_auth_source.allow_password_changes?; true; end
Chris@0 355
Chris@0 356 denied_auth_source = AuthSource.generate!
Chris@0 357 def denied_auth_source.allow_password_changes?; false; end
Chris@0 358
Chris@0 359 assert user.change_password_allowed?
Chris@0 360
Chris@0 361 user.auth_source = allowed_auth_source
Chris@0 362 assert user.change_password_allowed?, "User not allowed to change password, though auth source does"
Chris@0 363
Chris@0 364 user.auth_source = denied_auth_source
Chris@0 365 assert !user.change_password_allowed?, "User allowed to change password, though auth source does not"
Chris@0 366 end
Chris@0 367
Chris@0 368 end
Chris@0 369
chris@22 370 context "#allowed_to?" do
chris@22 371 context "with a unique project" do
chris@22 372 should "return false if project is archived" do
chris@22 373 project = Project.find(1)
chris@22 374 Project.any_instance.stubs(:status).returns(Project::STATUS_ARCHIVED)
chris@22 375 assert ! @admin.allowed_to?(:view_issues, Project.find(1))
chris@22 376 end
chris@22 377
chris@22 378 should "return false if related module is disabled" do
chris@22 379 project = Project.find(1)
chris@22 380 project.enabled_module_names = ["issue_tracking"]
chris@22 381 assert @admin.allowed_to?(:add_issues, project)
chris@22 382 assert ! @admin.allowed_to?(:view_wiki_pages, project)
chris@22 383 end
chris@22 384
chris@22 385 should "authorize nearly everything for admin users" do
chris@22 386 project = Project.find(1)
chris@22 387 assert ! @admin.member_of?(project)
chris@22 388 %w(edit_issues delete_issues manage_news manage_documents manage_wiki).each do |p|
chris@22 389 assert @admin.allowed_to?(p.to_sym, project)
chris@22 390 end
chris@22 391 end
chris@22 392
chris@22 393 should "authorize normal users depending on their roles" do
chris@22 394 project = Project.find(1)
chris@22 395 assert @jsmith.allowed_to?(:delete_messages, project) #Manager
chris@22 396 assert ! @dlopper.allowed_to?(:delete_messages, project) #Developper
chris@22 397 end
chris@22 398 end
chris@37 399
chris@37 400 context "with multiple projects" do
chris@37 401 should "return false if array is empty" do
chris@37 402 assert ! @admin.allowed_to?(:view_project, [])
chris@37 403 end
chris@37 404
chris@37 405 should "return true only if user has permission on all these projects" do
chris@37 406 assert @admin.allowed_to?(:view_project, Project.all)
chris@37 407 assert ! @dlopper.allowed_to?(:view_project, Project.all) #cannot see Project(2)
chris@37 408 assert @jsmith.allowed_to?(:edit_issues, @jsmith.projects) #Manager or Developer everywhere
chris@37 409 assert ! @jsmith.allowed_to?(:delete_issue_watchers, @jsmith.projects) #Dev cannot delete_issue_watchers
chris@37 410 end
chris@37 411
chris@37 412 should "behave correctly with arrays of 1 project" do
chris@37 413 assert ! User.anonymous.allowed_to?(:delete_issues, [Project.first])
chris@37 414 end
chris@37 415 end
chris@22 416
chris@22 417 context "with options[:global]" do
chris@22 418 should "authorize if user has at least one role that has this permission" do
chris@22 419 @dlopper2 = User.find(5) #only Developper on a project, not Manager anywhere
chris@22 420 @anonymous = User.find(6)
chris@22 421 assert @jsmith.allowed_to?(:delete_issue_watchers, nil, :global => true)
chris@22 422 assert ! @dlopper2.allowed_to?(:delete_issue_watchers, nil, :global => true)
chris@22 423 assert @dlopper2.allowed_to?(:add_issues, nil, :global => true)
chris@22 424 assert ! @anonymous.allowed_to?(:add_issues, nil, :global => true)
chris@22 425 assert @anonymous.allowed_to?(:view_issues, nil, :global => true)
chris@22 426 end
chris@22 427 end
chris@22 428 end
chris@22 429
chris@37 430 context "User#notify_about?" do
chris@37 431 context "Issues" do
chris@37 432 setup do
chris@37 433 @project = Project.find(1)
chris@37 434 @author = User.generate_with_protected!
chris@37 435 @assignee = User.generate_with_protected!
chris@37 436 @issue = Issue.generate_for_project!(@project, :assigned_to => @assignee, :author => @author)
chris@37 437 end
chris@37 438
chris@37 439 should "be true for a user with :all" do
chris@37 440 @author.update_attribute(:mail_notification, :all)
chris@37 441 assert @author.notify_about?(@issue)
chris@37 442 end
chris@37 443
chris@37 444 should "be false for a user with :none" do
chris@37 445 @author.update_attribute(:mail_notification, :none)
chris@37 446 assert ! @author.notify_about?(@issue)
chris@37 447 end
chris@37 448
chris@37 449 should "be false for a user with :only_my_events and isn't an author, creator, or assignee" do
chris@37 450 @user = User.generate_with_protected!(:mail_notification => :only_my_events)
chris@37 451 assert ! @user.notify_about?(@issue)
chris@37 452 end
chris@37 453
chris@37 454 should "be true for a user with :only_my_events and is the author" do
chris@37 455 @author.update_attribute(:mail_notification, :only_my_events)
chris@37 456 assert @author.notify_about?(@issue)
chris@37 457 end
chris@37 458
chris@37 459 should "be true for a user with :only_my_events and is the assignee" do
chris@37 460 @assignee.update_attribute(:mail_notification, :only_my_events)
chris@37 461 assert @assignee.notify_about?(@issue)
chris@37 462 end
chris@37 463
chris@37 464 should "be true for a user with :only_assigned and is the assignee" do
chris@37 465 @assignee.update_attribute(:mail_notification, :only_assigned)
chris@37 466 assert @assignee.notify_about?(@issue)
chris@37 467 end
chris@37 468
chris@37 469 should "be false for a user with :only_assigned and is not the assignee" do
chris@37 470 @author.update_attribute(:mail_notification, :only_assigned)
chris@37 471 assert ! @author.notify_about?(@issue)
chris@37 472 end
chris@37 473
chris@37 474 should "be true for a user with :only_owner and is the author" do
chris@37 475 @author.update_attribute(:mail_notification, :only_owner)
chris@37 476 assert @author.notify_about?(@issue)
chris@37 477 end
chris@37 478
chris@37 479 should "be false for a user with :only_owner and is not the author" do
chris@37 480 @assignee.update_attribute(:mail_notification, :only_owner)
chris@37 481 assert ! @assignee.notify_about?(@issue)
chris@37 482 end
chris@37 483
chris@37 484 should "be false if the mail_notification is anything else" do
chris@37 485 @assignee.update_attribute(:mail_notification, :somthing_else)
chris@37 486 assert ! @assignee.notify_about?(@issue)
chris@37 487 end
chris@37 488
chris@37 489 end
chris@37 490
chris@37 491 context "other events" do
chris@37 492 should 'be added and tested'
chris@37 493 end
chris@37 494 end
chris@37 495
Chris@0 496 if Object.const_defined?(:OpenID)
Chris@0 497
Chris@0 498 def test_setting_identity_url
Chris@0 499 normalized_open_id_url = 'http://example.com/'
Chris@0 500 u = User.new( :identity_url => 'http://example.com/' )
Chris@0 501 assert_equal normalized_open_id_url, u.identity_url
Chris@0 502 end
Chris@0 503
Chris@0 504 def test_setting_identity_url_without_trailing_slash
Chris@0 505 normalized_open_id_url = 'http://example.com/'
Chris@0 506 u = User.new( :identity_url => 'http://example.com' )
Chris@0 507 assert_equal normalized_open_id_url, u.identity_url
Chris@0 508 end
Chris@0 509
Chris@0 510 def test_setting_identity_url_without_protocol
Chris@0 511 normalized_open_id_url = 'http://example.com/'
Chris@0 512 u = User.new( :identity_url => 'example.com' )
Chris@0 513 assert_equal normalized_open_id_url, u.identity_url
Chris@0 514 end
Chris@0 515
Chris@0 516 def test_setting_blank_identity_url
Chris@0 517 u = User.new( :identity_url => 'example.com' )
Chris@0 518 u.identity_url = ''
Chris@0 519 assert u.identity_url.blank?
Chris@0 520 end
Chris@0 521
Chris@0 522 def test_setting_invalid_identity_url
Chris@0 523 u = User.new( :identity_url => 'this is not an openid url' )
Chris@0 524 assert u.identity_url.blank?
Chris@0 525 end
Chris@0 526
Chris@0 527 else
Chris@0 528 puts "Skipping openid tests."
Chris@0 529 end
Chris@0 530
Chris@0 531 end