Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 13
- Log:
Initial import of Typo 2.6.0 sources from a downloaded Tarball.
Typo is a Ruby On Rails based blog engine.
- Author:
- adh
- Date:
- Sat Jul 22 22:25:02 +0100 2006
- Size:
- 2719 Bytes
1 | require File.dirname(__FILE__) + '/../test_helper' |
2 | |
3 | class UserTest < Test::Unit::TestCase |
4 | |
5 | fixtures :users |
6 | |
7 | def test_auth |
8 | |
9 | assert_equal @bob, User.authenticate("bob", "test") |
10 | assert_nil User.authenticate("nonbob", "test") |
11 | |
12 | end |
13 | |
14 | def test_authenticate? |
15 | assert User.authenticate?("bob", "test") |
16 | assert !User.authenticate?("bob", "wrong password") |
17 | assert User.authenticate?("tobi", "whatever") |
18 | assert !User.authenticate?("tobi", "not whatever") |
19 | end |
20 | |
21 | def test_disallowed_passwords |
22 | |
23 | u = User.new |
24 | u.login = "nonbob" |
25 | |
26 | u.password = u.password_confirmation = "tiny" |
27 | assert !u.save |
28 | assert u.errors.invalid?('password') |
29 | |
30 | u.password = u.password_confirmation = "hugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehuge" |
31 | assert !u.save |
32 | assert u.errors.invalid?('password') |
33 | |
34 | u.password = u.password_confirmation = "" |
35 | assert !u.save |
36 | assert u.errors.invalid?('password') |
37 | |
38 | u.password = u.password_confirmation = "bobs_secure_password" |
39 | assert u.save |
40 | assert u.errors.empty? |
41 | |
42 | end |
43 | |
44 | def test_bad_logins |
45 | |
46 | u = User.new |
47 | u.password = u.password_confirmation = "bobs_secure_password" |
48 | |
49 | u.login = "x" |
50 | assert !u.save |
51 | assert u.errors.invalid?('login') |
52 | |
53 | u.login = "hugebobhugebobhugebobhugebobhugebobhugebobhugebobhugebobhugebobhugebobhugebobhugebobhugebobhugebobhugebobhugebobhugebobhugebobhugebobhugebobhugebobhugebobhugebobhugebobhugebobhugebobhug" |
54 | assert !u.save |
55 | assert u.errors.invalid?('login') |
56 | |
57 | u.login = "" |
58 | assert !u.save |
59 | assert u.errors.invalid?('login') |
60 | |
61 | u.login = "okbob" |
62 | assert u.save |
63 | assert u.errors.empty? |
64 | |
65 | end |
66 | |
67 | def test_change_name |
68 | u = User.new |
69 | u.password = u.password_confirmation = "a_password" |
70 | u.login = 'xxx' |
71 | assert u.save |
72 | |
73 | u.password = u.password_confirmation = '' |
74 | u.name = 'X X X' |
75 | u.email = 'x@example.com' |
76 | assert u.save |
77 | end |
78 | |
79 | def test_collision |
80 | u = User.new |
81 | u.login = "existingbob" |
82 | u.password = u.password_confirmation = "bobs_secure_password" |
83 | assert !u.save |
84 | end |
85 | |
86 | |
87 | def test_create |
88 | u = User.new |
89 | u.login = "nonexistingbob" |
90 | u.password = u.password_confirmation = "bobs_secure_password" |
91 | |
92 | assert u.save |
93 | |
94 | end |
95 | |
96 | def test_sha1 |
97 | u = User.new |
98 | u.login = "nonexistingbob" |
99 | u.password = u.password_confirmation = "bobs_secure_password" |
100 | assert u.save |
101 | |
102 | assert_equal '98740ff87bade6d895010bceebbd9f718e7856bb', u.password |
103 | end |
104 | end |