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
diff --git a/lib/lp/code/browser/gitrepository.py b/lib/lp/code/browser/gitrepository.py
index b8d7b3e..d47e0f5 100644
--- a/lib/lp/code/browser/gitrepository.py
+++ b/lib/lp/code/browser/gitrepository.py
@@ -268,6 +268,7 @@ class GitRepositoryEditMenu(NavigationMenu):
268 "activity",268 "activity",
269 "webhooks",269 "webhooks",
270 "delete",270 "delete",
271 "access_tokens",
271 ]272 ]
272273
273 @enabled_with_permission("launchpad.Edit")274 @enabled_with_permission("launchpad.Edit")
@@ -302,6 +303,11 @@ class GitRepositoryEditMenu(NavigationMenu):
302 text = "Delete repository"303 text = "Delete repository"
303 return Link("+delete", text, icon="trash-icon")304 return Link("+delete", text, icon="trash-icon")
304305
306 @enabled_with_permission("launchpad.Edit")
307 def access_tokens(self):
308 text = "Edit access tokens"
309 return Link("+access-tokens", text, icon="edit")
310
305311
306class GitRepositoryContextMenu(ContextMenu, HasRecipesMenuMixin):312class GitRepositoryContextMenu(ContextMenu, HasRecipesMenuMixin):
307 """Context menu for `IGitRepository`."""313 """Context menu for `IGitRepository`."""
diff --git a/lib/lp/services/auth/tests/test_browser.py b/lib/lp/services/auth/tests/test_browser.py
index 6ec0b70..70e3234 100644
--- a/lib/lp/services/auth/tests/test_browser.py
+++ b/lib/lp/services/auth/tests/test_browser.py
@@ -68,6 +68,14 @@ class TestAccessTokenViewBase:
68 view.initialize()68 view.initialize()
69 return view69 return view
7070
71 def test_access_tokens_link(self):
72 target_url = canonical_url(self.target, rootsite="code")
73 expected_tokens_url = canonical_url(
74 self.target, view_name="+access-tokens", rootsite="code")
75 browser = self.getUserBrowser(target_url, user=self.owner)
76 tokens_link = browser.getLink("Edit access tokens")
77 self.assertEqual(expected_tokens_url, tokens_link.url)
78
71 def makeTokensAndMatchers(self, count):79 def makeTokensAndMatchers(self, count):
72 tokens = [80 tokens = [
73 self.factory.makeAccessToken(target=self.target)[1]81 self.factory.makeAccessToken(target=self.target)[1]

Subscribers

People subscribed via source and target branches

to status/vote changes: