From 1709741885abe74c0d5083edfcad4da5c59cb0e9 Mon Sep 17 00:00:00 2001 From: Patrick Uiterwijk Date: May 22 2017 20:37:00 +0000 Subject: Make all tests use self.path/repos for repos Signed-off-by: Patrick Uiterwijk --- diff --git a/tests/__init__.py b/tests/__init__.py index fa181e8..841e503 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -151,7 +151,7 @@ class Modeltests(unittest.TestCase): self.path = tempfile.mkdtemp(prefix='pagure-tests-path-') LOG.info('Testdir: %s', self.path) for folder in ['tickets', 'repos', 'forks', 'docs', 'requests', - 'releases', 'remotes']: + 'releases', 'remotes', 'attachments']: os.mkdir(os.path.join(self.path, folder)) if DB_PATH: @@ -235,13 +235,16 @@ class Modeltests(unittest.TestCase): # Prevent unit-tests to send email, globally pagure.APP.config['EMAIL_SEND'] = False pagure.APP.config['TESTING'] = True - pagure.APP.config['GIT_FOLDER'] = self.path + pagure.APP.config['GIT_FOLDER'] = os.path.join( + self.path, 'repos') pagure.APP.config['TICKETS_FOLDER'] = os.path.join( self.path, 'tickets') pagure.APP.config['DOCS_FOLDER'] = os.path.join( self.path, 'docs') pagure.APP.config['REQUESTS_FOLDER'] = os.path.join( self.path, 'requests') + pagure.APP.config['ATTACHMENTS_FOLDER'] = os.path.join( + self.path, 'attachments') self.app = pagure.APP.test_client() def tearDown(self): # pylint: disable=invalid-name diff --git a/tests/test_pagure_exclude_group_index.py b/tests/test_pagure_exclude_group_index.py index 37cf7d3..9a02c49 100644 --- a/tests/test_pagure_exclude_group_index.py +++ b/tests/test_pagure_exclude_group_index.py @@ -33,7 +33,6 @@ class PagureExcludeGroupIndex(tests.Modeltests): """ Set up the environnment, ran before every tests. """ super(PagureExcludeGroupIndex, self).setUp() - pagure.APP.config['GIT_FOLDER'] = os.path.join(self.path, 'repos') tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, 'repos'), bare=True) diff --git a/tests/test_pagure_flask.py b/tests/test_pagure_flask.py index b2358c5..4d789de 100644 --- a/tests/test_pagure_flask.py +++ b/tests/test_pagure_flask.py @@ -34,9 +34,6 @@ class PagureGetRemoteRepoPath(tests.Modeltests): """ Set up the environnment, ran before every tests. """ super(PagureGetRemoteRepoPath, self).setUp() - pagure.APP.config['GIT_FOLDER'] = os.path.join(self.path, 'repos') - pagure.APP.config['REMOTE_GIT_FOLDER'] = os.path.join( - self.path, 'remotes') tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, 'repos'), bare=True) tests.add_content_git_repo(os.path.join(self.path, 'repos', 'test2.git')) diff --git a/tests/test_pagure_flask_api_project.py b/tests/test_pagure_flask_api_project.py index d7b4883..990bea9 100644 --- a/tests/test_pagure_flask_api_project.py +++ b/tests/test_pagure_flask_api_project.py @@ -44,14 +44,6 @@ class PagureFlaskApiProjecttests(tests.Modeltests): pagure.api.project.SESSION = self.session pagure.lib.SESSION = self.session - pagure.APP.config['GIT_FOLDER'] = os.path.join(self.path, 'repos') - pagure.APP.config['REQUESTS_FOLDER'] = os.path.join( - self.path, 'requests') - pagure.APP.config['TICKETS_FOLDER'] = os.path.join( - self.path, 'tickets') - pagure.APP.config['DOCS_FOLDER'] = os.path.join( - self.path, 'docs') - self.app = pagure.APP.test_client() def test_api_git_tags(self): diff --git a/tests/test_pagure_flask_api_ui_private_repo.py b/tests/test_pagure_flask_api_ui_private_repo.py index 5f60edd..29f90c0 100644 --- a/tests/test_pagure_flask_api_ui_private_repo.py +++ b/tests/test_pagure_flask_api_ui_private_repo.py @@ -233,15 +233,6 @@ class PagurePrivateRepotest(tests.Modeltests): pagure.api.issue.SESSION = self.session pagure.APP.config['VIRUS_SCAN_ATTACHMENTS'] = False - pagure.APP.config['GIT_FOLDER'] = self.path - pagure.APP.config['REQUESTS_FOLDER'] = os.path.join( - self.path, 'requests') - pagure.APP.config['TICKETS_FOLDER'] = os.path.join( - self.path, 'tickets') - pagure.APP.config['DOCS_FOLDER'] = os.path.join( - self.path, 'docs') - pagure.APP.config['UPLOAD_FOLDER_PATH'] = os.path.join( - self.path, 'releases') self.app = pagure.APP.test_client() def set_up_git_repo( @@ -251,7 +242,7 @@ class PagurePrivateRepotest(tests.Modeltests): """ # Create a git repo to play with - gitrepo = os.path.join(self.path, 'pmc.git') + gitrepo = os.path.join(self.path, 'repos', 'pmc.git') repo = pygit2.init_repository(gitrepo, bare=True) newpath = tempfile.mkdtemp(prefix='pagure-private-test') @@ -908,11 +899,11 @@ class PagurePrivateRepotest(tests.Modeltests): self.session.commit() # Create a git repo to play with - gitrepo = os.path.join(self.path, 'test4.git') + gitrepo = os.path.join(self.path, 'repos', 'test4.git') repo = pygit2.init_repository(gitrepo, bare=True) newpath = tempfile.mkdtemp(prefix='pagure-fork-test') - repopath = os.path.join(newpath, 'test4') + repopath = os.path.join(newpath, 'repos', 'test4') clone_repo = pygit2.clone_repository(gitrepo, repopath) # Create a file in that git repo with open(os.path.join(repopath, 'sources'), 'w') as stream: diff --git a/tests/test_pagure_flask_docs.py b/tests/test_pagure_flask_docs.py index 37bd6c3..90db374 100644 --- a/tests/test_pagure_flask_docs.py +++ b/tests/test_pagure_flask_docs.py @@ -47,17 +47,13 @@ class PagureFlaskDocstests(tests.Modeltests): pagure.ui.app.SESSION = self.session pagure.ui.repo.SESSION = self.session - pagure.docs_server.APP.config['GIT_FOLDER'] = self.path + pagure.docs_server.APP.config['GIT_FOLDER'] = os.path.join( + self.path, 'repos') pagure.docs_server.APP.config['TICKETS_FOLDER'] = os.path.join( self.path, 'tickets') pagure.docs_server.APP.config['DOCS_FOLDER'] = os.path.join( self.path, 'docs') - pagure.APP.config['GIT_FOLDER'] = self.path - pagure.APP.config['TICKETS_FOLDER'] = os.path.join( - self.path, 'tickets') - pagure.APP.config['DOCS_FOLDER'] = os.path.join( - self.path, 'docs') self.app = pagure.docs_server.APP.test_client() def _set_up_doc(self): diff --git a/tests/test_pagure_flask_dump_load_ticket.py b/tests/test_pagure_flask_dump_load_ticket.py index 83809b9..7391336 100644 --- a/tests/test_pagure_flask_dump_load_ticket.py +++ b/tests/test_pagure_flask_dump_load_ticket.py @@ -46,13 +46,6 @@ class PagureFlaskDumpLoadTicketTests(tests.Modeltests): pagure.ui.fork.SESSION = self.session pagure.ui.repo.SESSION = self.session - pagure.APP.config['GIT_FOLDER'] = os.path.join(self.path, 'repos') - pagure.APP.config['TICKETS_FOLDER'] = os.path.join( - self.path, 'tickets') - pagure.APP.config['DOCS_FOLDER'] = os.path.join( - self.path, 'docs') - pagure.APP.config['REQUESTS_FOLDER'] = os.path.join( - self.path, 'requests') self.app = pagure.APP.test_client() @patch('pagure.lib.notify.send_email') diff --git a/tests/test_pagure_flask_internal.py b/tests/test_pagure_flask_internal.py index b83cf2e..487cc2c 100644 --- a/tests/test_pagure_flask_internal.py +++ b/tests/test_pagure_flask_internal.py @@ -43,7 +43,8 @@ class PagureFlaskInternaltests(tests.Modeltests): pagure.ui.repo.SESSION = self.session pagure.ui.filters.SESSION = self.session - pagure.APP.config['GIT_FOLDER'] = self.path + pagure.APP.config['GIT_FOLDER'] = os.path.join( + self.path, 'repos') pagure.APP.config['REQUESTS_FOLDER'] = None pagure.APP.config['TICKETS_FOLDER'] = None pagure.APP.config['DOCS_FOLDER'] = None @@ -437,7 +438,7 @@ class PagureFlaskInternaltests(tests.Modeltests): # Create a git repo to play with - gitrepo = os.path.join(self.path, 'test.git') + gitrepo = os.path.join(self.path, 'repos', 'test.git') self.assertFalse(os.path.exists(gitrepo)) os.makedirs(gitrepo) repo = pygit2.init_repository(gitrepo) @@ -559,7 +560,7 @@ class PagureFlaskInternaltests(tests.Modeltests): # Create a git repo to play with - gitrepo = os.path.join(self.path, 'test.git') + gitrepo = os.path.join(self.path, 'repos', 'test.git') self.assertFalse(os.path.exists(gitrepo)) os.makedirs(gitrepo) repo = pygit2.init_repository(gitrepo) @@ -681,7 +682,7 @@ class PagureFlaskInternaltests(tests.Modeltests): # Create a git repo to play with - gitrepo = os.path.join(self.path, 'test.git') + gitrepo = os.path.join(self.path, 'repos', 'test.git') self.assertFalse(os.path.exists(gitrepo)) os.makedirs(gitrepo) repo = pygit2.init_repository(gitrepo) @@ -822,7 +823,7 @@ class PagureFlaskInternaltests(tests.Modeltests): # Create a git repo to play with - gitrepo = os.path.join(self.path, 'test.git') + gitrepo = os.path.join(self.path, 'repos', 'test.git') self.assertFalse(os.path.exists(gitrepo)) os.makedirs(gitrepo) repo = pygit2.init_repository(gitrepo) @@ -957,7 +958,7 @@ class PagureFlaskInternaltests(tests.Modeltests): def test_get_branches_of_commit(self): ''' Test the get_branches_of_commit from the internal API. ''' tests.create_projects(self.session) - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) user = tests.FakeUser() user.username = 'pingou' @@ -1038,7 +1039,7 @@ class PagureFlaskInternaltests(tests.Modeltests): ) # Create a git repo to play with - gitrepo = os.path.join(self.path, 'test.git') + gitrepo = os.path.join(self.path, 'repos', 'test.git') self.assertTrue(os.path.exists(gitrepo)) repo = pygit2.Repository(gitrepo) diff --git a/tests/test_pagure_flask_ui_app.py b/tests/test_pagure_flask_ui_app.py index d76444e..e5de177 100644 --- a/tests/test_pagure_flask_ui_app.py +++ b/tests/test_pagure_flask_ui_app.py @@ -43,13 +43,6 @@ class PagureFlaskApptests(tests.Modeltests): pagure.ui.filters.SESSION = self.session pagure.ui.repo.SESSION = self.session - pagure.APP.config['GIT_FOLDER'] = self.path - pagure.APP.config['TICKETS_FOLDER'] = os.path.join( - self.path, 'tickets') - pagure.APP.config['DOCS_FOLDER'] = os.path.join( - self.path, 'docs') - pagure.APP.config['REQUESTS_FOLDER'] = os.path.join( - self.path, 'requests') self.app = pagure.APP.test_client() def test_index(self): @@ -173,7 +166,7 @@ class PagureFlaskApptests(tests.Modeltests): projects = pagure.lib.search_projects(self.session) self.assertEqual(len(projects), 0) self.assertFalse(os.path.exists( - os.path.join(self.path, 'project-1.git'))) + os.path.join(self.path, 'repos', 'project-1.git'))) self.assertFalse(os.path.exists( os.path.join(self.path, 'tickets', 'project-1.git'))) self.assertFalse(os.path.exists( @@ -209,7 +202,7 @@ class PagureFlaskApptests(tests.Modeltests): projects = pagure.lib.search_projects(self.session) self.assertEqual(len(projects), 0) self.assertFalse(os.path.exists( - os.path.join(self.path, 'project-1.git'))) + os.path.join(self.path, 'repos', 'project-1.git'))) self.assertFalse(os.path.exists( os.path.join(self.path, 'tickets', 'project-1.git'))) self.assertFalse(os.path.exists( @@ -225,7 +218,7 @@ class PagureFlaskApptests(tests.Modeltests): projects = pagure.lib.search_projects(self.session) self.assertEqual(len(projects), 0) self.assertFalse(os.path.exists( - os.path.join(self.path, 'project#1.git'))) + os.path.join(self.path, 'repos', 'project#1.git'))) self.assertFalse(os.path.exists( os.path.join(self.path, 'tickets', 'project#1.git'))) self.assertFalse(os.path.exists( @@ -288,7 +281,7 @@ class PagureFlaskApptests(tests.Modeltests): projects = pagure.lib.search_projects(self.session) self.assertEqual(len(projects), 1) self.assertTrue(os.path.exists( - os.path.join(self.path, 'project-1.git'))) + os.path.join(self.path, 'repos', 'project-1.git'))) self.assertTrue(os.path.exists( os.path.join(self.path, 'tickets', 'project-1.git'))) self.assertTrue(os.path.exists( @@ -303,7 +296,7 @@ class PagureFlaskApptests(tests.Modeltests): projects = pagure.lib.search_projects(self.session) self.assertEqual(len(projects), 0) self.assertFalse(os.path.exists( - os.path.join(self.path, 'foo', 'project#1.git'))) + os.path.join(self.path, 'repos', 'foo', 'project#1.git'))) self.assertFalse(os.path.exists( os.path.join(self.path, 'tickets', 'foo', 'project#1.git'))) self.assertFalse(os.path.exists( @@ -369,7 +362,7 @@ class PagureFlaskApptests(tests.Modeltests): projects = pagure.lib.search_projects(self.session, private=True) self.assertEqual(len(projects), 1) self.assertTrue(os.path.exists( - os.path.join(self.path, 'foo', 'project-1.git'))) + os.path.join(self.path, 'repos', 'foo', 'project-1.git'))) self.assertTrue(os.path.exists( os.path.join(self.path, 'tickets', 'foo', 'project-1.git'))) self.assertTrue(os.path.exists( @@ -383,7 +376,7 @@ class PagureFlaskApptests(tests.Modeltests): projects = pagure.lib.search_projects(self.session) self.assertEqual(len(projects), 0) self.assertFalse(os.path.exists( - os.path.join(self.path, 'project-1.git'))) + os.path.join(self.path, 'repos', 'project-1.git'))) self.assertFalse(os.path.exists( os.path.join(self.path, 'tickets', 'project-1.git'))) self.assertFalse(os.path.exists( @@ -441,7 +434,7 @@ class PagureFlaskApptests(tests.Modeltests): self.assertEqual(len(projects), 2) for project in ['project-1', 'project-2']: self.assertTrue(os.path.exists( - os.path.join(self.path, '%s.git' % project))) + os.path.join(self.path, 'repos', '%s.git' % project))) self.assertTrue(os.path.exists( os.path.join(self.path, 'tickets', '%s.git' % project))) self.assertTrue(os.path.exists( @@ -628,7 +621,7 @@ class PagureFlaskApptests(tests.Modeltests): 'name="csrf_token" type="hidden" value="')[1].split('">')[0] tests.create_projects(self.session) - tests.create_projects_git(os.path.join(self.path), bare=True) + tests.create_projects_git(os.path.join(self.path, 'repos'), bare=True) text = 'Cf commit 9364354a4555ba17aa60f0d' exp = '

Cf commit 9364354a4555ba17aa60f0d

' @@ -657,8 +650,8 @@ class PagureFlaskApptests(tests.Modeltests): 'name="csrf_token" type="hidden" value="')[1].split('">')[0] tests.create_projects(self.session) - tests.create_projects_git(os.path.join(self.path), bare=True) - repopath = os.path.join(self.path, 'test.git') + tests.create_projects_git(os.path.join(self.path, 'repos'), bare=True) + repopath = os.path.join(self.path, 'repos', 'test.git') tests.add_content_git_repo(repopath) repo = pygit2.Repository(repopath) diff --git a/tests/test_pagure_flask_ui_app_give_project.py b/tests/test_pagure_flask_ui_app_give_project.py index b7554f3..5121bb9 100644 --- a/tests/test_pagure_flask_ui_app_give_project.py +++ b/tests/test_pagure_flask_ui_app_give_project.py @@ -42,20 +42,13 @@ class PagureFlaskGiveRepotests(tests.Modeltests): pagure.ui.repo.SESSION = self.session pagure.APP.config['VIRUS_SCAN_ATTACHMENTS'] = False - pagure.APP.config['GIT_FOLDER'] = self.path - pagure.APP.config['REQUESTS_FOLDER'] = os.path.join( - self.path, 'requests') - pagure.APP.config['TICKETS_FOLDER'] = os.path.join( - self.path, 'tickets') - pagure.APP.config['DOCS_FOLDER'] = os.path.join( - self.path, 'docs') pagure.APP.config['UPLOAD_FOLDER_URL'] = '/releases/' pagure.APP.config['UPLOAD_FOLDER_PATH'] = os.path.join( self.path, 'releases') self.app = pagure.APP.test_client() tests.create_projects(self.session) - tests.create_projects_git(self.path, bare=True) + tests.create_projects_git(os.path.join(self.path, 'repos'), bare=True) def _check_user(self, user='pingou'): project = pagure.get_authorized_project( diff --git a/tests/test_pagure_flask_ui_fork.py b/tests/test_pagure_flask_ui_fork.py index 54088ec..771bf48 100644 --- a/tests/test_pagure_flask_ui_fork.py +++ b/tests/test_pagure_flask_ui_fork.py @@ -66,13 +66,6 @@ class PagureFlaskForktests(tests.Modeltests): pagure.ui.repo.SESSION = self.session pagure.ui.issues.SESSION = self.session - pagure.APP.config['GIT_FOLDER'] = os.path.join(self.path, 'repos') - pagure.APP.config['TICKETS_FOLDER'] = os.path.join( - self.path, 'tickets') - pagure.APP.config['DOCS_FOLDER'] = os.path.join( - self.path, 'docs') - pagure.APP.config['REQUESTS_FOLDER'] = os.path.join( - self.path, 'requests') self.app = pagure.APP.test_client() def set_up_git_repo( @@ -399,9 +392,6 @@ class PagureFlaskForktests(tests.Modeltests): self.assertIn( 'Overview - test - Pagure', output.data) self.assertIn( - '\n Changes merged!', - output.data) - self.assertIn( 'A commit on branch feature', output.data) self.assertNotIn( 'Merge #1 `PR from the feature branch`', output.data) @@ -451,9 +441,6 @@ class PagureFlaskForktests(tests.Modeltests): self.assertEqual(output.status_code, 200) self.assertIn( 'Overview - test - Pagure', output.data) - self.assertIn( - '\n Changes merged!', - output.data) # Check if the closing notification was added output = self.app.get('/test/pull-request/1') @@ -1354,9 +1341,6 @@ index 0000000..2a552bb output = self.app.post( '/do_fork/test', data=data, follow_redirects=True) self.assertEqual(output.status_code, 200) - self.assertIn( - '\n Repo "test" ' - 'cloned to "foo/test"', output.data) @patch('pagure.lib.notify.send_email') def test_new_request_pull(self, send_email): @@ -1891,9 +1875,6 @@ index 0000000..2a552bb self.assertIn( 'Overview - test - Pagure', output.data) self.assertIn( - '\n Changes merged!', - output.data) - self.assertIn( 'Merge #1 `PR from the feature branch`', output.data) self.assertIn( 'A commit on branch feature', output.data) @@ -2134,9 +2115,6 @@ index 0000000..2a552bb self.assertIn( '', output.data) - self.assertIn( - '\n Repo "test" ' - 'cloned to "foo/test"', output.data) # View what's supposed to be an image output = self.app.post('fork_edit/test/edit/master/f/test.jpg', diff --git a/tests/test_pagure_flask_ui_groups.py b/tests/test_pagure_flask_ui_groups.py index 2d9fb76..2f5cb92 100644 --- a/tests/test_pagure_flask_ui_groups.py +++ b/tests/test_pagure_flask_ui_groups.py @@ -41,13 +41,6 @@ class PagureFlaskGroupstests(tests.Modeltests): pagure.ui.repo.SESSION = self.session pagure.ui.filters.SESSION = self.session - pagure.APP.config['GIT_FOLDER'] = self.path - pagure.APP.config['TICKETS_FOLDER'] = os.path.join( - self.path, 'tickets') - pagure.APP.config['DOCS_FOLDER'] = os.path.join( - self.path, 'docs') - pagure.APP.config['REQUESTS_FOLDER'] = os.path.join( - self.path, 'requests') self.app = pagure.APP.test_client() def test_group_lists(self): diff --git a/tests/test_pagure_flask_ui_issues.py b/tests/test_pagure_flask_ui_issues.py index 5131e1f..c676904 100644 --- a/tests/test_pagure_flask_ui_issues.py +++ b/tests/test_pagure_flask_ui_issues.py @@ -52,11 +52,6 @@ class PagureFlaskIssuestests(tests.Modeltests): pagure.ui.repo.SESSION = self.session pagure.ui.filters.SESSION = self.session - pagure.APP.config['GIT_FOLDER'] = self.path - pagure.APP.config['TICKETS_FOLDER'] = os.path.join( - self.path, 'tickets') - pagure.APP.config['DOCS_FOLDER'] = os.path.join( - self.path, 'docs') self.app = pagure.APP.test_client() @patch('pagure.lib.git.update_git') @@ -77,7 +72,7 @@ class PagureFlaskIssuestests(tests.Modeltests): tests.create_projects(self.session) tests.create_projects_git( - os.path.join(self.path), bare=True) + os.path.join(self.path, 'repos'), bare=True) output = self.app.get('/test/new_issue') self.assertEqual(output.status_code, 200) @@ -166,7 +161,7 @@ class PagureFlaskIssuestests(tests.Modeltests): tests.create_projects(self.session) tests.create_projects_git( - os.path.join(self.path), bare=True) + os.path.join(self.path, 'repos'), bare=True) tests.create_projects_git( os.path.join(self.path, 'tickets'), bare=True) @@ -206,7 +201,7 @@ class PagureFlaskIssuestests(tests.Modeltests): output.data) # Check the image was uploaded self.assertIn( - 'href="/test/issue/raw/files/' + 'href="/test/issue/raw/' '8a06845923010b27bfd8e7e75acff7badc40d1021b4' '994e01f5e11ca40bc3abe', output.data) @@ -271,7 +266,7 @@ class PagureFlaskIssuestests(tests.Modeltests): output.data) # Check the image was uploaded self.assertIn( - 'href="/somenamespace/test3/issue/raw/files/' + 'href="/somenamespace/test3/issue/raw/' '8a06845923010b27bfd8e7e75acff7badc40d1021b4' '994e01f5e11ca40bc3abe', output.data) @@ -288,7 +283,7 @@ class PagureFlaskIssuestests(tests.Modeltests): tests.create_projects(self.session) tests.create_projects_git( - os.path.join(self.path), bare=True) + os.path.join(self.path, 'repos'), bare=True) output = self.app.get('/test/issues') self.assertEqual(output.status_code, 200) @@ -491,7 +486,7 @@ class PagureFlaskIssuestests(tests.Modeltests): tests.create_projects(self.session) tests.create_projects_git( - os.path.join(self.path), bare=True) + os.path.join(self.path, 'repos'), bare=True) output = self.app.get('/test/issue/1') self.assertEqual(output.status_code, 404) @@ -621,7 +616,7 @@ class PagureFlaskIssuestests(tests.Modeltests): tests.create_projects(self.session) tests.create_projects_git( - os.path.join(self.path), bare=True) + os.path.join(self.path, 'repos'), bare=True) output = self.app.get('/test/issue/1') self.assertEqual(output.status_code, 404) @@ -700,7 +695,7 @@ class PagureFlaskIssuestests(tests.Modeltests): tests.create_projects(self.session) tests.create_projects_git( - os.path.join(self.path), bare=True) + os.path.join(self.path, 'repos'), bare=True) output = self.app.get('/test/issue/1') self.assertEqual(output.status_code, 404) @@ -820,7 +815,7 @@ class PagureFlaskIssuestests(tests.Modeltests): tests.create_projects(self.session) tests.create_projects_git( - os.path.join(self.path), bare=True) + os.path.join(self.path, 'repos'), bare=True) output = self.app.get('/test/issue/1') self.assertEqual(output.status_code, 404) @@ -887,7 +882,7 @@ class PagureFlaskIssuestests(tests.Modeltests): tests.create_projects(self.session) tests.create_projects_git( - os.path.join(self.path), bare=True) + os.path.join(self.path, 'repos'), bare=True) repo = pagure.get_authorized_project(self.session, 'test') @@ -947,7 +942,7 @@ class PagureFlaskIssuestests(tests.Modeltests): tests.create_projects(self.session) tests.create_projects_git( - os.path.join(self.path), bare=True) + os.path.join(self.path, 'repos'), bare=True) output = self.app.get('/test/issue/1/update') self.assertEqual(output.status_code, 302) @@ -1257,7 +1252,7 @@ class PagureFlaskIssuestests(tests.Modeltests): tests.create_projects(self.session) tests.create_projects_git( - os.path.join(self.path), bare=True) + os.path.join(self.path, 'repos'), bare=True) # Create issues to play with repo = pagure.get_authorized_project(self.session, 'test') @@ -1367,7 +1362,7 @@ class PagureFlaskIssuestests(tests.Modeltests): tests.create_projects(self.session) tests.create_projects_git( - os.path.join(self.path), bare=True) + os.path.join(self.path, 'repos'), bare=True) # Create issues to play with repo = pagure.get_authorized_project(self.session, 'test') @@ -1460,7 +1455,7 @@ class PagureFlaskIssuestests(tests.Modeltests): tests.create_projects(self.session) tests.create_projects_git( - os.path.join(self.path), bare=True) + os.path.join(self.path, 'repos'), bare=True) # Create issues to play with repo = pagure.get_authorized_project(self.session, 'test') @@ -1584,7 +1579,7 @@ class PagureFlaskIssuestests(tests.Modeltests): tests.create_projects(self.session) tests.create_projects_git( - os.path.join(self.path), bare=True) + os.path.join(self.path, 'repos'), bare=True) tests.create_projects_git( os.path.join(self.path, 'tickets'), bare=True) @@ -1671,7 +1666,7 @@ class PagureFlaskIssuestests(tests.Modeltests): os.path.abspath(__file__))[1:].replace('/', '_') exp = { 'output': 'ok', - 'filelocation': '/test/issue/raw/files/8a06845923010b27bfd8' + 'filelocation': '/test/issue/raw/8a06845923010b27bfd8' 'e7e75acff7badc40d1021b4994e01f5e11ca40bc3a' 'be-%s_placebo.png' % folder, 'filename': '%s_placebo.png' % folder, @@ -1708,7 +1703,7 @@ class PagureFlaskIssuestests(tests.Modeltests): self.session.commit() self.assertEqual(msg.title, 'Test issue') - url = '/issue/raw/files/8a06845923010b27bfd8'\ + url = '/issue/raw/8a06845923010b27bfd8'\ 'e7e75acff7badc40d1021b4994e01f5e11ca40bc3a'\ 'be-home_pierrey_repos_gitrepo_pagure_tests'\ '_placebo.png' @@ -1739,7 +1734,7 @@ class PagureFlaskIssuestests(tests.Modeltests): self.session.add(repo) self.session.commit() - url = '/issue/raw/files/8a06845923010b27bfd8'\ + url = '/issue/raw/8a06845923010b27bfd8'\ 'e7e75acff7badc40d1021b4994e01f5e11ca40bc3a'\ 'be-%s_placebo.png' % os.path.dirname( os.path.abspath(__file__))[1:].replace('/', '_') @@ -1747,7 +1742,7 @@ class PagureFlaskIssuestests(tests.Modeltests): output = self.app.get('/foo' + url) self.assertEqual(output.status_code, 404) - output = self.app.get('/test/issue/raw/files/test.png') + output = self.app.get('/test/issue/raw/test.png') self.assertEqual(output.status_code, 404) # Access file by name @@ -1781,7 +1776,7 @@ class PagureFlaskIssuestests(tests.Modeltests): tests.create_projects(self.session) tests.create_projects_git( - os.path.join(self.path), bare=True) + os.path.join(self.path, 'repos'), bare=True) output = self.app.get('/test/issue/1/edit') self.assertEqual(output.status_code, 404) @@ -1896,7 +1891,7 @@ class PagureFlaskIssuestests(tests.Modeltests): self.assertEqual(output.status_code, 404) tests.create_projects(self.session) - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) output = self.app.get('/test/tag/foo/edit') self.assertEqual(output.status_code, 403) @@ -1999,7 +1994,7 @@ class PagureFlaskIssuestests(tests.Modeltests): self.assertEqual(output.status_code, 404) tests.create_projects(self.session) - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) output = self.app.post('/test/droptag/') self.assertEqual(output.status_code, 403) @@ -2073,7 +2068,7 @@ class PagureFlaskIssuestests(tests.Modeltests): p_ugt.return_value = True tests.create_projects(self.session) - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) tests.create_projects_git(os.path.join(self.path, 'tickets')) # Create issues to play with @@ -2156,7 +2151,7 @@ class PagureFlaskIssuestests(tests.Modeltests): tests.create_projects(self.session) tests.create_projects_git( - os.path.join(self.path), bare=True) + os.path.join(self.path, 'repos'), bare=True) # Create issues to play with repo = pagure.get_authorized_project(self.session, 'test') @@ -2438,7 +2433,7 @@ class PagureFlaskIssuestests(tests.Modeltests): self.assertEqual(output.status_code, 404) tests.create_projects(self.session) - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) output = self.app.post('/test/update/tags') self.assertEqual(output.status_code, 403) diff --git a/tests/test_pagure_flask_ui_issues_acl_checks.py b/tests/test_pagure_flask_ui_issues_acl_checks.py index 7732164..88bf61d 100644 --- a/tests/test_pagure_flask_ui_issues_acl_checks.py +++ b/tests/test_pagure_flask_ui_issues_acl_checks.py @@ -49,11 +49,6 @@ class PagureFlaskIssuesACLtests(tests.Modeltests): pagure.ui.repo.SESSION = self.session pagure.ui.filters.SESSION = self.session - pagure.APP.config['GIT_FOLDER'] = self.path - pagure.APP.config['TICKETS_FOLDER'] = os.path.join( - self.path, 'tickets') - pagure.APP.config['DOCS_FOLDER'] = os.path.join( - self.path, 'docs') self.app = pagure.APP.test_client() @patch('pagure.lib.git.update_git') @@ -68,7 +63,7 @@ class PagureFlaskIssuesACLtests(tests.Modeltests): tests.create_projects(self.session) tests.create_projects_git( - os.path.join(self.path), bare=True) + os.path.join(self.path, 'repos'), bare=True) output = self.app.get('/test/issue/1') self.assertEqual(output.status_code, 404) @@ -319,7 +314,7 @@ class PagureFlaskIssuesACLtests(tests.Modeltests): tests.create_projects(self.session) tests.create_projects_git( - os.path.join(self.path), bare=True) + os.path.join(self.path, 'repos'), bare=True) output = self.app.get('/test/issue/1') self.assertEqual(output.status_code, 404) @@ -582,7 +577,7 @@ class PagureFlaskIssuesACLtests(tests.Modeltests): tests.create_projects(self.session) tests.create_projects_git( - os.path.join(self.path), bare=True) + os.path.join(self.path, 'repos'), bare=True) output = self.app.get('/test/issue/1') self.assertEqual(output.status_code, 404) @@ -844,7 +839,7 @@ class PagureFlaskIssuesACLtests(tests.Modeltests): tests.create_projects(self.session) tests.create_projects_git( - os.path.join(self.path), bare=True) + os.path.join(self.path, 'repos'), bare=True) output = self.app.get('/test/issue/1') self.assertEqual(output.status_code, 404) diff --git a/tests/test_pagure_flask_ui_no_master_branch.py b/tests/test_pagure_flask_ui_no_master_branch.py index 5a7a66b..733b33d 100644 --- a/tests/test_pagure_flask_ui_no_master_branch.py +++ b/tests/test_pagure_flask_ui_no_master_branch.py @@ -45,13 +45,6 @@ class PagureFlaskNoMasterBranchtests(tests.Modeltests): pagure.ui.fork.SESSION = self.session pagure.ui.repo.SESSION = self.session - pagure.APP.config['GIT_FOLDER'] = os.path.join(self.path, 'repos') - pagure.APP.config['TICKETS_FOLDER'] = os.path.join( - self.path, 'tickets') - pagure.APP.config['DOCS_FOLDER'] = os.path.join( - self.path, 'docs') - pagure.APP.config['REQUESTS_FOLDER'] = os.path.join( - self.path, 'requests') self.app = pagure.APP.test_client() def set_up_git_repo(self): diff --git a/tests/test_pagure_flask_ui_old_commit.py b/tests/test_pagure_flask_ui_old_commit.py index d8bce31..c97b75a 100644 --- a/tests/test_pagure_flask_ui_old_commit.py +++ b/tests/test_pagure_flask_ui_old_commit.py @@ -46,13 +46,6 @@ class PagureFlaskRepoOldUrltests(tests.Modeltests): pagure.APP.config['OLD_VIEW_COMMIT_ENABLED'] = True pagure.APP.config['EMAIL_SEND'] = False - pagure.APP.config['GIT_FOLDER'] = self.path - pagure.APP.config['REQUESTS_FOLDER'] = os.path.join( - self.path, 'requests') - pagure.APP.config['TICKETS_FOLDER'] = os.path.join( - self.path, 'tickets') - pagure.APP.config['DOCS_FOLDER'] = os.path.join( - self.path, 'docs') pagure.APP.config['UPLOAD_FOLDER_PATH'] = os.path.join( self.path, 'releases') self.app = pagure.APP.test_client() @@ -68,11 +61,11 @@ class PagureFlaskRepoOldUrltests(tests.Modeltests): """ Test the view_commit_old endpoint. """ tests.create_projects(self.session) - tests.create_projects_git(self.path, bare=True) + tests.create_projects_git(os.path.join(self.path, 'repos'), bare=True) # Add a README to the git repo - First commit - tests.add_readme_git_repo(os.path.join(self.path, 'test.git')) - repo = pygit2.Repository(os.path.join(self.path, 'test.git')) + tests.add_readme_git_repo(os.path.join(self.path, 'repos', 'test.git')) + repo = pygit2.Repository(os.path.join(self.path, 'repos', 'test.git')) commit = repo.revparse_single('HEAD') # View first commit @@ -118,9 +111,10 @@ class PagureFlaskRepoOldUrltests(tests.Modeltests): '#ddffdd">+ ======' in output.data) # Add some content to the git repo - tests.add_content_git_repo(os.path.join(self.path, 'test.git')) + tests.add_content_git_repo(os.path.join(self.path, 'repos', + 'test.git')) - repo = pygit2.Repository(os.path.join(self.path, 'test.git')) + repo = pygit2.Repository(os.path.join(self.path, 'repos', 'test.git')) commit = repo.revparse_single('HEAD') # View another commit @@ -158,7 +152,7 @@ class PagureFlaskRepoOldUrltests(tests.Modeltests): self.session.add(item) self.session.commit() forkedgit = os.path.join( - self.path, 'forks', 'pingou', 'test3.git') + self.path, 'repos', 'forks', 'pingou', 'test3.git') tests.add_content_git_repo(forkedgit) tests.add_readme_git_repo(forkedgit) diff --git a/tests/test_pagure_flask_ui_plugins.py b/tests/test_pagure_flask_ui_plugins.py index d572f1c..aed76e0 100644 --- a/tests/test_pagure_flask_ui_plugins.py +++ b/tests/test_pagure_flask_ui_plugins.py @@ -55,11 +55,6 @@ class PagureFlaskPluginstests(tests.Modeltests): pagure.ui.repo.SESSION = self.session pagure.ui.filters.SESSION = self.session - pagure.APP.config['GIT_FOLDER'] = self.path - pagure.APP.config['TICKETS_FOLDER'] = os.path.join( - self.path, 'tickets') - pagure.APP.config['DOCS_FOLDER'] = os.path.join( - self.path, 'docs') self.app = pagure.APP.test_client() def test_get_plugin_names(self): @@ -92,7 +87,7 @@ class PagureFlaskPluginstests(tests.Modeltests): self.assertEqual(output.status_code, 404) tests.create_projects(self.session) - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) output = self.app.get('/test/settings/Mail') self.assertEqual(output.status_code, 403) diff --git a/tests/test_pagure_flask_ui_plugins_default_hook.py b/tests/test_pagure_flask_ui_plugins_default_hook.py index 4fae359..fee7f9b 100644 --- a/tests/test_pagure_flask_ui_plugins_default_hook.py +++ b/tests/test_pagure_flask_ui_plugins_default_hook.py @@ -42,20 +42,13 @@ class PagureFlaskPluginDefaultHooktests(tests.Modeltests): pagure.ui.repo.SESSION = self.session pagure.ui.filters.SESSION = self.session - pagure.APP.config['GIT_FOLDER'] = self.path - pagure.APP.config['TICKETS_FOLDER'] = os.path.join( - self.path, 'tickets') - pagure.APP.config['REQUESTS_FOLDER'] = os.path.join( - self.path, 'requests') - pagure.APP.config['DOCS_FOLDER'] = os.path.join( - self.path, 'docs') self.app = pagure.APP.test_client() def test_plugin_default_ui(self): """ Test the default hook plugin on/off endpoint. """ tests.create_projects(self.session) - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) user = tests.FakeUser(username='pingou') with tests.user_set(pagure.APP, user): @@ -67,13 +60,13 @@ class PagureFlaskPluginDefaultHooktests(tests.Modeltests): project is created. """ - msg = pagure.lib.new_project( + taskid = pagure.lib.new_project( self.session, user='pingou', name='test', blacklist=[], allowed_prefix=[], - gitfolder=self.path, + gitfolder=os.path.join(self.path, 'repos'), docfolder=os.path.join(self.path, 'docs'), ticketfolder=os.path.join(self.path, 'tickets'), requestfolder=os.path.join(self.path, 'requests'), @@ -85,13 +78,16 @@ class PagureFlaskPluginDefaultHooktests(tests.Modeltests): prevent_40_chars=False, namespace=None ) - - self.assertEqual(msg, 'Project "test" created') + result = pagure.lib.tasks.get_result(taskid).get() + self.assertEqual(result, + {'endpoint': 'view_repo', + 'repo': 'test', + 'namespace': None}) self.assertTrue(os.path.exists(os.path.join( - self.path, 'test.git', 'hooks', 'post-receive.default'))) + self.path, 'repos', 'test.git', 'hooks', 'post-receive.default'))) self.assertTrue(os.path.exists(os.path.join( - self.path, 'test.git', 'hooks', 'post-receive'))) + self.path, 'repos', 'test.git', 'hooks', 'post-receive'))) if __name__ == '__main__': diff --git a/tests/test_pagure_flask_ui_plugins_fedmsg.py b/tests/test_pagure_flask_ui_plugins_fedmsg.py index db7a8f6..86d7d4a 100644 --- a/tests/test_pagure_flask_ui_plugins_fedmsg.py +++ b/tests/test_pagure_flask_ui_plugins_fedmsg.py @@ -42,18 +42,13 @@ class PagureFlaskPluginFedmsgtests(tests.Modeltests): pagure.ui.repo.SESSION = self.session pagure.ui.filters.SESSION = self.session - pagure.APP.config['GIT_FOLDER'] = self.path - pagure.APP.config['TICKETS_FOLDER'] = os.path.join( - self.path, 'tickets') - pagure.APP.config['DOCS_FOLDER'] = os.path.join( - self.path, 'docs') self.app = pagure.APP.test_client() def test_plugin_fedmsg(self): """ Test the fedmsg plugin on/off endpoint. """ tests.create_projects(self.session) - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) user = tests.FakeUser(username='pingou') with tests.user_set(pagure.APP, user): @@ -83,7 +78,8 @@ class PagureFlaskPluginFedmsgtests(tests.Modeltests): in output.data) self.assertFalse(os.path.exists(os.path.join( - self.path, 'test.git', 'hooks', 'post-receive.fedmsg'))) + self.path, 'repos', 'test.git', 'hooks', + 'post-receive.fedmsg'))) data['csrf_token'] = csrf_token @@ -107,7 +103,8 @@ class PagureFlaskPluginFedmsgtests(tests.Modeltests): output.data) self.assertFalse(os.path.exists(os.path.join( - self.path, 'test.git', 'hooks', 'post-receive.fedmsg'))) + self.path, 'repos', 'test.git', 'hooks', + 'post-receive.fedmsg'))) # Activate hook data = { @@ -135,7 +132,8 @@ class PagureFlaskPluginFedmsgtests(tests.Modeltests): 'value="y">' in output.data) self.assertTrue(os.path.exists(os.path.join( - self.path, 'test.git', 'hooks', 'post-receive.fedmsg'))) + self.path, 'repos', 'test.git', 'hooks', + 'post-receive.fedmsg'))) # De-Activate hook data = {'csrf_token': csrf_token} @@ -159,7 +157,8 @@ class PagureFlaskPluginFedmsgtests(tests.Modeltests): 'value="y">' in output.data) self.assertFalse(os.path.exists(os.path.join( - self.path, 'test.git', 'hooks', 'post-receive.fedmsg'))) + self.path, 'repos', 'test.git', 'hooks', + 'post-receive.fedmsg'))) if __name__ == '__main__': diff --git a/tests/test_pagure_flask_ui_plugins_irc.py b/tests/test_pagure_flask_ui_plugins_irc.py index 862bc3e..2055a98 100644 --- a/tests/test_pagure_flask_ui_plugins_irc.py +++ b/tests/test_pagure_flask_ui_plugins_irc.py @@ -42,18 +42,13 @@ class PagureFlaskPluginIRCtests(tests.Modeltests): pagure.ui.repo.SESSION = self.session pagure.ui.filters.SESSION = self.session - pagure.APP.config['GIT_FOLDER'] = self.path - pagure.APP.config['TICKETS_FOLDER'] = os.path.join( - self.path, 'tickets') - pagure.APP.config['DOCS_FOLDER'] = os.path.join( - self.path, 'docs') self.app = pagure.APP.test_client() def test_plugin_mail(self): """ Test the irc plugin on/off endpoint. """ tests.create_projects(self.session) - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) user = tests.FakeUser(username='pingou') with tests.user_set(pagure.APP, user): @@ -83,7 +78,7 @@ class PagureFlaskPluginIRCtests(tests.Modeltests): in output.data) self.assertFalse(os.path.exists(os.path.join( - self.path, 'test.git', 'hooks', 'post-receive.irc'))) + self.path, 'repos', 'test.git', 'hooks', 'post-receive.irc'))) data['csrf_token'] = csrf_token @@ -108,7 +103,7 @@ class PagureFlaskPluginIRCtests(tests.Modeltests): in output.data) self.assertFalse(os.path.exists(os.path.join( - self.path, 'test.git', 'hooks', 'post-receive.irc'))) + self.path, 'repos', 'test.git', 'hooks', 'post-receive.irc'))) # Activate hook data = { @@ -140,7 +135,7 @@ class PagureFlaskPluginIRCtests(tests.Modeltests): # TODO: Fix this #self.assertTrue(os.path.exists(os.path.join( - #self.path, 'test.git', 'hooks', 'post-receive.irc'))) + #self.path, 'repos', 'test.git', 'hooks', 'post-receive.irc'))) # De-Activate hook data = {'csrf_token': csrf_token} @@ -163,7 +158,7 @@ class PagureFlaskPluginIRCtests(tests.Modeltests): 'value="y">' in output.data) self.assertFalse(os.path.exists(os.path.join( - self.path, 'test.git', 'hooks', 'post-receive.irc'))) + self.path, 'repos', 'test.git', 'hooks', 'post-receive.irc'))) if __name__ == '__main__': diff --git a/tests/test_pagure_flask_ui_plugins_mail.py b/tests/test_pagure_flask_ui_plugins_mail.py index 0f29008..2607093 100644 --- a/tests/test_pagure_flask_ui_plugins_mail.py +++ b/tests/test_pagure_flask_ui_plugins_mail.py @@ -42,18 +42,13 @@ class PagureFlaskPluginMailtests(tests.Modeltests): pagure.ui.repo.SESSION = self.session pagure.ui.filters.SESSION = self.session - pagure.APP.config['GIT_FOLDER'] = self.path - pagure.APP.config['TICKETS_FOLDER'] = os.path.join( - self.path, 'tickets') - pagure.APP.config['DOCS_FOLDER'] = os.path.join( - self.path, 'docs') self.app = pagure.APP.test_client() def test_plugin_mail(self): """ Test the mail plugin on/off endpoint. """ tests.create_projects(self.session) - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) user = tests.FakeUser(username='pingou') with tests.user_set(pagure.APP, user): @@ -114,7 +109,7 @@ class PagureFlaskPluginMailtests(tests.Modeltests): in output.data) self.assertFalse(os.path.exists(os.path.join( - self.path, 'test.git', 'hooks', 'post-receive.mail'))) + self.path, 'repos', 'test.git', 'hooks', 'post-receive.mail'))) # Missing the required mail_to data = {'csrf_token': csrf_token, 'active': 'y'} @@ -137,7 +132,7 @@ class PagureFlaskPluginMailtests(tests.Modeltests): 'value="y">' in output.data) self.assertFalse(os.path.exists(os.path.join( - self.path, 'test.git', 'hooks', 'post-receive.mail'))) + self.path, 'repos', 'test.git', 'hooks', 'post-receive.mail'))) # Activate hook data = { @@ -168,7 +163,7 @@ class PagureFlaskPluginMailtests(tests.Modeltests): 'value="y">' in output.data) self.assertTrue(os.path.exists(os.path.join( - self.path, 'test.git', 'hooks', 'post-receive.mail'))) + self.path, 'repos', 'test.git', 'hooks', 'post-receive.mail'))) # De-Activate hook data = {'csrf_token': csrf_token} @@ -194,7 +189,7 @@ class PagureFlaskPluginMailtests(tests.Modeltests): 'value="y">' in output.data) self.assertFalse(os.path.exists(os.path.join( - self.path, 'test.git', 'hooks', 'post-receive.mail'))) + self.path, 'repos', 'test.git', 'hooks', 'post-receive.mail'))) if __name__ == '__main__': diff --git a/tests/test_pagure_flask_ui_plugins_noff.py b/tests/test_pagure_flask_ui_plugins_noff.py index bdbb40c..e185e07 100644 --- a/tests/test_pagure_flask_ui_plugins_noff.py +++ b/tests/test_pagure_flask_ui_plugins_noff.py @@ -42,18 +42,13 @@ class PagureFlaskPluginNoFFtests(tests.Modeltests): pagure.ui.repo.SESSION = self.session pagure.ui.filters.SESSION = self.session - pagure.APP.config['GIT_FOLDER'] = self.path - pagure.APP.config['TICKETS_FOLDER'] = os.path.join( - self.path, 'tickets') - pagure.APP.config['DOCS_FOLDER'] = os.path.join( - self.path, 'docs') self.app = pagure.APP.test_client() def test_plugin_noff(self): """ Test the noff plugin on/off endpoint. """ tests.create_projects(self.session) - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) user = tests.FakeUser(username='pingou') with tests.user_set(pagure.APP, user): @@ -125,7 +120,7 @@ class PagureFlaskPluginNoFFtests(tests.Modeltests): in output.data) self.assertFalse(os.path.exists(os.path.join( - self.path, 'test.git', 'hooks', 'post-receive.mail'))) + self.path, 'repos', 'test.git', 'hooks', 'post-receive.mail'))) # Missing the required mail_to data = {'csrf_token': csrf_token, 'active': 'y'} @@ -151,7 +146,7 @@ class PagureFlaskPluginNoFFtests(tests.Modeltests): 'value="y">' in output.data) self.assertFalse(os.path.exists(os.path.join( - self.path, 'test.git', 'hooks', + self.path, 'repos', 'test.git', 'hooks', 'pre-receive.pagureforcecommit'))) # Activate hook @@ -188,7 +183,7 @@ class PagureFlaskPluginNoFFtests(tests.Modeltests): 'value="y">', output.data) self.assertTrue(os.path.exists(os.path.join( - self.path, 'test.git', 'hooks', + self.path, 'repos', 'test.git', 'hooks', 'pre-receive.pagureforcecommit'))) # De-Activate hook @@ -220,7 +215,7 @@ class PagureFlaskPluginNoFFtests(tests.Modeltests): 'value="y">', output.data) self.assertFalse(os.path.exists(os.path.join( - self.path, 'test.git', 'hooks', + self.path, 'repos', 'test.git', 'hooks', 'pre-receive.pagureforcecommit'))) diff --git a/tests/test_pagure_flask_ui_plugins_pagure_ci.py b/tests/test_pagure_flask_ui_plugins_pagure_ci.py index f35a60e..e92605d 100644 --- a/tests/test_pagure_flask_ui_plugins_pagure_ci.py +++ b/tests/test_pagure_flask_ui_plugins_pagure_ci.py @@ -39,18 +39,13 @@ class PagureFlaskPluginPagureCItests(tests.Modeltests): pagure.ui.repo.SESSION = self.session pagure.ui.filters.SESSION = self.session - pagure.APP.config['GIT_FOLDER'] = self.path - pagure.APP.config['TICKETS_FOLDER'] = os.path.join( - self.path, 'tickets') - pagure.APP.config['DOCS_FOLDER'] = os.path.join( - self.path, 'docs') self.app = pagure.APP.test_client() def test_plugin_pagure_ci(self): """ Test the pagure ci plugin on/off endpoint. """ tests.create_projects(self.session) - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) user = tests.FakeUser(username='pingou') with tests.user_set(pagure.APP, user): @@ -189,7 +184,7 @@ class PagureFlaskPluginPagureCItests(tests.Modeltests): """ Test the pagure ci plugin on/off endpoint. """ tests.create_projects(self.session) - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) user = tests.FakeUser(username='pingou') with tests.user_set(pagure.APP, user): diff --git a/tests/test_pagure_flask_ui_plugins_pagure_hook.py b/tests/test_pagure_flask_ui_plugins_pagure_hook.py index e702dab..8cd9877 100644 --- a/tests/test_pagure_flask_ui_plugins_pagure_hook.py +++ b/tests/test_pagure_flask_ui_plugins_pagure_hook.py @@ -42,20 +42,13 @@ class PagureFlaskPluginPagureHooktests(tests.Modeltests): pagure.ui.repo.SESSION = self.session pagure.ui.filters.SESSION = self.session - pagure.APP.config['GIT_FOLDER'] = self.path - pagure.APP.config['TICKETS_FOLDER'] = os.path.join( - self.path, 'tickets') - pagure.APP.config['REQUESTS_FOLDER'] = os.path.join( - self.path, 'requests') - pagure.APP.config['DOCS_FOLDER'] = os.path.join( - self.path, 'docs') self.app = pagure.APP.test_client() def test_plugin_mail(self): """ Test the pagure hook plugin on/off endpoint. """ tests.create_projects(self.session) - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) user = tests.FakeUser(username='pingou') with tests.user_set(pagure.APP, user): @@ -111,7 +104,8 @@ class PagureFlaskPluginPagureHooktests(tests.Modeltests): in output.data) self.assertFalse(os.path.exists(os.path.join( - self.path, 'test.git', 'hooks', 'post-receive.pagure'))) + self.path, 'repos', 'test.git', 'hooks', + 'post-receive.pagure'))) # Activate hook data = { @@ -140,7 +134,8 @@ class PagureFlaskPluginPagureHooktests(tests.Modeltests): 'value="y">' in output.data) self.assertTrue(os.path.exists(os.path.join( - self.path, 'test.git', 'hooks', 'post-receive.pagure'))) + self.path, 'repos', 'test.git', 'hooks', + 'post-receive.pagure'))) # De-Activate hook data = {'csrf_token': csrf_token} @@ -165,7 +160,8 @@ class PagureFlaskPluginPagureHooktests(tests.Modeltests): 'value="y">' in output.data) self.assertFalse(os.path.exists(os.path.join( - self.path, 'test.git', 'hooks', 'post-receive.pagure'))) + self.path, 'repos', 'test.git', 'hooks', + 'post-receive.pagure'))) if __name__ == '__main__': diff --git a/tests/test_pagure_flask_ui_plugins_pagure_request_hook.py b/tests/test_pagure_flask_ui_plugins_pagure_request_hook.py index 980dc87..28a639e 100644 --- a/tests/test_pagure_flask_ui_plugins_pagure_request_hook.py +++ b/tests/test_pagure_flask_ui_plugins_pagure_request_hook.py @@ -42,18 +42,13 @@ class PagureFlaskPluginPagureRequestHooktests(tests.Modeltests): pagure.ui.repo.SESSION = self.session pagure.ui.filters.SESSION = self.session - pagure.APP.config['GIT_FOLDER'] = self.path - pagure.APP.config['REQUESTS_FOLDER'] = os.path.join( - self.path, 'requests') - pagure.APP.config['DOCS_FOLDER'] = os.path.join( - self.path, 'docs') self.app = pagure.APP.test_client() def test_plugin_pagure_request(self): """ Test the pagure_request plugin on/off endpoint. """ tests.create_projects(self.session) - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) user = tests.FakeUser(username='pingou') with tests.user_set(pagure.APP, user): diff --git a/tests/test_pagure_flask_ui_plugins_pagure_ticket_hook.py b/tests/test_pagure_flask_ui_plugins_pagure_ticket_hook.py index cb2a1b0..7eb0a75 100644 --- a/tests/test_pagure_flask_ui_plugins_pagure_ticket_hook.py +++ b/tests/test_pagure_flask_ui_plugins_pagure_ticket_hook.py @@ -42,18 +42,13 @@ class PagureFlaskPluginPagureTicketHooktests(tests.Modeltests): pagure.ui.repo.SESSION = self.session pagure.ui.filters.SESSION = self.session - pagure.APP.config['GIT_FOLDER'] = self.path - pagure.APP.config['TICKETS_FOLDER'] = os.path.join( - self.path, 'tickets') - pagure.APP.config['DOCS_FOLDER'] = os.path.join( - self.path, 'docs') self.app = pagure.APP.test_client() def test_plugin_pagure_ticket(self): """ Test the pagure_ticket plugin on/off endpoint. """ tests.create_projects(self.session) - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) user = tests.FakeUser(username='pingou') with tests.user_set(pagure.APP, user): diff --git a/tests/test_pagure_flask_ui_plugins_rtd_hook.py b/tests/test_pagure_flask_ui_plugins_rtd_hook.py index 8408d21..f54fdd4 100644 --- a/tests/test_pagure_flask_ui_plugins_rtd_hook.py +++ b/tests/test_pagure_flask_ui_plugins_rtd_hook.py @@ -42,18 +42,13 @@ class PagureFlaskPluginRtdHooktests(tests.Modeltests): pagure.ui.repo.SESSION = self.session pagure.ui.filters.SESSION = self.session - pagure.APP.config['GIT_FOLDER'] = self.path - pagure.APP.config['REQUESTS_FOLDER'] = os.path.join( - self.path, 'requests') - pagure.APP.config['DOCS_FOLDER'] = os.path.join( - self.path, 'docs') self.app = pagure.APP.test_client() def test_plugin_pagure_request(self): """ Test the pagure_request plugin on/off endpoint. """ tests.create_projects(self.session) - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) user = tests.FakeUser(username='pingou') with tests.user_set(pagure.APP, user): @@ -141,7 +136,7 @@ class PagureFlaskPluginRtdHooktests(tests.Modeltests): 'value="y">', output.data) self.assertTrue(os.path.exists(os.path.join( - self.path, 'test.git', 'hooks', + self.path, 'repos', 'test.git', 'hooks', 'post-receive.rtd'))) # De-Activate hook @@ -168,7 +163,7 @@ class PagureFlaskPluginRtdHooktests(tests.Modeltests): 'value="y">', output.data) self.assertFalse(os.path.exists(os.path.join( - self.path, 'test.git', 'hooks', + self.path, 'repos', 'test.git', 'hooks', 'post-receive.rtd'))) # Try re-activate hook w/o the git repo @@ -177,7 +172,7 @@ class PagureFlaskPluginRtdHooktests(tests.Modeltests): 'active': 'y', 'project_name': 'foo', } - shutil.rmtree(os.path.join(self.path, 'test.git')) + shutil.rmtree(os.path.join(self.path, 'repos', 'test.git')) output = self.app.post('/test/settings/Read the Doc', data=data) self.assertEqual(output.status_code, 404) diff --git a/tests/test_pagure_flask_ui_plugins_unsigned.py b/tests/test_pagure_flask_ui_plugins_unsigned.py index cca5bd3..a4635d9 100644 --- a/tests/test_pagure_flask_ui_plugins_unsigned.py +++ b/tests/test_pagure_flask_ui_plugins_unsigned.py @@ -42,18 +42,13 @@ class PagureFlaskPluginUnsignedtests(tests.Modeltests): pagure.ui.repo.SESSION = self.session pagure.ui.filters.SESSION = self.session - pagure.APP.config['GIT_FOLDER'] = self.path - pagure.APP.config['TICKETS_FOLDER'] = os.path.join( - self.path, 'tickets') - pagure.APP.config['DOCS_FOLDER'] = os.path.join( - self.path, 'docs') self.app = pagure.APP.test_client() def test_plugin_unsigned(self): """ Test the noff plugin on/off endpoint. """ tests.create_projects(self.session) - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) user = tests.FakeUser(username='pingou') with tests.user_set(pagure.APP, user): @@ -116,7 +111,7 @@ class PagureFlaskPluginUnsignedtests(tests.Modeltests): in output.data) self.assertFalse(os.path.exists(os.path.join( - self.path, 'test.git', 'hooks', + self.path, 'repos', 'test.git', 'hooks', 'pre-receive.pagureunsignedcommit'))) # Activate the hook @@ -137,7 +132,7 @@ class PagureFlaskPluginUnsignedtests(tests.Modeltests): output.data) self.assertTrue(os.path.exists(os.path.join( - self.path, 'test.git', 'hooks', + self.path, 'repos', 'test.git', 'hooks', 'pre-receive.pagureunsignedcommit'))) # De-Activate hook @@ -166,7 +161,7 @@ class PagureFlaskPluginUnsignedtests(tests.Modeltests): 'value="y">', output.data) self.assertFalse(os.path.exists(os.path.join( - self.path, 'test.git', 'hooks', + self.path, 'repos', 'test.git', 'hooks', 'pre-receive.pagureunsignedcommit'))) diff --git a/tests/test_pagure_flask_ui_priorities.py b/tests/test_pagure_flask_ui_priorities.py index 356b744..278fe4f 100644 --- a/tests/test_pagure_flask_ui_priorities.py +++ b/tests/test_pagure_flask_ui_priorities.py @@ -46,13 +46,6 @@ class PagureFlaskPrioritiestests(tests.Modeltests): pagure.ui.repo.SESSION = self.session pagure.ui.issues.SESSION = self.session - pagure.APP.config['GIT_FOLDER'] = self.path - pagure.APP.config['REQUESTS_FOLDER'] = os.path.join( - self.path, 'requests') - pagure.APP.config['TICKETS_FOLDER'] = os.path.join( - self.path, 'tickets') - pagure.APP.config['DOCS_FOLDER'] = os.path.join( - self.path, 'docs') self.app = pagure.APP.test_client() @patch('pagure.lib.git.update_git') @@ -63,7 +56,7 @@ class PagureFlaskPrioritiestests(tests.Modeltests): p_ugt.return_value = True tests.create_projects(self.session) - tests.create_projects_git(os.path.join(self.path), bare=True) + tests.create_projects_git(os.path.join(self.path, 'repos'), bare=True) user = tests.FakeUser() user.username = 'pingou' @@ -108,7 +101,7 @@ class PagureFlaskPrioritiestests(tests.Modeltests): p_ugt.return_value = True tests.create_projects(self.session) - tests.create_projects_git(os.path.join(self.path), bare=True) + tests.create_projects_git(os.path.join(self.path, 'repos'), bare=True) # Set some priorities repo = pagure.get_authorized_project(self.session, 'test') @@ -154,7 +147,7 @@ class PagureFlaskPrioritiestests(tests.Modeltests): def test_update_priorities(self): """ Test updating priorities of a repo. """ tests.create_projects(self.session) - tests.create_projects_git(os.path.join(self.path), bare=True) + tests.create_projects_git(os.path.join(self.path, 'repos'), bare=True) # Set some priorities repo = pagure.get_authorized_project(self.session, 'test') @@ -361,7 +354,7 @@ class PagureFlaskPrioritiestests(tests.Modeltests): p_ugt.return_value = True tests.create_projects(self.session) - tests.create_projects_git(os.path.join(self.path), bare=True) + tests.create_projects_git(os.path.join(self.path, 'repos'), bare=True) # Start from scrach on priorities repo = pagure.lib._get_project(self.session, 'test') diff --git a/tests/test_pagure_flask_ui_quick_reply.py b/tests/test_pagure_flask_ui_quick_reply.py index 6e9a377..737f2ec 100644 --- a/tests/test_pagure_flask_ui_quick_reply.py +++ b/tests/test_pagure_flask_ui_quick_reply.py @@ -40,14 +40,9 @@ class PagureFlaskQuickReplytest(tests.Modeltests): pagure.ui.repo.SESSION = self.session pagure.ui.SESSION = self.session - pagure.APP.config['GIT_FOLDER'] = self.path - pagure.APP.config['TICKETS_FOLDER'] = os.path.join( - self.path, 'tickets') - pagure.APP.config['DOCS_FOLDER'] = os.path.join( - self.path, 'docs') self.app = pagure.APP.test_client() tests.create_projects(self.session) - tests.create_projects_git(os.path.join(self.path), bare=True) + tests.create_projects_git(os.path.join(self.path, 'repos'), bare=True) self.admin = tests.FakeUser(username='pingou') self.user = tests.FakeUser(username='ralph') diff --git a/tests/test_pagure_flask_ui_repo.py b/tests/test_pagure_flask_ui_repo.py index 34d14ee..f8581ba 100644 --- a/tests/test_pagure_flask_ui_repo.py +++ b/tests/test_pagure_flask_ui_repo.py @@ -46,13 +46,6 @@ class PagureFlaskRepotests(tests.Modeltests): pagure.ui.repo.SESSION = self.session pagure.APP.config['VIRUS_SCAN_ATTACHMENTS'] = False - pagure.APP.config['GIT_FOLDER'] = self.path - pagure.APP.config['REQUESTS_FOLDER'] = os.path.join( - self.path, 'requests') - pagure.APP.config['TICKETS_FOLDER'] = os.path.join( - self.path, 'tickets') - pagure.APP.config['DOCS_FOLDER'] = os.path.join( - self.path, 'docs') pagure.APP.config['UPLOAD_FOLDER_URL'] = '/releases/' pagure.APP.config['UPLOAD_FOLDER_PATH'] = os.path.join( self.path, 'releases') @@ -70,7 +63,7 @@ class PagureFlaskRepotests(tests.Modeltests): self.assertEqual(output.status_code, 404) tests.create_projects(self.session) - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) # User not logged in output = self.app.get('/test/adduser') @@ -102,7 +95,7 @@ class PagureFlaskRepotests(tests.Modeltests): self.assertEqual(output.status_code, 404) data['user'] = 'foo' - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) output = self.app.post( '/test/adduser', data=data, follow_redirects=True) self.assertEqual(output.status_code, 404) @@ -120,7 +113,7 @@ class PagureFlaskRepotests(tests.Modeltests): self.assertEqual(output.status_code, 404) tests.create_projects(self.session) - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) # User not logged in output = self.app.get('/test/adddeploykey') @@ -223,7 +216,7 @@ class PagureFlaskRepotests(tests.Modeltests): self.assertEqual(output.status_code, 404) tests.create_projects(self.session) - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) # User not logged in output = self.app.get('/test/adduser') @@ -318,7 +311,7 @@ class PagureFlaskRepotests(tests.Modeltests): self.assertEqual(output.status_code, 404) tests.create_projects(self.session) - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) # User not logged in output = self.app.get('/test/addgroup') @@ -376,7 +369,7 @@ class PagureFlaskRepotests(tests.Modeltests): self.assertEqual(output.status_code, 404) tests.create_projects(self.session) - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) # User not logged in output = self.app.get('/test/addgroup') @@ -482,7 +475,7 @@ class PagureFlaskRepotests(tests.Modeltests): user = tests.FakeUser(username='pingou') with tests.user_set(pagure.APP, user): tests.create_projects(self.session) - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) output = self.app.post('/test/settings') @@ -537,7 +530,7 @@ class PagureFlaskRepotests(tests.Modeltests): self.assertEqual(output.status_code, 404) tests.create_projects(self.session) - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) output = self.app.post('/test/dropdeploykey/1') self.assertEqual(output.status_code, 403) @@ -613,7 +606,7 @@ class PagureFlaskRepotests(tests.Modeltests): self.assertEqual(output.status_code, 404) tests.create_projects(self.session) - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) output = self.app.post('/test/dropuser/1') self.assertEqual(output.status_code, 403) @@ -689,7 +682,7 @@ class PagureFlaskRepotests(tests.Modeltests): self.assertEqual(output.status_code, 404) tests.create_projects(self.session) - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) # User not logged in output = self.app.post('/test/dropgroup/1') @@ -761,7 +754,7 @@ class PagureFlaskRepotests(tests.Modeltests): self.assertEqual(output.status_code, 404) tests.create_projects(self.session) - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) output = self.app.post('/test/dropgroup/1') self.assertEqual(output.status_code, 403) @@ -857,7 +850,7 @@ class PagureFlaskRepotests(tests.Modeltests): self.assertEqual(output.status_code, 404) tests.create_projects(self.session) - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) # Session timed-out output = self.app.post('/test/update') @@ -950,7 +943,7 @@ class PagureFlaskRepotests(tests.Modeltests): ast.return_value = False tests.create_projects(self.session) - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) user = tests.FakeUser(username='pingou') with tests.user_set(pagure.APP, user): @@ -1029,7 +1022,7 @@ class PagureFlaskRepotests(tests.Modeltests): self.assertEqual(output.status_code, 404) tests.create_projects(self.session) - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) output = self.app.get('/test/settings') self.assertEqual(output.status_code, 403) @@ -1161,7 +1154,7 @@ class PagureFlaskRepotests(tests.Modeltests): ) self.session.add(item) self.session.commit() - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) output = self.app.get('/test/settings') self.assertEqual(output.status_code, 403) @@ -1254,7 +1247,7 @@ class PagureFlaskRepotests(tests.Modeltests): self.assertEqual(output.status_code, 404) tests.create_projects(self.session) - tests.create_projects_git(self.path, bare=True) + tests.create_projects_git(os.path.join(self.path, 'repos'), bare=True) output = self.app.get('/test/forks', follow_redirects=True) self.assertEqual(output.status_code, 200) @@ -1275,7 +1268,7 @@ class PagureFlaskRepotests(tests.Modeltests): self.perfMaxWalks(0, 0) self.perfReset() - tests.create_projects_git(self.path, bare=True) + tests.create_projects_git(os.path.join(self.path, 'repos'), bare=True) output = self.app.get('/test') self.assertEqual(output.status_code, 200) @@ -1296,8 +1289,9 @@ class PagureFlaskRepotests(tests.Modeltests): self.perfReset() # Add some content to the git repo - tests.add_content_git_repo(os.path.join(self.path, 'test.git')) - tests.add_readme_git_repo(os.path.join(self.path, 'test.git')) + 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')) self.perfReset() output = self.app.get('/test') @@ -1323,9 +1317,9 @@ class PagureFlaskRepotests(tests.Modeltests): # Add some content to the git repo tests.add_content_git_repo( - os.path.join(self.path, 'forks', 'pingou', 'test.git')) + os.path.join(self.path, 'repos', 'forks', 'pingou', 'test.git')) tests.add_readme_git_repo( - os.path.join(self.path, 'forks', 'pingou', 'test.git')) + os.path.join(self.path, 'repos', 'forks', 'pingou', 'test.git')) output = self.app.get('/fork/pingou/test') self.assertEqual(output.status_code, 200) @@ -1350,11 +1344,11 @@ class PagureFlaskRepotests(tests.Modeltests): self.session.commit() tests.add_content_git_repo( - os.path.join(self.path, 'forks', 'pingou', 'test3.git')) + os.path.join(self.path, 'repos', 'forks', 'pingou', 'test3.git')) tests.add_readme_git_repo( - os.path.join(self.path, 'forks', 'pingou', 'test3.git')) + os.path.join(self.path, 'repos', 'forks', 'pingou', 'test3.git')) tests.add_commit_git_repo( - os.path.join(self.path, 'forks', 'pingou', 'test3.git'), + os.path.join(self.path, 'repos', 'forks', 'pingou', 'test3.git'), ncommits=10) output = self.app.get('/fork/pingou/test3') @@ -1372,7 +1366,7 @@ class PagureFlaskRepotests(tests.Modeltests): tests.create_projects(self.session) # Create a git repo to play with - gitrepo = os.path.join(self.path, 'test.git') + gitrepo = os.path.join(self.path, 'repos', 'test.git') pygit2.init_repository(gitrepo, bare=True) # Create a fork of this repo @@ -1428,14 +1422,15 @@ class PagureFlaskRepotests(tests.Modeltests): # No git repo associated self.assertEqual(output.status_code, 404) - tests.create_projects_git(self.path, bare=True) + tests.create_projects_git(os.path.join(self.path, 'repos'), bare=True) output = self.app.get('/test/branch/master') self.assertEqual(output.status_code, 404) # Add some content to the git repo - tests.add_content_git_repo(os.path.join(self.path, 'test.git')) - tests.add_readme_git_repo(os.path.join(self.path, 'test.git')) + 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')) output = self.app.get('/test/branch/master') self.assertEqual(output.status_code, 200) @@ -1458,9 +1453,9 @@ class PagureFlaskRepotests(tests.Modeltests): # Add some content to the git repo tests.add_content_git_repo( - os.path.join(self.path, 'forks', 'pingou', 'test.git')) + os.path.join(self.path, 'repos', 'forks', 'pingou', 'test.git')) tests.add_readme_git_repo( - os.path.join(self.path, 'forks', 'pingou', 'test.git')) + os.path.join(self.path, 'repos', 'forks', 'pingou', 'test.git')) output = self.app.get('/fork/pingou/test/branch/master') self.assertEqual(output.status_code, 200) @@ -1483,11 +1478,11 @@ class PagureFlaskRepotests(tests.Modeltests): self.session.commit() tests.add_content_git_repo( - os.path.join(self.path, 'forks', 'pingou', 'test3.git')) + os.path.join(self.path, 'repos', 'forks', 'pingou', 'test3.git')) tests.add_readme_git_repo( - os.path.join(self.path, 'forks', 'pingou', 'test3.git')) + os.path.join(self.path, 'repos', 'forks', 'pingou', 'test3.git')) tests.add_commit_git_repo( - os.path.join(self.path, 'forks', 'pingou', 'test3.git'), + os.path.join(self.path, 'repos', 'forks', 'pingou', 'test3.git'), ncommits=10) output = self.app.get('/fork/pingou/test3/branch/master') @@ -1510,7 +1505,7 @@ class PagureFlaskRepotests(tests.Modeltests): # No git repo associated self.assertEqual(output.status_code, 404) - tests.create_projects_git(self.path, bare=True) + tests.create_projects_git(os.path.join(self.path, 'repos'), bare=True) output = self.app.get('/test/commits') self.assertEqual(output.status_code, 200) @@ -1520,8 +1515,9 @@ class PagureFlaskRepotests(tests.Modeltests): 'test project #1 ', output.data) # Add some content to the git repo - tests.add_content_git_repo(os.path.join(self.path, 'test.git')) - tests.add_readme_git_repo(os.path.join(self.path, 'test.git')) + 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')) output = self.app.get('/test/commits') self.assertEqual(output.status_code, 200) @@ -1553,9 +1549,9 @@ class PagureFlaskRepotests(tests.Modeltests): # Add some content to the git repo tests.add_content_git_repo( - os.path.join(self.path, 'forks', 'pingou', 'test.git')) + os.path.join(self.path, 'repos', 'forks', 'pingou', 'test.git')) tests.add_readme_git_repo( - os.path.join(self.path, 'forks', 'pingou', 'test.git')) + os.path.join(self.path, 'repos', 'forks', 'pingou', 'test.git')) output = self.app.get('/fork/pingou/test/commits?page=abc') self.assertEqual(output.status_code, 200) @@ -1578,11 +1574,11 @@ class PagureFlaskRepotests(tests.Modeltests): self.session.commit() tests.add_content_git_repo( - os.path.join(self.path, 'forks', 'pingou', 'test3.git')) + os.path.join(self.path, 'repos', 'forks', 'pingou', 'test3.git')) tests.add_readme_git_repo( - os.path.join(self.path, 'forks', 'pingou', 'test3.git')) + os.path.join(self.path, 'repos', 'forks', 'pingou', 'test3.git')) tests.add_commit_git_repo( - os.path.join(self.path, 'forks', 'pingou', 'test3.git'), + os.path.join(self.path, 'repos', 'forks', 'pingou', 'test3.git'), ncommits=10) output = self.app.get('/fork/pingou/test3/commits/fobranch') @@ -1709,26 +1705,26 @@ class PagureFlaskRepotests(tests.Modeltests): # No git repo associated self.assertEqual(output.status_code, 404) - tests.create_projects_git(self.path, bare=True) + tests.create_projects_git(os.path.join(self.path, 'repos'), bare=True) output = self.app.get('/test/bar') self.assertEqual(output.status_code, 404) - repo = pygit2.Repository(os.path.join(self.path, 'test.git')) + repo = pygit2.Repository(os.path.join(self.path, 'repos', 'test.git')) # Add one commit to git repo tests.add_commit_git_repo( - os.path.join(self.path, 'test.git'), ncommits=1) + os.path.join(self.path, 'repos', 'test.git'), ncommits=1) c1 = repo.revparse_single('HEAD') # Add another commit to git repo tests.add_commit_git_repo( - os.path.join(self.path, 'test.git'), ncommits=1) + os.path.join(self.path, 'repos', 'test.git'), ncommits=1) c2 = repo.revparse_single('HEAD') # Add one more commit to git repo tests.add_commit_git_repo( - os.path.join(self.path, 'test.git'), + os.path.join(self.path, 'repos', 'test.git'), ncommits=1, filename='Šource') c3 = repo.revparse_single('HEAD') @@ -1753,18 +1749,19 @@ class PagureFlaskRepotests(tests.Modeltests): # No git repo associated self.assertEqual(output.status_code, 404) - tests.create_projects_git(self.path, bare=True) + tests.create_projects_git(os.path.join(self.path, 'repos'), bare=True) output = self.app.get('/test/blob/foo/f/sources') self.assertEqual(output.status_code, 404) # Add some content to the git repo - tests.add_content_git_repo(os.path.join(self.path, 'test.git')) - tests.add_readme_git_repo(os.path.join(self.path, 'test.git')) + 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, 'test.git'), 'test.jpg') + os.path.join(self.path, 'repos', 'test.git'), 'test.jpg') tests.add_binary_git_repo( - os.path.join(self.path, 'test.git'), 'test_binary') + os.path.join(self.path, 'repos', 'test.git'), 'test_binary') output = self.app.get('/test/blob/master/foofile') self.assertEqual(output.status_code, 404) @@ -1781,7 +1778,7 @@ class PagureFlaskRepotests(tests.Modeltests): # Empty files should also be displayed tests.add_content_to_git( - os.path.join(self.path, 'test.git'), + os.path.join(self.path, 'repos', 'test.git'), filename="emptyfile.md", content="") output = self.app.get('/test/blob/master/f/emptyfile.md') @@ -1804,7 +1801,7 @@ class PagureFlaskRepotests(tests.Modeltests): output.data) # View by commit id - repo = pygit2.Repository(os.path.join(self.path, 'test.git')) + repo = pygit2.Repository(os.path.join(self.path, 'repos', 'test.git')) commit = repo.revparse_single('HEAD') output = self.app.get('/test/blob/%s/f/test.jpg' % commit.oid.hex) @@ -1855,7 +1852,7 @@ class PagureFlaskRepotests(tests.Modeltests): # View file with a non-ascii name tests.add_commit_git_repo( - os.path.join(self.path, 'test.git'), + os.path.join(self.path, 'repos', 'test.git'), ncommits=1, filename='Šource') output = self.app.get('/test/blob/master/f/Šource') self.assertEqual(output.status_code, 200) @@ -1886,11 +1883,11 @@ class PagureFlaskRepotests(tests.Modeltests): self.session.commit() tests.add_content_git_repo( - os.path.join(self.path, 'forks', 'pingou', 'test3.git')) + os.path.join(self.path, 'repos', 'forks', 'pingou', 'test3.git')) tests.add_readme_git_repo( - os.path.join(self.path, 'forks', 'pingou', 'test3.git')) + os.path.join(self.path, 'repos', 'forks', 'pingou', 'test3.git')) tests.add_commit_git_repo( - os.path.join(self.path, 'forks', 'pingou', 'test3.git'), + os.path.join(self.path, 'repos', 'forks', 'pingou', 'test3.git'), ncommits=10) # Verify the nav links correctly when viewing a file/folder in a fork. @@ -1919,15 +1916,16 @@ class PagureFlaskRepotests(tests.Modeltests): """ Test the view_file endpoint. """ tests.create_projects(self.session) - tests.create_projects_git(self.path, bare=True) + 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, 'test.git')) - tests.add_readme_git_repo(os.path.join(self.path, 'test.git')) + 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, 'test.git'), 'test.jpg') + os.path.join(self.path, 'repos', 'test.git'), 'test.jpg') tests.add_binary_git_repo( - os.path.join(self.path, 'test.git'), 'test_binary') + os.path.join(self.path, 'repos', 'test.git'), 'test_binary') # View file output = self.app.get('/test/blob/master/f/sources') @@ -1946,13 +1944,13 @@ class PagureFlaskRepotests(tests.Modeltests): # No git repo associated self.assertEqual(output.status_code, 404) - tests.create_projects_git(self.path, bare=True) + tests.create_projects_git(os.path.join(self.path, 'repos'), bare=True) output = self.app.get('/test/raw/foo/sources') self.assertEqual(output.status_code, 404) # Add some content to the git repo - tests.add_readme_git_repo(os.path.join(self.path, 'test.git')) + tests.add_readme_git_repo(os.path.join(self.path, 'repos', 'test.git')) # View first commit output = self.app.get('/test/raw/master') @@ -1962,11 +1960,12 @@ class PagureFlaskRepotests(tests.Modeltests): self.assertTrue(':Author: Pierre-Yves Chibon' in output.data) # Add some more content to the repo - tests.add_content_git_repo(os.path.join(self.path, 'test.git')) + tests.add_content_git_repo(os.path.join(self.path, 'repos', + 'test.git')) tests.add_binary_git_repo( - os.path.join(self.path, 'test.git'), 'test.jpg') + os.path.join(self.path, 'repos', 'test.git'), 'test.jpg') tests.add_binary_git_repo( - os.path.join(self.path, 'test.git'), 'test_binary') + os.path.join(self.path, 'repos', 'test.git'), 'test_binary') output = self.app.get('/test/raw/master/f/foofile') self.assertEqual(output.status_code, 404) @@ -1984,7 +1983,7 @@ class PagureFlaskRepotests(tests.Modeltests): self.assertTrue(output.data.startswith('\x00\x00\x01\x00')) # View by commit id - repo = pygit2.Repository(os.path.join(self.path, 'test.git')) + repo = pygit2.Repository(os.path.join(self.path, 'repos', 'test.git')) commit = repo.revparse_single('HEAD') output = self.app.get('/test/raw/%s/f/test.jpg' % commit.oid.hex) @@ -2041,11 +2040,11 @@ class PagureFlaskRepotests(tests.Modeltests): self.session.commit() tests.add_content_git_repo( - os.path.join(self.path, 'forks', 'pingou', 'test3.git')) + os.path.join(self.path, 'repos', 'forks', 'pingou', 'test3.git')) tests.add_readme_git_repo( - os.path.join(self.path, 'forks', 'pingou', 'test3.git')) + os.path.join(self.path, 'repos', 'forks', 'pingou', 'test3.git')) tests.add_commit_git_repo( - os.path.join(self.path, 'forks', 'pingou', 'test3.git'), + os.path.join(self.path, 'repos', 'forks', 'pingou', 'test3.git'), ncommits=10) output = self.app.get('/fork/pingou/test3/raw/master/f/sources') @@ -2066,18 +2065,19 @@ class PagureFlaskRepotests(tests.Modeltests): # No git repo associated self.assertEqual(output.status_code, 404) - tests.create_projects_git(self.path, bare=True) + tests.create_projects_git(os.path.join(self.path, 'repos'), bare=True) output = self.app.get('/test/blame/sources') self.assertEqual(output.status_code, 404) # Add some content to the git repo - tests.add_content_git_repo(os.path.join(self.path, 'test.git')) - tests.add_readme_git_repo(os.path.join(self.path, 'test.git')) + 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, 'test.git'), 'test.jpg') + os.path.join(self.path, 'repos', 'test.git'), 'test.jpg') tests.add_binary_git_repo( - os.path.join(self.path, 'test.git'), 'test_binary') + os.path.join(self.path, 'repos', 'test.git'), 'test_binary') output = self.app.get('/test/blame/foofile') self.assertEqual(output.status_code, 404) @@ -2115,7 +2115,7 @@ class PagureFlaskRepotests(tests.Modeltests): # View file with a non-ascii name tests.add_commit_git_repo( - os.path.join(self.path, 'test.git'), + os.path.join(self.path, 'repos', 'test.git'), ncommits=1, filename='Šource') output = self.app.get('/test/blame/Šource') self.assertEqual(output.status_code, 200) @@ -2146,14 +2146,14 @@ class PagureFlaskRepotests(tests.Modeltests): self.session.commit() tests.add_content_git_repo( - os.path.join(self.path, 'forks', 'pingou', 'test3.git')) + os.path.join(self.path, 'repos', 'forks', 'pingou', 'test3.git')) tests.add_readme_git_repo( - os.path.join(self.path, 'forks', 'pingou', 'test3.git')) + os.path.join(self.path, 'repos', 'forks', 'pingou', 'test3.git')) tests.add_commit_git_repo( - os.path.join(self.path, 'forks', 'pingou', 'test3.git'), + os.path.join(self.path, 'repos', 'forks', 'pingou', 'test3.git'), ncommits=10) tests.add_content_to_git( - os.path.join(self.path, 'forks', 'pingou', 'test3.git'), + os.path.join(self.path, 'repos', 'forks', 'pingou', 'test3.git'), content=u'✨☃🍰☃✨'.encode('utf-8')) output = self.app.get('/fork/pingou/test3/blame/sources') @@ -2177,14 +2177,14 @@ class PagureFlaskRepotests(tests.Modeltests): # No git repo associated self.assertEqual(output.status_code, 404) - tests.create_projects_git(self.path, bare=True) + tests.create_projects_git(os.path.join(self.path, 'repos'), bare=True) output = self.app.get('/test/c/bar') self.assertEqual(output.status_code, 404) # Add a README to the git repo - First commit - tests.add_readme_git_repo(os.path.join(self.path, 'test.git')) - repo = pygit2.Repository(os.path.join(self.path, 'test.git')) + tests.add_readme_git_repo(os.path.join(self.path, 'repos', 'test.git')) + repo = pygit2.Repository(os.path.join(self.path, 'repos', 'test.git')) commit = repo.revparse_single('HEAD') # View first commit @@ -2203,9 +2203,10 @@ class PagureFlaskRepotests(tests.Modeltests): self.assertIn('

Project not found

', output.data) # Add some content to the git repo - tests.add_content_git_repo(os.path.join(self.path, 'test.git')) + tests.add_content_git_repo(os.path.join(self.path, 'repos', + 'test.git')) - repo = pygit2.Repository(os.path.join(self.path, 'test.git')) + repo = pygit2.Repository(os.path.join(self.path, 'repos', 'test.git')) commit = repo.revparse_single('HEAD') # View another commit @@ -2246,7 +2247,7 @@ class PagureFlaskRepotests(tests.Modeltests): self.session.add(item) self.session.commit() forkedgit = os.path.join( - self.path, 'forks', 'pingou', 'test3.git') + self.path, 'repos', 'forks', 'pingou', 'test3.git') tests.add_content_git_repo(forkedgit) tests.add_readme_git_repo(forkedgit) @@ -2311,14 +2312,14 @@ class PagureFlaskRepotests(tests.Modeltests): # No git repo associated self.assertEqual(output.status_code, 404) - tests.create_projects_git(self.path, bare=True) + tests.create_projects_git(os.path.join(self.path, 'repos'), bare=True) output = self.app.get('/test/c/bar.patch') self.assertEqual(output.status_code, 404) # Add a README to the git repo - First commit - tests.add_readme_git_repo(os.path.join(self.path, 'test.git')) - repo = pygit2.Repository(os.path.join(self.path, 'test.git')) + tests.add_readme_git_repo(os.path.join(self.path, 'repos', 'test.git')) + repo = pygit2.Repository(os.path.join(self.path, 'repos', 'test.git')) commit = repo.revparse_single('HEAD') # View first commit @@ -2350,9 +2351,10 @@ index 0000000..fb7093d self.assertTrue('Subject: Add a README file' in output.data) # Add some content to the git repo - tests.add_content_git_repo(os.path.join(self.path, 'test.git')) + tests.add_content_git_repo(os.path.join(self.path, 'repos', + 'test.git')) - repo = pygit2.Repository(os.path.join(self.path, 'test.git')) + repo = pygit2.Repository(os.path.join(self.path, 'repos', 'test.git')) commit = repo.revparse_single('HEAD') # View another commit @@ -2384,7 +2386,8 @@ index 0000000..11980b1 ) self.session.add(item) self.session.commit() - forkedgit = os.path.join(self.path, 'forks', 'pingou', 'test3.git') + forkedgit = os.path.join(self.path, 'repos', 'forks', 'pingou', + 'test3.git') tests.add_content_git_repo(forkedgit) tests.add_readme_git_repo(forkedgit) @@ -2436,7 +2439,7 @@ index 0000000..fb7093d # No git repo associated self.assertEqual(output.status_code, 404) - tests.create_projects_git(self.path, bare=True) + tests.create_projects_git(os.path.join(self.path, 'repos'), bare=True) output = self.app.get('/test/tree/') self.assertEqual(output.status_code, 200) @@ -2454,8 +2457,8 @@ index 0000000..fb7093d 'No content found in this repository' in output.data) # Add a README to the git repo - First commit - tests.add_readme_git_repo(os.path.join(self.path, 'test.git')) - repo = pygit2.Repository(os.path.join(self.path, 'test.git')) + tests.add_readme_git_repo(os.path.join(self.path, 'repos', 'test.git')) + repo = pygit2.Repository(os.path.join(self.path, 'repos', 'test.git')) commit = repo.revparse_single('HEAD') # View first commit @@ -2491,7 +2494,8 @@ index 0000000..fb7093d ) self.session.add(item) self.session.commit() - forkedgit = os.path.join(self.path, 'forks', 'pingou', 'test3.git') + forkedgit = os.path.join(self.path, 'repos', 'forks', 'pingou', + 'test3.git') tests.add_content_git_repo(forkedgit) @@ -2534,7 +2538,7 @@ index 0000000..fb7093d user = tests.FakeUser(username='pingou') with tests.user_set(pagure.APP, user): tests.create_projects(self.session) - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) output = self.app.post('/test/delete', follow_redirects=True) self.assertEqual(output.status_code, 404) @@ -2565,7 +2569,7 @@ index 0000000..fb7093d ) self.session.add(item) self.session.commit() - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) tests.create_projects_git(os.path.join(self.path, 'docs')) output = self.app.post('/test/delete', follow_redirects=True) self.assertEqual(output.status_code, 404) @@ -2581,7 +2585,7 @@ index 0000000..fb7093d self.session.commit() # Create all the git repos - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) tests.create_projects_git(os.path.join(self.path, 'docs')) tests.create_projects_git( os.path.join(self.path, 'tickets'), bare=True) @@ -2710,7 +2714,8 @@ index 0000000..fb7093d self.session.add(item) self.session.commit() tests.add_content_git_repo( - os.path.join(self.path, 'forks', 'pingou', 'test3.git')) + os.path.join(self.path, 'repos', 'forks', 'pingou', + 'test3.git')) tests.add_content_git_repo( os.path.join(self.path, 'docs', 'pingou', 'test3.git')) tests.add_content_git_repo( @@ -2746,7 +2751,7 @@ index 0000000..fb7093d user = tests.FakeUser() with tests.user_set(pagure.APP, user): tests.create_projects(self.session) - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) # No project registered in the DB (no git repo) output = self.app.post('/foo/delete') @@ -2762,7 +2767,7 @@ index 0000000..fb7093d user = tests.FakeUser(username='pingou') with tests.user_set(pagure.APP, user): - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) ast.return_value = True output = self.app.post('/test/delete') @@ -2790,7 +2795,7 @@ index 0000000..fb7093d ) self.session.add(item) self.session.commit() - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) output = self.app.post('/test/delete', follow_redirects=True) self.assertEqual(output.status_code, 200) @@ -2813,7 +2818,7 @@ index 0000000..fb7093d ) self.session.add(item) self.session.commit() - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) tests.create_projects_git(os.path.join(self.path, 'docs')) output = self.app.post('/test/delete', follow_redirects=True) self.assertEqual(output.status_code, 200) @@ -2832,7 +2837,7 @@ index 0000000..fb7093d self.session.commit() # Create all the git repos - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) tests.create_projects_git(os.path.join(self.path, 'docs')) tests.create_projects_git( os.path.join(self.path, 'tickets'), bare=True) @@ -2967,7 +2972,8 @@ index 0000000..fb7093d self.session.add(item) self.session.commit() tests.add_content_git_repo( - os.path.join(self.path, 'forks', 'pingou', 'test3.git')) + os.path.join(self.path, 'repos', 'forks', 'pingou', + 'test3.git')) tests.add_content_git_repo( os.path.join(self.path, 'docs', 'pingou', 'test3.git')) tests.add_content_git_repo( @@ -3014,7 +3020,7 @@ index 0000000..fb7093d self.session.commit() # Create all the git repos - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) tests.create_projects_git( os.path.join(self.path, 'docs'), bare=True) tests.create_projects_git( @@ -3094,7 +3100,7 @@ index 0000000..fb7093d self.session.commit() # Create all the git repos - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) tests.create_projects_git( os.path.join(self.path, 'docs'), bare=True) tests.create_projects_git( @@ -3188,7 +3194,7 @@ index 0000000..fb7093d self.session.commit() # Create all the git repos - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) tests.create_projects_git( os.path.join(self.path, 'docs'), bare=True) tests.create_projects_git( @@ -3266,7 +3272,7 @@ index 0000000..fb7093d """ Test the new_repo_hook_token endpoint. """ ast.return_value = False tests.create_projects(self.session) - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) repo = pagure.get_authorized_project(self.session, 'test') self.assertEqual(repo.hook_token, 'aaabbbccc') @@ -3328,7 +3334,7 @@ index 0000000..fb7093d upgit.return_value = True sendmail.return_value = True tests.create_projects(self.session) - tests.create_projects_git(self.path) + tests.create_projects_git(os.path.join(self.path, 'repos')) user = tests.FakeUser() with tests.user_set(pagure.APP, user): @@ -3420,15 +3426,15 @@ index 0000000..fb7093d # No git repo associated self.assertEqual(output.status_code, 404) - tests.create_projects_git(self.path, bare=True) + tests.create_projects_git(os.path.join(self.path, 'repos'), bare=True) output = self.app.get('/test/releases') self.assertEqual(output.status_code, 200) self.assertIn('This project has not been tagged.', output.data) # Add a README to the git repo - First commit - tests.add_readme_git_repo(os.path.join(self.path, 'test.git')) - repo = pygit2.Repository(os.path.join(self.path, 'test.git')) + tests.add_readme_git_repo(os.path.join(self.path, 'repos', 'test.git')) + repo = pygit2.Repository(os.path.join(self.path, 'repos', 'test.git')) first_commit = repo.revparse_single('HEAD') tagger = pygit2.Signature('Alice Doe', 'adoe@example.com', 12347, 0) repo.create_tag( @@ -3455,7 +3461,8 @@ index 0000000..fb7093d self.assertEqual(output.status_code, 404) tests.create_projects(self.session) - tests.create_projects_git(self.path, bare=True) + tests.create_projects_git(os.path.join(self.path, 'repos'), + bare=True) # No a repo admin output = self.app.get('/test/edit/foo/f/sources') @@ -3473,12 +3480,14 @@ index 0000000..fb7093d self.assertEqual(output.status_code, 404) # Add some content to the git repo - tests.add_content_git_repo(os.path.join(self.path, 'test.git')) - tests.add_readme_git_repo(os.path.join(self.path, 'test.git')) + 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, 'test.git'), 'test.jpg') + os.path.join(self.path, 'repos', 'test.git'), 'test.jpg') tests.add_binary_git_repo( - os.path.join(self.path, 'test.git'), 'test_binary') + os.path.join(self.path, 'repos', 'test.git'), 'test_binary') output = self.app.get('/test/edit/master/foofile') self.assertEqual(output.status_code, 404) @@ -3556,9 +3565,7 @@ index 0000000..fb7093d self.assertEqual(output.status_code, 200) self.assertIn( 'Commits - test - Pagure', output.data) - self.assertIn( - '\n Changes committed', - output.data) + self.assertIn('test commit', output.data) # Check file after the commit: output = self.app.get('/test/raw/master/f/sources') @@ -3578,11 +3585,11 @@ index 0000000..fb7093d self.session.commit() tests.add_content_git_repo( - os.path.join(self.path, 'forks', 'pingou', 'test3.git')) + os.path.join(self.path, 'repos', 'forks', 'pingou', 'test3.git')) tests.add_readme_git_repo( - os.path.join(self.path, 'forks', 'pingou', 'test3.git')) + os.path.join(self.path, 'repos', 'forks', 'pingou', 'test3.git')) tests.add_commit_git_repo( - os.path.join(self.path, 'forks', 'pingou', 'test3.git'), + os.path.join(self.path, 'repos', 'forks', 'pingou', 'test3.git'), ncommits=10) # Verify the nav links correctly when editing a file in a fork. @@ -3621,9 +3628,7 @@ index 0000000..fb7093d self.assertEqual(output.status_code, 200) self.assertIn( 'Commits - test - Pagure', output.data) - self.assertIn( - '\n Changes committed', - output.data) + self.assertIn('test commit', output.data) # Check file after the commit: output = self.app.get('/test/raw/master/f/sources') @@ -3651,7 +3656,7 @@ index 0000000..fb7093d self.assertEqual(output.status_code, 404) tests.create_projects(self.session) - repos = tests.create_projects_git(self.path) + repos = tests.create_projects_git(os.path.join(self.path, 'repos')) output = self.app.post('/test/default/branch/') self.assertEqual(output.status_code, 403) @@ -3747,7 +3752,7 @@ index 0000000..fb7093d self.assertEqual(output.status_code, 404) tests.create_projects(self.session) - repo = tests.create_projects_git(self.path) + repo = tests.create_projects_git(os.path.join(self.path, 'repos')) output = self.app.post('/test/upload/') self.assertEqual(output.status_code, 403) @@ -3809,7 +3814,8 @@ index 0000000..fb7093d self.assertEqual(output.status_code, 404) tests.create_projects(self.session) - tests.create_projects_git(self.path, bare=True) + tests.create_projects_git(os.path.join(self.path, 'repos'), + bare=True) output = self.app.get('/test/token/new/') self.assertEqual(output.status_code, 403) @@ -3882,7 +3888,8 @@ index 0000000..fb7093d self.assertEqual(output.status_code, 404) tests.create_projects(self.session) - tests.create_projects_git(self.path, bare=True) + tests.create_projects_git(os.path.join(self.path, 'repos'), + bare=True) output = self.app.post('/test/token/revoke/123') self.assertEqual(output.status_code, 403) @@ -3958,7 +3965,7 @@ index 0000000..fb7093d self.assertEqual(output.status_code, 404) tests.create_projects(self.session) - tests.create_projects_git(self.path, bare=True) + tests.create_projects_git(os.path.join(self.path, 'repos'), bare=True) # User not logged in output = self.app.post('/test/b/master/delete') @@ -3986,7 +3993,7 @@ index 0000000..fb7093d self.assertIn('

Branch not found

', output.data) # Add a branch that we can delete - path = os.path.join(self.path, 'test.git') + path = os.path.join(self.path, 'repos', 'test.git') tests.add_content_git_repo(path) repo = pygit2.Repository(path) repo.create_branch('foo', repo.head.get_object()) @@ -4015,7 +4022,7 @@ index 0000000..fb7093d output.data) # Add a branch with a '/' in its name that we can delete - path = os.path.join(self.path, 'test.git') + path = os.path.join(self.path, 'repos', 'test.git') tests.add_content_git_repo(path) repo = pygit2.Repository(path) repo.create_branch('feature/foo', repo.head.get_object()) @@ -4056,7 +4063,7 @@ index 0000000..fb7093d # No git repo associated self.assertEqual(output.status_code, 404) - tests.create_projects_git(self.path, bare=True) + tests.create_projects_git(os.path.join(self.path, 'repos'), bare=True) output = self.app.get('/docs/test/') self.assertEqual(output.status_code, 404) @@ -4064,7 +4071,7 @@ index 0000000..fb7093d def test_view_project_activity(self): """ Test the view_project_activity endpoint. """ tests.create_projects(self.session) - tests.create_projects_git(self.path, bare=True) + tests.create_projects_git(os.path.join(self.path, 'repos'), bare=True) # Project Exists, but No DATAGREPPER_URL set output = self.app.get('/test/activity/') @@ -4086,7 +4093,7 @@ index 0000000..fb7093d def test_goimport(self): """ Test the go-import tag. """ tests.create_projects(self.session) - tests.create_projects_git(self.path, bare=True) + tests.create_projects_git(os.path.join(self.path, 'repos'), bare=True) output = self.app.get('/test/') self.assertEqual(output.status_code, 200) self.assertIn('