class TC_Password < Test::Unit::TestCase include P4RubyTest def name "Test 'p4 password' and 'p4 login'" end def test_password ticket_file = client_root() + "/.p4tickets" p4.ticket_file = ticket_file assert_equal( p4.ticket_file, ticket_file, "Ticket file not set correctly" ) assert( p4.connect, "Failed to connect to Perforce server" ) assert( p4.run_password( "", "foo" ), "Failed to set password" ) p4.password = "foo" assert( p4.password == "foo", "Password not set correctly" ) assert( p4.run_login, "Failed to login to server" ) # Note: p4.password is set by the login above to the ticket. assert( p4.run_password( "foo", "" ), "Failed to clear password" ) assert( File.exists?( ticket_file ), "Ticket file not created" ) end end