#4766 api/issue: allow viewing issues with user tokens
Merged 4 years ago by pingou. Opened 4 years ago by jlanda.
jlanda/pagure api-issue-user-tokens  into  master

file modified
+1 -1
@@ -564,7 +564,7 @@ 

  

      repo = _get_repo(repo, username, namespace)

      _check_issue_tracker(repo)

-     _check_token(repo)

+     _check_token(repo, project_token=False)

  

      issue_id = issue_uid = None

      try:

@@ -4524,6 +4524,37 @@ 

          self.assertEqual(data["total_issues_assigned_pages"], 1)

          self.assertEqual(data["total_issues_created_pages"], 1)

  

+     def api_api_view_issue_user_token(self):

+         """ Testhe the api view issues of the flask api with valid user token """

+         tests.create_projects(self.session)

+         tests.create_projects_git(

+             os.path.join(self.path, "tickets", bare=True)

+         )

+         tests.create_tokens(self.session, project_id=None)

+         tests.create_tokens_acl(self.session)

+ 

+         headers = {"Authorization": "token aaabbbcccddd"}

+ 

+         # Create issue

+         repo = pagure.lib.query.get_authorized_project(self.session, "test")

+         msg = pagure.lib.query.new_issue(

+             session=self.session,

+             repo=repo,

+             title="Test issue #1",

+             content="We should work on this",

+             user="pingou",

+             private=False,

+             issue_uid="aaabbbccc1",

+         )

+         self.session.commit()

+         self.assertEqual(msg.title, "Test issue #1")

+         self.assertEqual(msg.related_prs, [])

+         self.assertEqual(msg.id, 1)

+ 

+         # Check issue

+         output = self.app.get("/api/0/test/issue/1")

+         self.assertEqual(output.status_code, 200)

+ 

  

  if __name__ == "__main__":

      SUITE = unittest.TestLoader().loadTestsFromTestCase(

Should we add unit-tests?

Should we add unit-tests?

Good point. I'll add one with a non committer user token

rebased onto 05047c0af3a2d67e5bf89d0de4a676886d8a6f71

4 years ago

Should we add unit-tests?

Actually I edited the wrong _check_token() call on the first attempt :D

Fixed and test added :)

rebased onto ed1aa4d0419f885bc0e0ec4c93b51403dfb9545f

4 years ago

pretty please pagure-ci rebuild

4 years ago

@jlanda You may want to rebase again, and the CI is stuck...

yeah, second time on this pr that ci stucks :(

rebased onto 44e0edbf2af36c1969be257dd1f1d697a6dab184

4 years ago

Now that is rebased and ci went ok, this is ready for review =)

rebased onto 069347c

4 years ago

pretty please pagure-ci rebuild

4 years ago

Pull-Request has been merged by pingou

4 years ago