# -*- coding: utf-8 -*- """ (c) 2017 - Copyright Red Hat Inc Authors: Pierre-Yves Chibon """ import unittest import sys import os from mock import patch import pygit2 sys.path.insert(0, os.path.join(os.path.dirname( os.path.abspath(__file__)), '..')) import pagure import pagure.lib import tests class ViewCommitFlagtests(tests.SimplePagureTest): """ Tests for the UI related to commit flags """ def setUp(self): """ Set up the environnment, ran before every tests. """ super(ViewCommitFlagtests, self).setUp() tests.create_projects(self.session) tests.create_tokens(self.session) # Add a README to the git repo - First commit tests.add_readme_git_repo(os.path.join(self.path, 'repos', 'test.git')) repo = pygit2.Repository(os.path.join(self.path, 'repos', 'test.git')) self.commit = repo.revparse_single('HEAD') def test_view_commit_no_flag(self): """ Test the view_commit endpoint. """ # View first commit output = self.app.get('/test/c/%s' % self.commit.oid.hex) self.assertEqual(output.status_code, 200) self.assertIn( 'Commit - test - %s - Pagure' % self.commit.oid.hex, output.data) self.assertIn( '