Merge ~ilasc/launchpad:access-token-link-git-reposiory-edit-menu into launchpad:master

Proposed by Ioana Lasc
Status: Merged
Approved by: Ioana Lasc
Approved revision: 034b421aa05f62e236668b8b58b129f5e6ed933d
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~ilasc/launchpad:access-token-link-git-reposiory-edit-menu
Merge into: launchpad:master
Diff against target: 43 lines (+14/-0)
2 files modified
lib/lp/code/browser/gitrepository.py (+6/-0)
lib/lp/services/auth/tests/test_browser.py (+8/-0)
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+414399@code.launchpad.net

Commit message

Add link to access tokens on GitRepositoryEditMenu

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
review: Needs Fixing
Revision history for this message
Ioana Lasc (ilasc) wrote (last edit ):

Indeed best to keep things centralized, thanks for the suggestion Colin! All moved.

Revision history for this message
Colin Watson (cjwatson) wrote :

Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/code/browser/gitrepository.py b/lib/lp/code/browser/gitrepository.py
2index b8d7b3e..d47e0f5 100644
3--- a/lib/lp/code/browser/gitrepository.py
4+++ b/lib/lp/code/browser/gitrepository.py
5@@ -268,6 +268,7 @@ class GitRepositoryEditMenu(NavigationMenu):
6 "activity",
7 "webhooks",
8 "delete",
9+ "access_tokens",
10 ]
11
12 @enabled_with_permission("launchpad.Edit")
13@@ -302,6 +303,11 @@ class GitRepositoryEditMenu(NavigationMenu):
14 text = "Delete repository"
15 return Link("+delete", text, icon="trash-icon")
16
17+ @enabled_with_permission("launchpad.Edit")
18+ def access_tokens(self):
19+ text = "Edit access tokens"
20+ return Link("+access-tokens", text, icon="edit")
21+
22
23 class GitRepositoryContextMenu(ContextMenu, HasRecipesMenuMixin):
24 """Context menu for `IGitRepository`."""
25diff --git a/lib/lp/services/auth/tests/test_browser.py b/lib/lp/services/auth/tests/test_browser.py
26index 6ec0b70..70e3234 100644
27--- a/lib/lp/services/auth/tests/test_browser.py
28+++ b/lib/lp/services/auth/tests/test_browser.py
29@@ -68,6 +68,14 @@ class TestAccessTokenViewBase:
30 view.initialize()
31 return view
32
33+ def test_access_tokens_link(self):
34+ target_url = canonical_url(self.target, rootsite="code")
35+ expected_tokens_url = canonical_url(
36+ self.target, view_name="+access-tokens", rootsite="code")
37+ browser = self.getUserBrowser(target_url, user=self.owner)
38+ tokens_link = browser.getLink("Edit access tokens")
39+ self.assertEqual(expected_tokens_url, tokens_link.url)
40+
41 def makeTokensAndMatchers(self, count):
42 tokens = [
43 self.factory.makeAccessToken(target=self.target)[1]

Subscribers

People subscribed via source and target branches

to status/vote changes: