From 0163a133c02b46235f1b6a67c0601d48abc6b42f Mon Sep 17 00:00:00 2001 From: farhaanbukhsh Date: Apr 14 2017 10:32:36 +0000 Subject: Fix test private repo UI Priviously it was checking only the unchecked box, test condition is added to check if 'private repo' has the 'private' checkbox checked. --- diff --git a/tests/test_pagure_private_repo.py b/tests/test_pagure_private_repo.py index 74e2b58..a6db00c 100644 --- a/tests/test_pagure_private_repo.py +++ b/tests/test_pagure_private_repo.py @@ -327,6 +327,23 @@ class PagurePrivateRepotest(tests.Modeltests): def test_private_settings_ui(self, ast): """ Test UI for private repo""" + #Add private repo + item = pagure.lib.model.Project( + user_id=1, # pingou + name='test4', + description='test project description', + hook_token='aaabbbeeeceee', + private=True, + ) + self.session.add(item) + self.session.commit() + + # Add a git repo + repo_path = os.path.join(tests.HERE, 'test4.git') + if not os.path.exists(repo_path): + os.makedirs(repo_path) + pygit2.init_repository(repo_path) + user = tests.FakeUser(username='pingou') with tests.user_set(pagure.APP, user): tests.create_projects(self.session) @@ -335,10 +352,20 @@ class PagurePrivateRepotest(tests.Modeltests): ast.return_value = False output = self.app.post('/test/settings') + # Check for a public repo self.assertEqual(output.status_code, 200) self.assertIn( '', output.data) + + def test_private_pr(self): """Test pull request made to the private repo"""