blob: 83d6f16af0b1867dc76f3d2259e1e60c29f6ce59 [file] [log] [blame]
Michael Tang84a2ecf2016-06-07 15:10:53 -07001#!/usr/bin/python
2#
3# Copyright (c) 2016 The Chromium OS Authors. All rights reserved.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7"""Unit tests for frontend/afe/rpc_utils.py."""
8
9
10import unittest
11
12import common
13from autotest_lib.client.common_lib import control_data
14from autotest_lib.frontend import setup_django_environment
15from autotest_lib.frontend.afe import frontend_test_utils
16from autotest_lib.frontend.afe import rpc_utils
17
18
19class RpcUtilsTest(unittest.TestCase,
20 frontend_test_utils.FrontendTestMixin):
21 """Unit tests for functions in rpc_utils.py."""
22 def setUp(self):
23 self._frontend_common_setup()
24
25
26 def tearDown(self):
27 self._frontend_common_teardown()
28
29
30 def testCheckIsServer(self):
31 """Ensure that test type check is correct."""
32 self.assertFalse(rpc_utils._check_is_server_test(None))
33 self.assertFalse(rpc_utils._check_is_server_test(
34 control_data.CONTROL_TYPE.CLIENT))
35 self.assertFalse(rpc_utils._check_is_server_test('Client'))
36 self.assertTrue(rpc_utils._check_is_server_test(
37 control_data.CONTROL_TYPE.SERVER))
38 self.assertTrue(rpc_utils._check_is_server_test('Server'))
39 self.assertFalse(rpc_utils._check_is_server_test('InvalidType'))
40
41
42if __name__ == '__main__':
43 unittest.main()