1#!/usr/bin/env vpython3 2# Copyright 2023 The Chromium Authors 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5"""File for testing ffx_emulator.py.""" 6 7import argparse 8import unittest 9 10from ffx_emulator import FfxEmulator 11 12 13class FfxEmulatorTest(unittest.TestCase): 14 """Unittests for ffx_emulator.py""" 15 def test_use_fixed_node_name(self) -> None: 16 """FfxEmulator should use a fixed node name.""" 17 # Allowing the test case to access FfxEmulator._node_name directly. 18 # pylint: disable=protected-access 19 self.assertEqual( 20 FfxEmulator( 21 argparse.Namespace( 22 **{ 23 'product': None, 24 'enable_graphics': False, 25 'hardware_gpu': False, 26 'logs_dir': '.', 27 'with_network': False, 28 'everlasting': True 29 }))._node_name, 'fuchsia-everlasting-emulator') 30 31 def test_use_random_node_name(self) -> None: 32 """FfxEmulator should not use a fixed node name.""" 33 # Allowing the test case to access FfxEmulator._node_name directly. 34 # pylint: disable=protected-access 35 self.assertNotEqual( 36 FfxEmulator( 37 argparse.Namespace( 38 **{ 39 'product': None, 40 'enable_graphics': False, 41 'hardware_gpu': False, 42 'logs_dir': '.', 43 'with_network': False, 44 'everlasting': False 45 }))._node_name, 'fuchsia-everlasting-emulator') 46 47 48if __name__ == '__main__': 49 unittest.main() 50