diff --git a/src/app.py b/src/app.py index 59fcb0d..f5b8fbc 100644 --- a/src/app.py +++ b/src/app.py @@ -26,7 +26,7 @@ def get_or_raise(env: str) -> str: return env_value -def str_to_bool(str: str) -> bool: +def convert_str_to_bool(str: str) -> bool: """ Convert string to boolean. @@ -101,7 +101,7 @@ def appium_run(avd_name: str): """ cmd = 'appium' - grid_connect = str_to_bool(str(os.getenv('CONNECT_TO_GRID', False))) + grid_connect = convert_str_to_bool(str(os.getenv('CONNECT_TO_GRID', False))) logger.info('Connect to selenium grid? {connect}'.format(connect=grid_connect)) if grid_connect: try: @@ -170,7 +170,7 @@ def run(): cmd = 'emulator -avd {name}'.format(name=avd_name) subprocess.Popen(cmd.split()) - appium = str_to_bool(str(os.getenv('APPIUM', False))) + appium = convert_str_to_bool(str(os.getenv('APPIUM', False))) if appium: logger.info('Run appium server...') appium_run(avd_name) diff --git a/src/tests/__init__.py b/src/tests/__init__.py index 65cd5a4..93c555e 100644 --- a/src/tests/__init__.py +++ b/src/tests/__init__.py @@ -21,17 +21,17 @@ class TestApp(TestCase): app.get_or_raise('ENV_2') def test_valid_bool(self): - self.assertEqual(app.str_to_bool('True'), True) - self.assertEqual(app.str_to_bool('t'), True) - self.assertEqual(app.str_to_bool('1'), True) - self.assertEqual(app.str_to_bool('YES'), True) + self.assertEqual(app.convert_str_to_bool('True'), True) + self.assertEqual(app.convert_str_to_bool('t'), True) + self.assertEqual(app.convert_str_to_bool('1'), True) + self.assertEqual(app.convert_str_to_bool('YES'), True) def test_invalid_bool(self): - self.assertEqual(app.str_to_bool(''), False) - self.assertEqual(app.str_to_bool('test'), False) + self.assertEqual(app.convert_str_to_bool(''), False) + self.assertEqual(app.convert_str_to_bool('test'), False) def test_invalid_format(self): - self.assertEqual(app.str_to_bool(True), None) + self.assertEqual(app.convert_str_to_bool(True), None) @mock.patch('src.app.prepare_avd') @mock.patch('subprocess.Popen')