From 4a383799f57bef75b925ebbfd046b09cf78ed4dd Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jun 07 2015 10:55:19 +0000 Subject: Testing against an empty repo means there are no commits in the repo --- diff --git a/tests/test_progit_flask_ui_fork.py b/tests/test_progit_flask_ui_fork.py index 1068b72..920e0b3 100644 --- a/tests/test_progit_flask_ui_fork.py +++ b/tests/test_progit_flask_ui_fork.py @@ -1314,44 +1314,20 @@ index 0000000..2a552bb gitrepo = os.path.join(tests.HERE, 'forks', 'foo', 'test.git') new_repo = pygit2.clone_repository(gitrepo, newpath) - # Edit the sources file again - with open(os.path.join(newpath, 'sources'), 'w') as stream: - stream.write('foo\n bar\nbaz\n boose') - new_repo.index.add('sources') - new_repo.index.write() - - # Commits the files added - tree = new_repo.index.write_tree() - author = pygit2.Signature( - 'Alice Author', 'alice@authors.tld') - committer = pygit2.Signature( - 'Cecil Committer', 'cecil@committers.tld') - new_repo.create_commit( - 'refs/heads/feature', - author, - committer, - 'A commit on branch feature', - tree, - [] - ) - refname = 'refs/heads/feature' - ori_remote = new_repo.remotes[0] - ori_remote.push(refname) - user = tests.FakeUser() user.username = 'foo' with tests.user_set(pagure.APP, user): - output = self.app.get('/fork/foo/test/diff/master..feature') + output = self.app.get( + '/fork/foo/test/diff/master..feature', + follow_redirects=True) self.assertEqual(output.status_code, 200) self.assertIn( - 'Pull request # - test - Pagure', - output.data) - self.assertIn( - '

No commits found

', output.data) + 'Overview - test - Pagure', output.data) self.assertIn( - '', output.data) + '
  • Fork is empty, there are no commits to ' + 'request pulling
  • ', output.data) + output = self.app.get('/test/new_issue') csrf_token = output.data.split( 'name="csrf_token" type="hidden" value="')[1].split('">')[0]