Skip to content

Commit 7b9f468

Browse files
committed
Fix tests
1 parent 4de7dd1 commit 7b9f468

File tree

3 files changed

+30
-30
lines changed

3 files changed

+30
-30
lines changed

jupyterlab_git/tests/test_clone.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,17 @@ def test_git_clone_failure_from_git(mock_subproc_popen):
6767
])
6868
assert {'code': 128, 'message': 'fatal: Not a git repository'} == actual_response
6969

70-
@patch('jupyterlab_git.git.git_auth_input_wrapper')
70+
@patch('jupyterlab_git.git.GitAuthInputWrapper')
7171
@patch('os.environ', {'TEST': 'test'})
72-
def test_git_clone_with_auth_success(mock_git_auth_input_wrapper):
72+
def test_git_clone_with_auth_success(mock_GitAuthInputWrapper):
7373
# Given
7474
process_mock = Mock()
7575
attrs = {
7676
'communicate.return_value': '',
7777
'returncode': 0
7878
}
7979
process_mock.configure_mock(**attrs)
80-
mock_git_auth_input_wrapper.return_value = process_mock
80+
mock_GitAuthInputWrapper.return_value = process_mock
8181

8282
# When
8383
auth = {
@@ -87,7 +87,7 @@ def test_git_clone_with_auth_success(mock_git_auth_input_wrapper):
8787
actual_response = Git(root_dir='/bin').clone(current_path='test_curr_path', repo_url='ghjkhjkl', auth=auth)
8888

8989
# Then
90-
mock_git_auth_input_wrapper.assert_has_calls([
90+
mock_GitAuthInputWrapper.assert_has_calls([
9191
call(
9292
command = 'git clone ghjkhjkl -q',
9393
cwd = '/bin/test_curr_path',
@@ -99,9 +99,9 @@ def test_git_clone_with_auth_success(mock_git_auth_input_wrapper):
9999
])
100100
assert {'code': 0} == actual_response
101101

102-
@patch('jupyterlab_git.git.git_auth_input_wrapper')
102+
@patch('jupyterlab_git.git.GitAuthInputWrapper')
103103
@patch('os.environ', {'TEST': 'test'})
104-
def test_git_clone_with_auth_wrong_repo_url_failure_from_git(mock_git_auth_input_wrapper):
104+
def test_git_clone_with_auth_wrong_repo_url_failure_from_git(mock_GitAuthInputWrapper):
105105
"""
106106
Git internally will throw an error if it is an invalid URL, or if there is a permissions issue. We want to just
107107
relay it back to the user.
@@ -114,7 +114,7 @@ def test_git_clone_with_auth_wrong_repo_url_failure_from_git(mock_git_auth_input
114114
'returncode': 128
115115
}
116116
process_mock.configure_mock(**attrs)
117-
mock_git_auth_input_wrapper.return_value = process_mock
117+
mock_GitAuthInputWrapper.return_value = process_mock
118118

119119
# When
120120
auth = {
@@ -124,7 +124,7 @@ def test_git_clone_with_auth_wrong_repo_url_failure_from_git(mock_git_auth_input
124124
actual_response = Git(root_dir='/bin').clone(current_path='test_curr_path', repo_url='ghjkhjkl', auth=auth)
125125

126126
# Then
127-
mock_git_auth_input_wrapper.assert_has_calls([
127+
mock_GitAuthInputWrapper.assert_has_calls([
128128
call(
129129
command = 'git clone ghjkhjkl -q',
130130
cwd = '/bin/test_curr_path',
@@ -136,9 +136,9 @@ def test_git_clone_with_auth_wrong_repo_url_failure_from_git(mock_git_auth_input
136136
])
137137
assert {'code': 128, 'message': "fatal: repository 'ghjkhjkl' does not exist"} == actual_response
138138

139-
@patch('jupyterlab_git.git.git_auth_input_wrapper')
139+
@patch('jupyterlab_git.git.GitAuthInputWrapper')
140140
@patch('os.environ', {'TEST': 'test'})
141-
def test_git_clone_with_auth_auth_failure_from_git(mock_git_auth_input_wrapper):
141+
def test_git_clone_with_auth_auth_failure_from_git(mock_GitAuthInputWrapper):
142142
"""
143143
Git internally will throw an error if it is an invalid URL, or if there is a permissions issue. We want to just
144144
relay it back to the user.
@@ -151,7 +151,7 @@ def test_git_clone_with_auth_auth_failure_from_git(mock_git_auth_input_wrapper):
151151
'returncode': 128
152152
}
153153
process_mock.configure_mock(**attrs)
154-
mock_git_auth_input_wrapper.return_value = process_mock
154+
mock_GitAuthInputWrapper.return_value = process_mock
155155

156156
# When
157157
auth = {
@@ -161,7 +161,7 @@ def test_git_clone_with_auth_auth_failure_from_git(mock_git_auth_input_wrapper):
161161
actual_response = Git(root_dir='/bin').clone(current_path='test_curr_path', repo_url='ghjkhjkl', auth=auth)
162162

163163
# Then
164-
mock_git_auth_input_wrapper.assert_has_calls([
164+
mock_GitAuthInputWrapper.assert_has_calls([
165165
call(
166166
command = 'git clone ghjkhjkl -q',
167167
cwd = '/bin/test_curr_path',

jupyterlab_git/tests/test_handlers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def test_push_handler_localbranch(mock_finish, mock_git):
4747
# Then
4848
mock_git.get_current_branch.assert_called_with('test_path')
4949
mock_git.get_upstream_branch.assert_called_with('test_path', 'foo')
50-
mock_git.push.assert_called_with('.', 'HEAD:localbranch', 'test_path')
50+
mock_git.push.assert_called_with('.', 'HEAD:localbranch', 'test_path', None)
5151
mock_finish.assert_called_with('{"code": 0}')
5252

5353

@@ -67,7 +67,7 @@ def test_push_handler_remotebranch(mock_finish, mock_git):
6767
# Then
6868
mock_git.get_current_branch.assert_called_with('test_path')
6969
mock_git.get_upstream_branch.assert_called_with('test_path', 'foo')
70-
mock_git.push.assert_called_with('origin', 'HEAD:remotebranch', 'test_path')
70+
mock_git.push.assert_called_with('origin', 'HEAD:remotebranch', 'test_path', None)
7171
mock_finish.assert_called_with('{"code": 0}')
7272

7373

jupyterlab_git/tests/test_pushpull.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,17 @@ def test_git_pull_fail(mock_subproc_popen):
3333
])
3434
assert {'code': 1, 'message': 'Authentication failed'} == actual_response
3535

36-
@patch('jupyterlab_git.git.git_auth_input_wrapper')
36+
@patch('jupyterlab_git.git.GitAuthInputWrapper')
3737
@patch('os.environ', {'TEST': 'test'})
38-
def test_git_pull_with_auth_fail(mock_git_auth_input_wrapper):
38+
def test_git_pull_with_auth_fail(mock_GitAuthInputWrapper):
3939
# Given
4040
process_mock = Mock()
4141
attrs = {
4242
'communicate.return_value': "remote: Invalid username or password.\r\nfatal: Authentication failed for 'repo_url'".encode('utf-8'),
4343
'returncode': 1
4444
}
4545
process_mock.configure_mock(**attrs)
46-
mock_git_auth_input_wrapper.return_value = process_mock
46+
mock_GitAuthInputWrapper.return_value = process_mock
4747

4848
# When
4949
auth = {
@@ -54,7 +54,7 @@ def test_git_pull_with_auth_fail(mock_git_auth_input_wrapper):
5454

5555

5656
# Then
57-
mock_git_auth_input_wrapper.assert_has_calls([
57+
mock_GitAuthInputWrapper.assert_has_calls([
5858
call(
5959
command = 'git pull --no-commit',
6060
cwd='/bin/test_curr_path',
@@ -94,17 +94,17 @@ def test_git_pull_success(mock_subproc_popen):
9494
])
9595
assert {'code': 0} == actual_response
9696

97-
@patch('jupyterlab_git.git.git_auth_input_wrapper')
97+
@patch('jupyterlab_git.git.GitAuthInputWrapper')
9898
@patch('os.environ', {'TEST': 'test'})
99-
def test_git_pull_with_auth_success(mock_git_auth_input_wrapper):
99+
def test_git_pull_with_auth_success(mock_GitAuthInputWrapper):
100100
# Given
101101
process_mock = Mock()
102102
attrs = {
103103
'communicate.return_value': ('output', ''.encode('utf-8')),
104104
'returncode': 0
105105
}
106106
process_mock.configure_mock(**attrs)
107-
mock_git_auth_input_wrapper.return_value = process_mock
107+
mock_GitAuthInputWrapper.return_value = process_mock
108108

109109
# When
110110
auth = {
@@ -114,7 +114,7 @@ def test_git_pull_with_auth_success(mock_git_auth_input_wrapper):
114114
actual_response = Git(root_dir='/bin').pull('test_curr_path', auth)
115115

116116
# Then
117-
mock_git_auth_input_wrapper.assert_has_calls([
117+
mock_GitAuthInputWrapper.assert_has_calls([
118118
call(
119119
command = 'git pull --no-commit',
120120
cwd='/bin/test_curr_path',
@@ -154,17 +154,17 @@ def test_git_push_fail(mock_subproc_popen):
154154
])
155155
assert {'code': 1, 'message': 'Authentication failed'} == actual_response
156156

157-
@patch('jupyterlab_git.git.git_auth_input_wrapper')
157+
@patch('jupyterlab_git.git.GitAuthInputWrapper')
158158
@patch('os.environ', {'TEST': 'test'})
159-
def test_git_push_with_auth_fail(mock_git_auth_input_wrapper):
159+
def test_git_push_with_auth_fail(mock_GitAuthInputWrapper):
160160
# Given
161161
process_mock = Mock()
162162
attrs = {
163163
'communicate.return_value': "remote: Invalid username or password.\r\nfatal: Authentication failed for 'repo_url'".encode('utf-8'),
164164
'returncode': 1
165165
}
166166
process_mock.configure_mock(**attrs)
167-
mock_git_auth_input_wrapper.return_value = process_mock
167+
mock_GitAuthInputWrapper.return_value = process_mock
168168

169169
# When
170170
auth = {
@@ -174,7 +174,7 @@ def test_git_push_with_auth_fail(mock_git_auth_input_wrapper):
174174
actual_response = Git(root_dir='/bin').push('test_origin', 'HEAD:test_master', 'test_curr_path', auth)
175175

176176
# Then
177-
mock_git_auth_input_wrapper.assert_has_calls([
177+
mock_GitAuthInputWrapper.assert_has_calls([
178178
call(
179179
command = 'git push test_origin HEAD:test_master',
180180
cwd='/bin/test_curr_path',
@@ -215,17 +215,17 @@ def test_git_push_success(mock_subproc_popen):
215215
])
216216
assert {'code': 0} == actual_response
217217

218-
@patch('jupyterlab_git.git.git_auth_input_wrapper')
218+
@patch('jupyterlab_git.git.GitAuthInputWrapper')
219219
@patch('os.environ', {'TEST': 'test'})
220-
def test_git_push_with_auth_success(mock_git_auth_input_wrapper):
220+
def test_git_push_with_auth_success(mock_GitAuthInputWrapper):
221221
# Given
222222
process_mock = Mock()
223223
attrs = {
224224
'communicate.return_value': 'does not matter'.encode('utf-8'),
225225
'returncode': 0
226226
}
227227
process_mock.configure_mock(**attrs)
228-
mock_git_auth_input_wrapper.return_value = process_mock
228+
mock_GitAuthInputWrapper.return_value = process_mock
229229

230230
# When
231231
auth = {
@@ -235,7 +235,7 @@ def test_git_push_with_auth_success(mock_git_auth_input_wrapper):
235235
actual_response = Git(root_dir='/bin').push('.', 'HEAD:test_master', 'test_curr_path', auth)
236236

237237
# Then
238-
mock_git_auth_input_wrapper.assert_has_calls([
238+
mock_GitAuthInputWrapper.assert_has_calls([
239239
call(
240240
command = 'git push . HEAD:test_master',
241241
cwd='/bin/test_curr_path',

0 commit comments

Comments
 (0)