Merge remote-tracking branch 'upstream/master' into appium_host_for_scale_support

This commit is contained in:
Andrejs Cunskis 2017-05-24 16:51:59 +03:00
commit 768d793ba0
3 changed files with 11 additions and 10 deletions

View file

@ -3,6 +3,7 @@ Docker-Android
[![Build Status](https://travis-ci.org/butomo1989/docker-android.svg?branch=master)](https://travis-ci.org/butomo1989/docker-android)
[![codecov](https://codecov.io/gh/butomo1989/docker-android/branch/master/graph/badge.svg)](https://codecov.io/gh/butomo1989/docker-android)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/3f000ffb97db45a59161814e1434c429)](https://www.codacy.com/app/butomo1989/docker-appium?utm_source=github.com&utm_medium=referral&utm_content=butomo1989/docker-appium&utm_campaign=Badge_Grade)
Docker-Android is a docker image built to be used for everything related to mobile website testing and Android project.

View file

@ -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.
@ -102,7 +102,7 @@ def appium_run(avd_name: str):
cmd = 'appium'
local_ip = os.popen('ifconfig eth0 | grep \'inet addr:\' | cut -d: -f2 | awk \'{ print $1}\'').read().strip()
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:
@ -175,7 +175,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)

View file

@ -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')