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