Changeset 1818
- Timestamp:
- 09/22/08 13:56:46 (4 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
community_hive/trunk/community_hive_web/test/fixtures/users.yml
r1799 r1818 1 1 # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html 2 2 3 # one:4 # column: value5 3 4 dave: 5 id: 2 6 login: dave 7 email: dave@example.com 8 org: mitre 9 salt: 7e3041ebc2fc05a40c60028e2c4901a81035d3cd 10 crypted_password: 00742970dc9e6319f8019fd54864d3ea740f04b1 # test 11 created_at: <%= 5.days.ago.to_s :db %> 12 secret_key: "1234" 13 14 15 root: 16 id: 3 17 login: root 18 email: root@example.com 19 org: mitre 20 salt: 7e3041ebc2fc05a40c60028e2c4901a81035d3cd 21 crypted_password: 00742970dc9e6319f8019fd54864d3ea740f04b1 # test 22 created_at: <%= 5.days.ago.to_s :db %> 23 admin: true community_hive/trunk/community_hive_web/test/functional/urls_controller_test.rb
r1719 r1818 3 3 class UrlsControllerTest < ActionController::TestCase 4 4 # Replace this with your real tests. 5 def test_truth 6 assert true 5 def test_create_queue_url 6 post :create, :queue => {:url => 'http://example.com'} 7 assert_equal 1, QueueUrl.count 8 assert_response :redirect 7 9 end 8 10 end community_hive/trunk/community_hive_web/test/functional/users_controller_test.rb
r1620 r1818 2 2 3 3 class UsersControllerTest < ActionController::TestCase 4 # Replace this with your real tests. 5 def test_truth 6 assert true 4 include AuthenticatedTestHelper 5 6 7 def test_pass_update_profile 8 login_as(:dave) 9 post :update, :type => "edit_profile", :user => {:org => 'MITRE Corp'} 10 assert_equal "MITRE Corp", users("dave").org 11 assert_response :redirect 12 end 13 14 def test_fail_update_when_not_logged_in 15 post :update, :type => "edit_profile", :user => {:org => 'MITRE Corp'} 16 assert_redirected_to login_path() 17 end 18 19 def test_fail_when_hacking_form_for_admin 20 login_as(:dave) 21 post :update, :type => "edit_profile", :user => {:email => 't1@example.com', :admin => true} 22 assert_equal false, users("dave").admin 23 assert_equal "t1@example.com", users("dave").email 24 assert_response :redirect 25 end 26 27 def test_give_admin 28 login_as(:root) 29 post :admin_priv, :id => 2 30 assert_equal true, users("dave").admin 31 end 32 33 34 def test_regen_key 35 login_as(:dave) 36 k = users("dave").secret_key 37 post :regenerate 38 assert_not_equal k, User.find_by_login("dave").secret_key 7 39 end 8 40 end
