test_pagure_flask_ui_remote_pr.py 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
  1. # -*- coding: utf-8 -*-
  2. """
  3. (c) 2018 - Copyright Red Hat Inc
  4. Authors:
  5. Pierre-Yves Chibon <pingou@pingoured.fr>
  6. """
  7. from __future__ import unicode_literals, absolute_import
  8. import json
  9. import os
  10. import re
  11. import shutil
  12. import sys
  13. import tempfile
  14. import time
  15. import unittest
  16. import pygit2
  17. import werkzeug
  18. import wtforms
  19. from mock import patch, MagicMock
  20. from bs4 import BeautifulSoup
  21. sys.path.insert(
  22. 0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")
  23. )
  24. import pagure.lib.query
  25. import tests
  26. from pagure.lib.repo import PagureRepo
  27. from pagure.lib.git import _make_signature
  28. class PagureRemotePRtests(tests.Modeltests):
  29. """Tests for remote PRs in pagure"""
  30. def setUp(self):
  31. """Set up the environment."""
  32. super(PagureRemotePRtests, self).setUp()
  33. self.newpath = tempfile.mkdtemp(prefix="pagure-fork-test")
  34. self.old_value = pagure.config.config["REMOTE_GIT_FOLDER"]
  35. pagure.config.config["REMOTE_GIT_FOLDER"] = os.path.join(
  36. self.path, "remotes"
  37. )
  38. def tearDown(self):
  39. """Clear things up."""
  40. super(PagureRemotePRtests, self).tearDown()
  41. pagure.config.config["REMOTE_GIT_FOLDER"] = self.old_value
  42. shutil.rmtree(self.newpath)
  43. def set_up_git_repo(self, new_project=None, branch_from="feature"):
  44. """Set up the git repo and create the corresponding PullRequest
  45. object.
  46. """
  47. # Create a git repo to play with
  48. gitrepo = os.path.join(self.path, "repos", "test.git")
  49. repo = pygit2.init_repository(gitrepo, bare=True)
  50. repopath = os.path.join(self.newpath, "test")
  51. clone_repo = pygit2.clone_repository(gitrepo, repopath)
  52. # Create a file in that git repo
  53. with open(os.path.join(repopath, "sources"), "w") as stream:
  54. stream.write("foo\n bar")
  55. clone_repo.index.add("sources")
  56. clone_repo.index.write()
  57. try:
  58. com = repo.revparse_single("HEAD")
  59. prev_commit = [com.oid.hex]
  60. except:
  61. prev_commit = []
  62. # Commits the files added
  63. tree = clone_repo.index.write_tree()
  64. author = _make_signature("Alice Author", "alice@authors.tld")
  65. committer = _make_signature("Cecil Committer", "cecil@committers.tld")
  66. clone_repo.create_commit(
  67. "refs/heads/master", # the name of the reference to update
  68. author,
  69. committer,
  70. "Add sources file for testing",
  71. # binary string representing the tree object ID
  72. tree,
  73. # list of binary strings representing parents of the new commit
  74. prev_commit,
  75. )
  76. # time.sleep(1)
  77. refname = "refs/heads/master:refs/heads/master"
  78. ori_remote = clone_repo.remotes[0]
  79. PagureRepo.push(ori_remote, refname)
  80. first_commit = repo.revparse_single("HEAD")
  81. with open(os.path.join(repopath, ".gitignore"), "w") as stream:
  82. stream.write("*~")
  83. clone_repo.index.add(".gitignore")
  84. clone_repo.index.write()
  85. # Commits the files added
  86. tree = clone_repo.index.write_tree()
  87. author = _make_signature("Alice Äuthòr", "alice@äuthòrs.tld")
  88. committer = _make_signature("Cecil Cõmmîttër", "cecil@cõmmîttërs.tld")
  89. clone_repo.create_commit(
  90. "refs/heads/master",
  91. author,
  92. committer,
  93. "Add .gitignore file for testing",
  94. # binary string representing the tree object ID
  95. tree,
  96. # list of binary strings representing parents of the new commit
  97. [first_commit.oid.hex],
  98. )
  99. refname = "refs/heads/master:refs/heads/master"
  100. ori_remote = clone_repo.remotes[0]
  101. PagureRepo.push(ori_remote, refname)
  102. # Set the second repo
  103. new_gitrepo = repopath
  104. if new_project:
  105. # Create a new git repo to play with
  106. new_gitrepo = os.path.join(self.newpath, new_project.fullname)
  107. if not os.path.exists(new_gitrepo):
  108. os.makedirs(new_gitrepo)
  109. new_repo = pygit2.clone_repository(gitrepo, new_gitrepo)
  110. repo = pygit2.Repository(new_gitrepo)
  111. # Edit the sources file again
  112. with open(os.path.join(new_gitrepo, "sources"), "w") as stream:
  113. stream.write("foo\n bar\nbaz\n boose")
  114. repo.index.add("sources")
  115. repo.index.write()
  116. # Commits the files added
  117. tree = repo.index.write_tree()
  118. author = _make_signature("Alice Author", "alice@authors.tld")
  119. committer = _make_signature("Cecil Committer", "cecil@committers.tld")
  120. repo.create_commit(
  121. "refs/heads/%s" % branch_from,
  122. author,
  123. committer,
  124. "A commit on branch %s" % branch_from,
  125. tree,
  126. [first_commit.oid.hex],
  127. )
  128. refname = "refs/heads/%s" % (branch_from)
  129. ori_remote = repo.remotes[0]
  130. PagureRepo.push(ori_remote, refname)
  131. @patch("pagure.lib.notify.send_email", MagicMock(return_value=True))
  132. def test_new_remote_pr_unauth(self):
  133. """Test creating a new remote PR un-authenticated."""
  134. tests.create_projects(self.session)
  135. tests.create_projects_git(
  136. os.path.join(self.path, "requests"), bare=True
  137. )
  138. self.set_up_git_repo()
  139. # Before
  140. project = pagure.lib.query.get_authorized_project(self.session, "test")
  141. self.assertEqual(len(project.requests), 0)
  142. # Try creating a remote PR
  143. output = self.app.get("/test/diff/remote")
  144. self.assertEqual(output.status_code, 302)
  145. expected_response = (
  146. "You should be redirected automatically to target URL: "
  147. '<a href="/login/?'
  148. )
  149. if hasattr(werkzeug, "__version__"):
  150. werkzeug_v = tuple(
  151. int(el) for el in werkzeug.__version__.split(".")
  152. )
  153. if werkzeug_v >= (2, 1, 2):
  154. expected_response = (
  155. "You should be redirected automatically to the target URL: "
  156. '<a href="/login/?'
  157. )
  158. self.assertIn(
  159. expected_response,
  160. output.get_data(as_text=True),
  161. )
  162. @patch("pagure.lib.notify.send_email", MagicMock(return_value=True))
  163. def test_new_remote_pr_auth(self):
  164. """Test creating a new remote PR authenticated."""
  165. tests.create_projects(self.session)
  166. tests.create_projects_git(
  167. os.path.join(self.path, "requests"), bare=True
  168. )
  169. self.set_up_git_repo()
  170. # Before
  171. self.session = pagure.lib.query.create_session(self.dbpath)
  172. project = pagure.lib.query.get_authorized_project(self.session, "test")
  173. self.assertEqual(len(project.requests), 0)
  174. # Try creating a remote PR
  175. user = tests.FakeUser(username="foo")
  176. with tests.user_set(self.app.application, user):
  177. output = self.app.get("/test/diff/remote")
  178. self.assertEqual(output.status_code, 200)
  179. self.assertIn(
  180. "<h2>New remote pull-request</h2>",
  181. output.get_data(as_text=True),
  182. )
  183. csrf_token = self.get_csrf(output=output)
  184. with patch(
  185. "pagure.forms.RemoteRequestPullForm.git_repo.args",
  186. MagicMock(
  187. return_value=(
  188. "Git Repo address",
  189. [wtforms.validators.DataRequired()],
  190. )
  191. ),
  192. ):
  193. data = {
  194. "csrf_token": csrf_token,
  195. "title": "Remote PR title",
  196. "branch_from": "feature",
  197. "branch_to": "master",
  198. "git_repo": os.path.join(self.newpath, "test"),
  199. }
  200. output = self.app.post("/test/diff/remote", data=data)
  201. self.assertEqual(output.status_code, 200)
  202. output_text = output.get_data(as_text=True)
  203. self.assertIn("Create Pull Request\n </div>\n", output_text)
  204. self.assertIn('<div class="card mb-3" id="_1">\n', output_text)
  205. self.assertIn('<div class="card mb-3" id="_2">\n', output_text)
  206. self.assertNotIn(
  207. '<div class="card mb-3" id="_3">\n', output_text
  208. )
  209. # Not saved yet
  210. self.session = pagure.lib.query.create_session(self.dbpath)
  211. project = pagure.lib.query.get_authorized_project(
  212. self.session, "test"
  213. )
  214. self.assertEqual(len(project.requests), 0)
  215. data = {
  216. "csrf_token": csrf_token,
  217. "title": "Remote PR title",
  218. "branch_from": "feature",
  219. "branch_to": "master",
  220. "git_repo": os.path.join(self.newpath, "test"),
  221. "confirm": 1,
  222. }
  223. self.old_value = pagure.config.config["DISABLE_REMOTE_PR"]
  224. pagure.config.config["DISABLE_REMOTE_PR"] = True
  225. output = self.app.post(
  226. "/test/diff/remote", data=data, follow_redirects=True
  227. )
  228. self.assertEqual(output.status_code, 404)
  229. pagure.config.config["DISABLE_REMOTE_PR"] = self.old_value
  230. output = self.app.post(
  231. "/test/diff/remote", data=data, follow_redirects=True
  232. )
  233. self.assertEqual(output.status_code, 200)
  234. output_text = output.get_data(as_text=True)
  235. self.assertIn(
  236. '<span class="text-success font-weight-bold">#1',
  237. output_text,
  238. )
  239. self.assertIn('<div class="card mb-3" id="_1">\n', output_text)
  240. self.assertIn('<div class="card mb-3" id="_2">\n', output_text)
  241. self.assertNotIn(
  242. '<div class="card mb-3" id="_3">\n', output_text
  243. )
  244. # Show the filename in the Changes summary
  245. self.assertIn(
  246. '<a href="#_1" class="list-group-item', output_text
  247. )
  248. self.assertIn(
  249. '<div class="ellipsis pr-changes-description">'
  250. "\n <small>.gitignore</small>",
  251. output_text,
  252. )
  253. self.assertIn(
  254. '<a href="#_2" class="list-group-item', output_text
  255. )
  256. self.assertIn(
  257. '<div class="ellipsis pr-changes-description">'
  258. "\n <small>sources</small>",
  259. output_text,
  260. )
  261. # Remote PR Created
  262. self.session = pagure.lib.query.create_session(self.dbpath)
  263. project = pagure.lib.query.get_authorized_project(self.session, "test")
  264. self.assertEqual(len(project.requests), 1)
  265. @patch("pagure.lib.notify.send_email", MagicMock(return_value=True))
  266. def test_new_remote_no_title(self):
  267. """Test creating a new remote PR authenticated when no title is
  268. specified."""
  269. tests.create_projects(self.session)
  270. tests.create_projects_git(
  271. os.path.join(self.path, "requests"), bare=True
  272. )
  273. self.set_up_git_repo()
  274. # Before
  275. self.session = pagure.lib.query.create_session(self.dbpath)
  276. project = pagure.lib.query.get_authorized_project(self.session, "test")
  277. self.assertEqual(len(project.requests), 0)
  278. # Try creating a remote PR
  279. user = tests.FakeUser(username="foo")
  280. with tests.user_set(self.app.application, user):
  281. output = self.app.get("/test/diff/remote")
  282. self.assertEqual(output.status_code, 200)
  283. self.assertIn(
  284. "<h2>New remote pull-request</h2>",
  285. output.get_data(as_text=True),
  286. )
  287. csrf_token = self.get_csrf(output=output)
  288. with patch(
  289. "pagure.forms.RemoteRequestPullForm.git_repo.args",
  290. MagicMock(
  291. return_value=(
  292. "Git Repo address",
  293. [wtforms.validators.DataRequired()],
  294. )
  295. ),
  296. ):
  297. data = {
  298. "csrf_token": csrf_token,
  299. "branch_from": "master",
  300. "branch_to": "feature",
  301. "git_repo": os.path.join(self.newpath, "test"),
  302. }
  303. output = self.app.post("/test/diff/remote", data=data)
  304. self.assertEqual(output.status_code, 200)
  305. output_text = output.get_data(as_text=True)
  306. self.assertIn("<h2>New remote pull-request</h2>", output_text)
  307. self.assertIn("<option selected>feature</option>", output_text)
  308. @patch("pagure.lib.notify.send_email", MagicMock(return_value=True))
  309. def test_new_remote_pr_empty_target(self):
  310. """Test creating a new remote PR authenticated against an empty
  311. git repo."""
  312. tests.create_projects(self.session)
  313. tests.create_projects_git(
  314. os.path.join(self.path, "requests"), bare=True
  315. )
  316. # Create empty target git repo
  317. gitrepo = os.path.join(self.path, "repos", "test.git")
  318. pygit2.init_repository(gitrepo, bare=True)
  319. # Create git repo we'll pull from
  320. gitrepo = os.path.join(self.path, "repos", "test_origin.git")
  321. repo = pygit2.init_repository(gitrepo)
  322. # Create a file in that git repo
  323. with open(os.path.join(gitrepo, "sources"), "w") as stream:
  324. stream.write("foo\n bar")
  325. repo.index.add("sources")
  326. repo.index.write()
  327. prev_commit = []
  328. # Commits the files added
  329. tree = repo.index.write_tree()
  330. author = _make_signature("Alice Author", "alice@authors.tld")
  331. committer = _make_signature("Cecil Committer", "cecil@committers.tld")
  332. repo.create_commit(
  333. "refs/heads/feature", # the name of the reference to update
  334. author,
  335. committer,
  336. "Add sources file for testing",
  337. # binary string representing the tree object ID
  338. tree,
  339. # list of binary strings representing parents of the new commit
  340. prev_commit,
  341. )
  342. # Before
  343. self.session = pagure.lib.query.create_session(self.dbpath)
  344. project = pagure.lib.query.get_authorized_project(self.session, "test")
  345. self.assertEqual(len(project.requests), 0)
  346. # Try creating a remote PR
  347. user = tests.FakeUser(username="foo")
  348. with tests.user_set(self.app.application, user):
  349. output = self.app.get("/test/diff/remote")
  350. self.assertEqual(output.status_code, 200)
  351. self.assertIn(
  352. "<h2>New remote pull-request</h2>",
  353. output.get_data(as_text=True),
  354. )
  355. csrf_token = self.get_csrf(output=output)
  356. with patch(
  357. "pagure.forms.RemoteRequestPullForm.git_repo.args",
  358. MagicMock(
  359. return_value=(
  360. "Git Repo address",
  361. [wtforms.validators.DataRequired()],
  362. )
  363. ),
  364. ):
  365. data = {
  366. "csrf_token": csrf_token,
  367. "title": "Remote PR title",
  368. "branch_from": "feature",
  369. "branch_to": "master",
  370. "git_repo": gitrepo,
  371. }
  372. output = self.app.post("/test/diff/remote", data=data)
  373. self.assertEqual(output.status_code, 200)
  374. output_text = output.get_data(as_text=True)
  375. self.assertIn("Create Pull Request\n </div>\n", output_text)
  376. self.assertIn('<div class="card mb-3" id="_1">\n', output_text)
  377. self.assertNotIn(
  378. '<div class="card mb-3" id="_2">\n', output_text
  379. )
  380. # Not saved yet
  381. self.session = pagure.lib.query.create_session(self.dbpath)
  382. project = pagure.lib.query.get_authorized_project(
  383. self.session, "test"
  384. )
  385. self.assertEqual(len(project.requests), 0)
  386. data = {
  387. "csrf_token": csrf_token,
  388. "title": "Remote PR title",
  389. "branch_from": "feature",
  390. "branch_to": "master",
  391. "git_repo": gitrepo,
  392. "confirm": 1,
  393. }
  394. output = self.app.post(
  395. "/test/diff/remote", data=data, follow_redirects=True
  396. )
  397. self.assertEqual(output.status_code, 200)
  398. output_text = output.get_data(as_text=True)
  399. self.assertIn(
  400. "<title>PR#1: Remote PR title - test\n - Pagure</title>",
  401. output_text,
  402. )
  403. self.assertIn('<div class="card mb-3" id="_1">\n', output_text)
  404. self.assertNotIn(
  405. '<div class="card mb-3" id="_2">\n', output_text
  406. )
  407. # Show the filename in the Changes summary
  408. self.assertIn(
  409. '<a href="#_1" class="list-group-item', output_text
  410. )
  411. self.assertIn(
  412. '<div class="ellipsis pr-changes-description">'
  413. "\n <small>sources</small>",
  414. output_text,
  415. )
  416. # Remote PR Created
  417. self.session = pagure.lib.query.create_session(self.dbpath)
  418. project = pagure.lib.query.get_authorized_project(self.session, "test")
  419. self.assertEqual(len(project.requests), 1)
  420. # Check the merge state of the PR
  421. data = {"csrf_token": csrf_token, "requestid": project.requests[0].uid}
  422. output = self.app.post("/pv/pull-request/merge", data=data)
  423. self.assertEqual(output.status_code, 200)
  424. output_text = output.get_data(as_text=True)
  425. data = json.loads(output_text)
  426. self.assertEqual(
  427. data,
  428. {
  429. "code": "FFORWARD",
  430. "message": "The pull-request can be merged and fast-forwarded",
  431. "short_code": "Ok",
  432. },
  433. )
  434. user = tests.FakeUser(username="pingou")
  435. with tests.user_set(self.app.application, user):
  436. # Merge the PR
  437. data = {"csrf_token": csrf_token}
  438. output = self.app.post(
  439. "/test/pull-request/1/merge", data=data, follow_redirects=True
  440. )
  441. output_text = output.get_data(as_text=True)
  442. self.assertEqual(output.status_code, 200)
  443. self.assertIn(
  444. "<title>PR#1: Remote PR title - test\n - Pagure</title>",
  445. output_text,
  446. )
  447. @patch("pagure.lib.notify.send_email", MagicMock(return_value=True))
  448. @patch("pagure.lib.tasks_services.trigger_ci_build")
  449. def test_new_remote_pr_ci_off(self, trigger_ci):
  450. """Test creating a new remote PR when CI is not configured."""
  451. tests.create_projects(self.session)
  452. tests.create_projects_git(
  453. os.path.join(self.path, "requests"), bare=True
  454. )
  455. self.set_up_git_repo()
  456. # Before
  457. self.session = pagure.lib.query.create_session(self.dbpath)
  458. project = pagure.lib.query.get_authorized_project(self.session, "test")
  459. self.assertEqual(len(project.requests), 0)
  460. # Create a remote PR
  461. user = tests.FakeUser(username="foo")
  462. with tests.user_set(self.app.application, user):
  463. csrf_token = self.get_csrf()
  464. data = {
  465. "csrf_token": csrf_token,
  466. "title": "Remote PR title",
  467. "branch_from": "feature",
  468. "branch_to": "master",
  469. "git_repo": os.path.join(self.newpath, "test"),
  470. }
  471. with patch(
  472. "pagure.forms.RemoteRequestPullForm.git_repo.args",
  473. MagicMock(
  474. return_value=(
  475. "Git Repo address",
  476. [wtforms.validators.DataRequired()],
  477. )
  478. ),
  479. ):
  480. output = self.app.post(
  481. "/test/diff/remote", data=data, follow_redirects=True
  482. )
  483. self.assertEqual(output.status_code, 200)
  484. data["confirm"] = 1
  485. output = self.app.post(
  486. "/test/diff/remote", data=data, follow_redirects=True
  487. )
  488. self.assertEqual(output.status_code, 200)
  489. output_text = output.get_data(as_text=True)
  490. self.assertIn(
  491. '<span class="text-success font-weight-bold">#1',
  492. output_text,
  493. )
  494. self.assertIn('<div class="card mb-3" id="_1">\n', output_text)
  495. self.assertIn('<div class="card mb-3" id="_2">\n', output_text)
  496. self.assertNotIn(
  497. '<div class="card mb-3" id="_3">\n', output_text
  498. )
  499. # Remote PR Created
  500. self.session = pagure.lib.query.create_session(self.dbpath)
  501. project = pagure.lib.query.get_authorized_project(self.session, "test")
  502. self.assertEqual(len(project.requests), 1)
  503. trigger_ci.assert_not_called()
  504. @patch("pagure.lib.notify.send_email", MagicMock(return_value=True))
  505. @patch("pagure.lib.tasks_services.trigger_ci_build")
  506. def test_new_remote_pr_ci_on(self, trigger_ci):
  507. """Test creating a new remote PR when CI is configured."""
  508. tests.create_projects(self.session)
  509. tests.create_projects_git(
  510. os.path.join(self.path, "requests"), bare=True
  511. )
  512. self.set_up_git_repo()
  513. # Before
  514. self.session = pagure.lib.query.create_session(self.dbpath)
  515. project = pagure.lib.query.get_authorized_project(self.session, "test")
  516. self.assertEqual(len(project.requests), 0)
  517. # Create a remote PR
  518. user = tests.FakeUser(username="pingou")
  519. with tests.user_set(self.app.application, user):
  520. csrf_token = self.get_csrf()
  521. # Activate CI hook
  522. data = {
  523. "active_pr": "y",
  524. "ci_url": "https://jenkins.fedoraproject.org",
  525. "ci_job": "test/job",
  526. "ci_type": "jenkins",
  527. "csrf_token": csrf_token,
  528. }
  529. output = self.app.post(
  530. "/test/settings/Pagure CI", data=data, follow_redirects=True
  531. )
  532. self.assertEqual(output.status_code, 200)
  533. user = tests.FakeUser(username="foo")
  534. with tests.user_set(self.app.application, user):
  535. data = {
  536. "csrf_token": csrf_token,
  537. "title": "Remote PR title",
  538. "branch_from": "feature",
  539. "branch_to": "master",
  540. "git_repo": os.path.join(self.newpath, "test"),
  541. }
  542. # Disables checking the URL pattern for git_repo
  543. with patch(
  544. "pagure.forms.RemoteRequestPullForm.git_repo.args",
  545. MagicMock(
  546. return_value=(
  547. "Git Repo address",
  548. [wtforms.validators.DataRequired()],
  549. )
  550. ),
  551. ):
  552. # Do the preview, triggers the cache & all
  553. output = self.app.post(
  554. "/test/diff/remote", data=data, follow_redirects=True
  555. )
  556. self.assertEqual(output.status_code, 200)
  557. # Confirm the PR creation
  558. data["confirm"] = 1
  559. output = self.app.post(
  560. "/test/diff/remote", data=data, follow_redirects=True
  561. )
  562. self.assertEqual(output.status_code, 200)
  563. output_text = output.get_data(as_text=True)
  564. self.assertIn(
  565. '<span class="text-success font-weight-bold">#1',
  566. output_text,
  567. )
  568. self.assertIn('<div class="card mb-3" id="_1">\n', output_text)
  569. self.assertIn('<div class="card mb-3" id="_2">\n', output_text)
  570. self.assertNotIn(
  571. '<div class="card mb-3" id="_3">\n', output_text
  572. )
  573. # Remote PR Created
  574. self.session = pagure.lib.query.create_session(self.dbpath)
  575. project = pagure.lib.query.get_authorized_project(self.session, "test")
  576. self.assertEqual(len(project.requests), 1)
  577. trigger_ci.assert_not_called()
  578. if __name__ == "__main__":
  579. unittest.main(verbosity=2)