Show More
@@ -27,13 +27,14 b' from rhodecode.authentication.plugins.au' | |||||
27 | from rhodecode.model import db |
|
27 | from rhodecode.model import db | |
28 |
|
28 | |||
29 |
|
29 | |||
30 | class TestAuthPlugin(RhodeCodeAuthPluginBase): |
|
30 | class RcTestAuthPlugin(RhodeCodeAuthPluginBase): | |
31 |
|
31 | |||
32 | def name(self): |
|
32 | def name(self): | |
33 | return 'stub_auth' |
|
33 | return 'stub_auth' | |
34 |
|
34 | |||
|
35 | ||||
35 | def test_authenticate_returns_from_auth(stub_auth_data): |
|
36 | def test_authenticate_returns_from_auth(stub_auth_data): | |
36 | plugin = TestAuthPlugin('stub_id') |
|
37 | plugin = RcTestAuthPlugin('stub_id') | |
37 | with mock.patch.object(plugin, 'auth') as auth_mock: |
|
38 | with mock.patch.object(plugin, 'auth') as auth_mock: | |
38 | auth_mock.return_value = stub_auth_data |
|
39 | auth_mock.return_value = stub_auth_data | |
39 | result = plugin._authenticate(mock.Mock(), 'test', 'password', {}) |
|
40 | result = plugin._authenticate(mock.Mock(), 'test', 'password', {}) | |
@@ -42,7 +43,7 b' def test_authenticate_returns_from_auth(' | |||||
42 |
|
43 | |||
43 | def test_authenticate_returns_empty_auth_data(): |
|
44 | def test_authenticate_returns_empty_auth_data(): | |
44 | auth_data = {} |
|
45 | auth_data = {} | |
45 | plugin = TestAuthPlugin('stub_id') |
|
46 | plugin = RcTestAuthPlugin('stub_id') | |
46 | with mock.patch.object(plugin, 'auth') as auth_mock: |
|
47 | with mock.patch.object(plugin, 'auth') as auth_mock: | |
47 | auth_mock.return_value = auth_data |
|
48 | auth_mock.return_value = auth_data | |
48 | result = plugin._authenticate(mock.Mock(), 'test', 'password', {}) |
|
49 | result = plugin._authenticate(mock.Mock(), 'test', 'password', {}) | |
@@ -51,7 +52,7 b' def test_authenticate_returns_empty_auth' | |||||
51 |
|
52 | |||
52 | def test_authenticate_skips_hash_migration_if_mismatch(stub_auth_data): |
|
53 | def test_authenticate_skips_hash_migration_if_mismatch(stub_auth_data): | |
53 | stub_auth_data['_hash_migrate'] = 'new-hash' |
|
54 | stub_auth_data['_hash_migrate'] = 'new-hash' | |
54 | plugin = TestAuthPlugin('stub_id') |
|
55 | plugin = RcTestAuthPlugin('stub_id') | |
55 | with mock.patch.object(plugin, 'auth') as auth_mock: |
|
56 | with mock.patch.object(plugin, 'auth') as auth_mock: | |
56 | auth_mock.return_value = stub_auth_data |
|
57 | auth_mock.return_value = stub_auth_data | |
57 | result = plugin._authenticate(mock.Mock(), 'test', 'password', {}) |
|
58 | result = plugin._authenticate(mock.Mock(), 'test', 'password', {}) | |
@@ -65,7 +66,7 b' def test_authenticate_migrates_to_new_ha' | |||||
65 | new_password = b'new-password' |
|
66 | new_password = b'new-password' | |
66 | new_hash = _RhodeCodeCryptoBCrypt().hash_create(new_password) |
|
67 | new_hash = _RhodeCodeCryptoBCrypt().hash_create(new_password) | |
67 | stub_auth_data['_hash_migrate'] = new_hash |
|
68 | stub_auth_data['_hash_migrate'] = new_hash | |
68 | plugin = TestAuthPlugin('stub_id') |
|
69 | plugin = RcTestAuthPlugin('stub_id') | |
69 | with mock.patch.object(plugin, 'auth') as auth_mock: |
|
70 | with mock.patch.object(plugin, 'auth') as auth_mock: | |
70 | auth_mock.return_value = stub_auth_data |
|
71 | auth_mock.return_value = stub_auth_data | |
71 | result = plugin._authenticate( |
|
72 | result = plugin._authenticate( |
General Comments 0
You need to be logged in to leave comments.
Login now