Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1171)

Unified Diff: appengine/monorail/sitewide/test/group_helpers_test.py

Issue 1868553004: Open Source Monorail (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « appengine/monorail/sitewide/test/__init__.py ('k') | appengine/monorail/sitewide/test/groupadmin_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/monorail/sitewide/test/group_helpers_test.py
diff --git a/appengine/monorail/sitewide/test/group_helpers_test.py b/appengine/monorail/sitewide/test/group_helpers_test.py
new file mode 100644
index 0000000000000000000000000000000000000000..5709b08dbd0b0a41a9d7d6992e5b94393b678ce5
--- /dev/null
+++ b/appengine/monorail/sitewide/test/group_helpers_test.py
@@ -0,0 +1,48 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is govered by a BSD-style
+# license that can be found in the LICENSE file or at
+# https://developers.google.com/open-source/licenses/bsd
+
+"""Unit test for User Group helpers."""
+
+import unittest
+
+from proto import usergroup_pb2
+from sitewide import group_helpers
+
+
+class GroupHelpersTest(unittest.TestCase):
+
+ def testGroupVisibilityView(self):
+ gvv_anyone = group_helpers.GroupVisibilityView(
+ usergroup_pb2.MemberVisibility.ANYONE)
+ gvv_members = group_helpers.GroupVisibilityView(
+ usergroup_pb2.MemberVisibility.MEMBERS)
+ gvv_owners = group_helpers.GroupVisibilityView(
+ usergroup_pb2.MemberVisibility.OWNERS)
+ self.assertEqual('Anyone on the Internet', gvv_anyone.name)
+ self.assertEqual('Group Members', gvv_members.name)
+ self.assertEqual('Group Owners', gvv_owners.name)
+
+ def testGroupMemberView(self):
+ gmv = group_helpers.GroupMemberView(
+ 1L, 'test@example.com', 't...@example.com', 888L, 'member')
+ self.assertEqual(888L, gmv.group_id)
+ self.assertEqual('member', gmv.role)
+
+ def testBuildUserGroupVisibilityOptions(self):
+ vis_views = group_helpers.BuildUserGroupVisibilityOptions()
+ self.assertEqual(3, len(vis_views))
+
+ def testGroupTypeView(self):
+ gt_cia = group_helpers.GroupTypeView(
+ usergroup_pb2.GroupType.CHROME_INFRA_AUTH)
+ gt_mdb = group_helpers.GroupTypeView(
+ usergroup_pb2.GroupType.MDB)
+ self.assertEqual('Chrome-infra-auth', gt_cia.name)
+ self.assertEqual('MDB', gt_mdb.name)
+
+ def testBuildUserGroupTypeOptions(self):
+ group_types = group_helpers.BuildUserGroupTypeOptions()
+ self.assertEqual(3, len(group_types))
+
« no previous file with comments | « appengine/monorail/sitewide/test/__init__.py ('k') | appengine/monorail/sitewide/test/groupadmin_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698