|
36 | 36 |
|
37 | 37 | from osf_tests.factories import ProjectFactory, ApiOAuth2PersonalTokenFactory, PreprintFactory |
38 | 38 | from website.files.utils import attach_versions |
39 | | -from website.settings import EXTERNAL_EMBER_APPS |
40 | 39 | from api_tests.draft_nodes.views.test_draft_node_files_lists import prepare_mock_wb_response |
41 | 40 |
|
42 | 41 |
|
@@ -1413,28 +1412,17 @@ def test_file_view_updates_history(self): |
1413 | 1412 | {'name': 'testpath', 'path': '/testpath', 'materialized': '/testpath', 'kind': 'file'}, |
1414 | 1413 | ] |
1415 | 1414 | ) |
1416 | | - with override_flag(features.EMBER_FILE_PROJECT_DETAIL, active=True): |
1417 | | - url = self.node.web_url_for('addon_view_or_download_file', path='testpath', provider='github') |
1418 | | - self.app.get(url, auth=self.user.auth) |
1419 | | - file = GithubFile.objects.get(_path='/testpath', provider='github') |
1420 | | - assert file.history |
1421 | | - |
1422 | | - @mock.patch('website.views.stream_emberapp') |
1423 | | - def test_file_views(self, mock_ember): |
1424 | | - with override_flag(features.EMBER_FILE_PROJECT_DETAIL, active=True): |
1425 | | - file = create_test_file(target=self.node, user=self.user) |
1426 | | - url = self.node.web_url_for('addon_view_or_download_file', path=file._id, provider=file.provider) |
1427 | | - res = self.app.get(url, auth=self.user.auth) |
1428 | | - assert res.status_code == 302 |
1429 | | - assert res.headers['Location'] == f'{settings.DOMAIN}{file.get_guid()._id}/' |
1430 | | - assert not mock_ember.called |
1431 | | - res = self.app.get(url, auth=self.user.auth, follow_redirects=True) |
1432 | | - assert res.status_code == 200 |
1433 | | - assert mock_ember.called |
1434 | | - args, kwargs = mock_ember.call_args |
1435 | | - |
1436 | | - assert args[0] == EXTERNAL_EMBER_APPS['ember_osf_web']['server'] |
1437 | | - assert args[1] == EXTERNAL_EMBER_APPS['ember_osf_web']['path'].rstrip('/') |
| 1415 | + url = self.node.web_url_for('addon_view_or_download_file', path='testpath', provider='github') |
| 1416 | + self.app.get(url, auth=self.user.auth) |
| 1417 | + file = GithubFile.objects.get(_path='/testpath', provider='github') |
| 1418 | + assert file.history |
| 1419 | + |
| 1420 | + def test_file_views(self): |
| 1421 | + file = create_test_file(target=self.node, user=self.user) |
| 1422 | + url = self.node.web_url_for('addon_view_or_download_file', path=file._id, provider=file.provider) |
| 1423 | + res = self.app.get(url, auth=self.user.auth) |
| 1424 | + assert res.status_code == 302 |
| 1425 | + assert res.headers['Location'] == f'{settings.DOMAIN}{file.get_guid()._id}/' |
1438 | 1426 |
|
1439 | 1427 | def test_download_file(self): |
1440 | 1428 | file = create_test_file(target=self.node, user=self.user) |
|
0 commit comments