blob: fcfed7180b13ea17f49f0531a5180c2fb7e83f80 [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 user_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 user_pb2
Copybara854996b2021-09-07 19:36:02 +000014
15
16class UserPb2Test(unittest.TestCase):
17
18 def testUser_Defaults(self):
19 user = user_pb2.MakeUser(111)
20 self.assertEqual(111, user.user_id)
21 self.assertFalse(user.obscure_email)
22 self.assertIsNone(user.email)
23
24 def testUser_Everything(self):
25 user = user_pb2.MakeUser(111, email='user@example.com', obscure_email=True)
26 self.assertEqual(111, user.user_id)
27 self.assertTrue(user.obscure_email)
28 self.assertEqual('user@example.com', user.email)