blob: 26f71660223e7de81bf1f35194cb610b0efcf34f [file] [log] [blame]
Adrià Vilanova Martínezf19ea432024-01-23 20:20:52 +01001# Copyright 2016 The Chromium Authors
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
Copybara854996b2021-09-07 19:36:02 +00004
5"""Tests for usergroup_pb2 functions."""
6
7from __future__ import print_function
8from __future__ import division
9from __future__ import absolute_import
10
11import unittest
12
Adrià Vilanova Martínezf19ea432024-01-23 20:20:52 +010013from mrproto import usergroup_pb2
Copybara854996b2021-09-07 19:36:02 +000014
15
16class UserGroupPb2Test(unittest.TestCase):
17
18 def testMakeSettings_Defaults(self):
19 usergroup = usergroup_pb2.MakeSettings('anyone')
20 self.assertEqual(
21 usergroup_pb2.MemberVisibility.ANYONE,
22 usergroup.who_can_view_members)
23 self.assertIsNone(usergroup.ext_group_type)
24 self.assertEqual(0, usergroup.last_sync_time)
25 self.assertEqual([], usergroup.friend_projects)
26
27 def testMakeSettings_Everything(self):
28 usergroup = usergroup_pb2.MakeSettings(
29 'Members', ext_group_type_str='mdb',
30 last_sync_time=1234567890, friend_projects=[789])
31 self.assertEqual(
32 usergroup_pb2.MemberVisibility.MEMBERS,
33 usergroup.who_can_view_members)
34 self.assertEqual(usergroup_pb2.GroupType.MDB, usergroup.ext_group_type)
35 self.assertEqual(1234567890, usergroup.last_sync_time)
36 self.assertEqual([789], usergroup.friend_projects)