previous commit worked, feeling confident

This commit is contained in:
Nicholas Albion
2023-10-04 18:09:28 +11:00
parent fd7958b6c4
commit 2e87627db8
2 changed files with 13 additions and 14 deletions

View File

@@ -229,12 +229,12 @@ class Project:
update_file(data['full_path'], data['content'])
# (File.insert(app=self.app, path=data['path'], name=data['name'], full_path=data['full_path'])
# .on_conflict(
# conflict_target=[File.app, File.name, File.path],
# preserve=[],
# update={'name': data['name'], 'path': data['path'], 'full_path': data['full_path']})
# .execute())
(File.insert(app=self.app, path=data['path'], name=data['name'], full_path=data['full_path'])
.on_conflict(
conflict_target=[File.app, File.name, File.path],
preserve=[],
update={'name': data['name'], 'path': data['path'], 'full_path': data['full_path']})
.execute())
def get_full_file_path(self, file_path: str, file_name: str) -> Tuple[str, str]:

View File

@@ -37,14 +37,14 @@ def create_project():
# 'None name', 'empty name',
# 'None path absolute file', 'home path', 'home path same name', 'absolute path with name'
])
# @patch('helpers.Project.update_file')
# @patch('helpers.Project.File')
@patch('helpers.Project.update_file')
@patch('helpers.Project.File')
def test_save_file(
# mock_file_insert,
# mock_update_file,
mock_file_insert,
mock_update_file,
test_data,
# monkeypatch
mocker
# mocker
):
# Given
data = {'content': 'Hello World!'}
@@ -53,15 +53,14 @@ def test_save_file(
if test_data['path'] is not None:
data['path'] = test_data['path']
mock_update_file = mocker.patch('helpers.Project.update_file', return_value=None)
mocker.patch('helpers.Project.File')
# mock_update_file = mocker.patch('helpers.Project.update_file', return_value=None)
# mocker.patch('helpers.Project.File')
project = create_project()
# When
project.save_file(data)
# Then assert that update_file with the correct path
expected_saved_to = test_data['saved_to']
mock_update_file.assert_called_once_with(expected_saved_to, 'Hello World!')