Signed-off-by: Fam Zheng <famz@redhat.com>
---
tests/patchewtest.py | 10 ++++++++++
tests/test_git.py | 8 +-------
tests/test_import.py | 10 +++++++++-
3 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/tests/patchewtest.py b/tests/patchewtest.py
index 1b0a867..7e51e70 100644
--- a/tests/patchewtest.py
+++ b/tests/patchewtest.py
@@ -134,6 +134,16 @@ class PatchewTestCase(django.test.LiveServerTestCase):
self.assertEqual(uri, '%sprojects/%d/series/%s/' % (self.REST_BASE, project_id, msgid))
return response
+ def create_git_repo(self, name="test-repo"):
+ repo = os.path.join(self.get_tmpdir(), name)
+ os.mkdir(repo)
+ subprocess.check_output(["git", "init"], cwd=repo)
+ subprocess.check_output(["touch", "foo"], cwd=repo)
+ subprocess.check_output(["git", "add", "foo"], cwd=repo)
+ subprocess.check_output(["git", "commit", "-m", "initial commit"],
+ cwd=repo)
+ return repo
+
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("--debug", "-d", action="store_true",
diff --git a/tests/test_git.py b/tests/test_git.py
index c2c98ae..543f863 100755
--- a/tests/test_git.py
+++ b/tests/test_git.py
@@ -21,13 +21,7 @@ class GitTest(PatchewTestCase):
def setUp(self):
self.create_superuser()
self.cli_login()
- self.repo = os.path.join(self.get_tmpdir(), "repo")
- os.mkdir(self.repo)
- subprocess.check_output(["git", "init"], cwd=self.repo)
- subprocess.check_output(["touch", "foo"], cwd=self.repo)
- subprocess.check_output(["git", "add", "foo"], cwd=self.repo)
- subprocess.check_output(["git", "commit", "-m", "initial commit"],
- cwd=self.repo)
+ self.repo = self.create_git_repo()
self.p = self.add_project("QEMU", "qemu-devel@nongnu.org", git_repo=self.repo)
self.p.set_property("git.push_to", self.repo)
self.p.set_property("git.public_repo", self.repo)
diff --git a/tests/test_import.py b/tests/test_import.py
index 23d0d43..3ad7592 100755
--- a/tests/test_import.py
+++ b/tests/test_import.py
@@ -13,7 +13,7 @@ import os
sys.path.append(os.path.dirname(__file__))
from patchewtest import PatchewTestCase, main
import json
-from api.models import Message
+from api.models import Message, Project
class ImportTest(PatchewTestCase):
@@ -123,5 +123,13 @@ class UnprivilegedImportTest(ImportTest):
self.cli_login("someuser", "somepass")
self.check_import_should_fail()
+ def test_project_update(self):
+ p = Project.objects.all()[0]
+
+ repo = self.create_git_repo()
+ p.git = repo
+ p.save()
+ self.check_cli(["project", "update"])
+
if __name__ == '__main__':
main()
--
2.14.3
_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://www.redhat.com/mailman/listinfo/patchew-devel
© 2016 - 2023 Red Hat, Inc.