@@ -16,7 +16,6 @@ def mock_main_functions():
16
16
functions = [
17
17
'DjangoProject' ,
18
18
'sanity_checks' ,
19
- 'create_virtualenv' ,
20
19
'create_webapp' ,
21
20
'add_static_file_mappings' ,
22
21
'reload_webapp' ,
@@ -44,21 +43,19 @@ def test_calls_all_stuff_in_right_order(self, mock_main_functions):
44
43
mock_django_project = mock_main_functions .DjangoProject .return_value
45
44
assert mock_main_functions .method_calls == [
46
45
call .sanity_checks ('www.domain.com' , nuke = 'nuke option' ),
47
- call .create_virtualenv (
48
- 'www.domain.com' , 'python.version' , 'django==django.version' , nuke = 'nuke option'
49
- ),
50
46
call .DjangoProject ('www.domain.com' ),
51
47
call .create_webapp (
52
48
'www.domain.com' ,
53
49
'python.version' ,
54
- mock_main_functions . create_virtualenv . return_value ,
50
+ mock_django_project . virtualenv_path ,
55
51
mock_django_project .project_path ,
56
52
nuke = 'nuke option'
57
53
),
58
54
call .add_static_file_mappings ('www.domain.com' , mock_django_project .project_path ),
59
55
call .reload_webapp ('www.domain.com' )
60
56
]
61
57
assert mock_django_project .method_calls == [
58
+ call .create_virtualenv ('django.version' , nuke = 'nuke option' ),
62
59
call .run_startproject (nuke = 'nuke option' ),
63
60
call .update_settings_file (),
64
61
call .run_collectstatic (),
@@ -69,8 +66,8 @@ def test_calls_all_stuff_in_right_order(self, mock_main_functions):
69
66
def test_domain_defaults_to_using_current_username (self , mock_main_functions ):
70
67
username = getpass .getuser ()
71
68
main ('your-username.pythonanywhere.com' , 'django.version' , 'python.version' , nuke = False )
72
- assert mock_main_functions .create_virtualenv .call_args == call (
73
- username + '.pythonanywhere.com' , 'python.version' , 'django==django.version' , nuke = False
69
+ assert mock_main_functions .DjangoProject .call_args == call (
70
+ username + '.pythonanywhere.com'
74
71
)
75
72
assert mock_main_functions .reload_webapp .call_args == call (
76
73
username + '.pythonanywhere.com' ,
@@ -81,21 +78,14 @@ def test_lowercases_username(self, mock_main_functions):
81
78
with patch ('scripts.pa_start_django_webapp_with_virtualenv.getpass' ) as mock_getpass :
82
79
mock_getpass .getuser .return_value = 'UserName1'
83
80
main ('your-username.pythonanywhere.com' , 'django.version' , 'python.version' , 'nukey' )
84
- assert mock_main_functions .create_virtualenv .call_args == call (
85
- 'username1.pythonanywhere.com' , 'python.version' , 'django==django.version' , nuke = 'nukey'
81
+ assert mock_main_functions .DjangoProject .call_args == call (
82
+ 'username1.pythonanywhere.com'
86
83
)
87
84
assert mock_main_functions .reload_webapp .call_args == call (
88
85
'username1.pythonanywhere.com' ,
89
86
)
90
87
91
88
92
- def test_django_latest_is_just_django_for_virtualenv (self , mock_main_functions ):
93
- main ('www.domain.com' , 'latest' , 'python.version' , nuke = 'nuke option' )
94
- assert mock_main_functions .create_virtualenv .call_args == call (
95
- 'www.domain.com' , 'python.version' , 'django' , nuke = 'nuke option'
96
- )
97
-
98
-
99
89
@pytest .mark .slowtest
100
90
def test_creates_django_project_in_virtualenv_with_hacked_settings_and_static_files (
101
91
self , fake_home , virtualenvs_folder , api_responses , api_token
0 commit comments