Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

[1f90c6]: Allura / allura / tests / unit / patches.py Maximize Restore History

Download this file

patches.py    36 lines (22 with data), 1.0 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from mock import Mock, patch
from pylons import c
from allura.tests.unit.factories import create_project, create_app_config
def fake_app_patch(test_case):
project = create_project('myproject')
app_config = create_app_config(project, 'my_app')
app = Mock()
app.__version__ = '0'
app.config = app_config
return patch.object(c, 'app', app, create=True)
def project_app_loading_patch(test_case):
test_case.fake_app = Mock()
test_case.project_app_instance_function = Mock()
test_case.project_app_instance_function.return_value = test_case.fake_app
return patch('allura.model.project.Project.app_instance',
test_case.project_app_instance_function)
def disable_notifications_patch(test_case):
return patch('allura.model.notification.Notification.post')
def fake_redirect_patch(test_case):
return patch('allura.controllers.discuss.redirect')
def fake_request_patch(test_case):
return patch('allura.controllers.discuss.request')