Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 1 | # 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 user_pb2 functions.""" |
| 7 | |
| 8 | from __future__ import print_function |
| 9 | from __future__ import division |
| 10 | from __future__ import absolute_import |
| 11 | |
| 12 | import unittest |
| 13 | |
| 14 | from proto import user_pb2 |
| 15 | |
| 16 | |
| 17 | class UserPb2Test(unittest.TestCase): |
| 18 | |
| 19 | def testUser_Defaults(self): |
| 20 | user = user_pb2.MakeUser(111) |
| 21 | self.assertEqual(111, user.user_id) |
| 22 | self.assertFalse(user.obscure_email) |
| 23 | self.assertIsNone(user.email) |
| 24 | |
| 25 | def testUser_Everything(self): |
| 26 | user = user_pb2.MakeUser(111, email='user@example.com', obscure_email=True) |
| 27 | self.assertEqual(111, user.user_id) |
| 28 | self.assertTrue(user.obscure_email) |
| 29 | self.assertEqual('user@example.com', user.email) |