Adrià Vilanova Martínez | f19ea43 | 2024-01-23 20:20:52 +0100 | [diff] [blame^] | 1 | # 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. |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 4 | |
| 5 | """Tests for user_pb2 functions.""" |
| 6 | |
| 7 | from __future__ import print_function |
| 8 | from __future__ import division |
| 9 | from __future__ import absolute_import |
| 10 | |
| 11 | import unittest |
| 12 | |
Adrià Vilanova Martínez | f19ea43 | 2024-01-23 20:20:52 +0100 | [diff] [blame^] | 13 | from mrproto import user_pb2 |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 14 | |
| 15 | |
| 16 | class 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) |