blob: c7ab1e73f633d8597e1586579b37ac18bc43884c [file] [log] [blame]
Copybara854996b2021-09-07 19:36:02 +00001# Copyright 2016 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style
3# license that can be found in the LICENSE file or at
4# https://developers.google.com/open-source/licenses/bsd
5
6"""Tests for usergroup_pb2 functions."""
7
8from __future__ import print_function
9from __future__ import division
10from __future__ import absolute_import
11
12import unittest
13
14from proto import usergroup_pb2
15
16
17class UserGroupPb2Test(unittest.TestCase):
18
19 def testMakeSettings_Defaults(self):
20 usergroup = usergroup_pb2.MakeSettings('anyone')
21 self.assertEqual(
22 usergroup_pb2.MemberVisibility.ANYONE,
23 usergroup.who_can_view_members)
24 self.assertIsNone(usergroup.ext_group_type)
25 self.assertEqual(0, usergroup.last_sync_time)
26 self.assertEqual([], usergroup.friend_projects)
27
28 def testMakeSettings_Everything(self):
29 usergroup = usergroup_pb2.MakeSettings(
30 'Members', ext_group_type_str='mdb',
31 last_sync_time=1234567890, friend_projects=[789])
32 self.assertEqual(
33 usergroup_pb2.MemberVisibility.MEMBERS,
34 usergroup.who_can_view_members)
35 self.assertEqual(usergroup_pb2.GroupType.MDB, usergroup.ext_group_type)
36 self.assertEqual(1234567890, usergroup.last_sync_time)
37 self.assertEqual([789], usergroup.friend_projects)