diff --git a/pagure/templates/file.html b/pagure/templates/file.html index 8777091..b73035b 100644 --- a/pagure/templates/file.html +++ b/pagure/templates/file.html @@ -129,7 +129,11 @@ branchname=branchname, filename=filename) }}"> {{ forkbuttonform.csrf_token }} diff --git a/tests/test_pagure_flask_ui_fork.py b/tests/test_pagure_flask_ui_fork.py index b1dba26..990c9f5 100644 --- a/tests/test_pagure_flask_ui_fork.py +++ b/tests/test_pagure_flask_ui_fork.py @@ -2312,14 +2312,14 @@ index 0000000..2a552bb output = self.app.get('/test/blob/master/f/sources') self.assertEqual(output.status_code, 200) self.assertIn( - 'Fork and Edit\n \n', + 'Edit in your fork\n \n', output.data) # Check fork-edit doesn't show for binary output = self.app.get('/test/blob/master/f/test.jpg') self.assertEqual(output.status_code, 200) self.assertNotIn( - 'Fork and Edit\n \n', + 'Edit in your fork\n \n', output.data) @patch('pagure.lib.notify.send_email') @@ -2371,7 +2371,6 @@ index 0000000..2a552bb # UI test for deleted main output = self.app.get('/fork/foo/test') self.assertEqual(output.status_code, 200) - print output.data self.assertIn('Fork from a deleted repository\n', output.data) # Testing commit endpoint diff --git a/tests/test_pagure_flask_ui_repo_view_file.py b/tests/test_pagure_flask_ui_repo_view_file.py index a79df78..d906bb3 100644 --- a/tests/test_pagure_flask_ui_repo_view_file.py +++ b/tests/test_pagure_flask_ui_repo_view_file.py @@ -239,7 +239,7 @@ class PagureFlaskRepoViewFiletests(LocalBasetests): 'onclick="fork_project.submit();">\n ' ' Fork and Edit', output.data) - def test_view_file_fork_and_edit_logged_out(self): + def test_view_file_fork_and_edit_logged_in(self): """ Test the view_file fork and edit button presence when logged in. """ @@ -258,17 +258,31 @@ class PagureFlaskRepoViewFiletests(LocalBasetests): ' Fork and Edit', output.data) -class PagureFlaskRepoViewFileForktests(PagureFlaskRepoViewFiletests): +class PagureFlaskRepoViewFileForktests(LocalBasetests): """ Tests for view_file endpoint of the flask pagure app for a fork """ def setUp(self): """ Set up the environnment, ran before every tests. """ super(PagureFlaskRepoViewFileForktests, self).setUp() + tests.create_projects(self.session) + tests.create_projects_git( + os.path.join(self.path, 'repos'), bare=True) + + # Add some content to the git repo + tests.add_content_git_repo( + os.path.join(self.path, 'repos', 'test.git')) + tests.add_readme_git_repo( + os.path.join(self.path, 'repos', 'test.git')) + tests.add_binary_git_repo( + os.path.join(self.path, 'repos', 'test.git'), 'test.jpg') + tests.add_binary_git_repo( + os.path.join(self.path, 'repos', 'test.git'), 'test_binary') + # Add a fork of a fork item = pagure.lib.model.Project( user_id=1, # pingou - name='test3', + name='test', description='test project #3', is_fork=True, parent_id=1, @@ -278,27 +292,27 @@ class PagureFlaskRepoViewFileForktests(PagureFlaskRepoViewFiletests): self.session.commit() tests.add_content_git_repo( - os.path.join(self.path, 'repos', 'forks', 'pingou', 'test3.git')) + os.path.join(self.path, 'repos', 'forks', 'pingou', 'test.git')) tests.add_readme_git_repo( - os.path.join(self.path, 'repos', 'forks', 'pingou', 'test3.git')) + os.path.join(self.path, 'repos', 'forks', 'pingou', 'test.git')) tests.add_commit_git_repo( - os.path.join(self.path, 'repos', 'forks', 'pingou', 'test3.git'), + os.path.join(self.path, 'repos', 'forks', 'pingou', 'test.git'), ncommits=10) def test_view_file_nested_file_in_fork(self): """ Test the view_file with a nested file in fork. """ # Verify the nav links correctly when viewing a file/folder in a fork. output = self.app.get( - '/fork/pingou/test3/blob/master/f/folder1/folder2/file') + '/fork/pingou/test/blob/master/f/folder1/folder2/file') self.assertEqual(output.status_code, 200) self.assertIn( - '