Skip to content

Commit b93b51b

Browse files
committed
updated options
1 parent c37d3f2 commit b93b51b

3 files changed

Lines changed: 17 additions & 13 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pip install browserstack-local
3434
* `localIdentifier`: If doing simultaneous multiple local testing connections, set this uniquely for different processes
3535
* `hosts`: List of hosts and ports where Local must be enabled for eg. localhost,3000,1,localhost,3001,0
3636
* `logfile`: Path to file where Local logs be saved to
37-
* `binaryPath`: Optional path to Local binary
37+
* `binarypath`: Optional path to Local binary
3838

3939

4040
## Tests

browserstack/local.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44

55
class Local:
66
def __init__(self, key=None, binary_path=None):
7-
if binary_path is None:
8-
self.binary_path = LocalBinary().get_binary()
9-
else:
10-
self.binary_path = binary_path
117
self.options = {
128
'key': key,
139
'logfile_flag': '-logFile',
@@ -29,6 +25,12 @@ def _generate_cmd(self):
2925
def start(self, **kwargs):
3026
for key, value in kwargs.iteritems():
3127
self.__add_arg(key, value)
28+
29+
if self.options['binary_path'] is None:
30+
self.binary_path = LocalBinary().get_binary()
31+
else:
32+
self.binary_path = binary_path
33+
3234
if "onlyCommand" in kwargs and kwargs["onlyCommand"]:
3335
return
3436

@@ -65,25 +67,27 @@ def __add_arg(self, key, value):
6567
self.options['only_automate'] = '-onlyAutomate'
6668
elif key == 'forcelocal' and value:
6769
self.options['forcelocal'] = '-forcelocal'
68-
elif key == 'local_identifier':
70+
elif key == 'localIdentifier':
6971
self.options['local_identifier'] = '-localIdentifier ' + str(value)
7072
elif key == 'f':
7173
self.options['folder_flag'] = '-f'
7274
self.options['folder_path'] = str(value)
73-
elif key == 'proxy_host':
75+
elif key == 'proxyHost':
7476
self.options['proxy_host'] = '-proxyHost ' + str(value)
75-
elif key == 'proxy_port':
77+
elif key == 'proxyPort':
7678
self.options['proxy_port'] = '-proxyPort ' + str(value)
77-
elif key == 'proxy_user':
79+
elif key == 'proxyUser':
7880
self.options['proxy_user'] = '-proxyUser ' + str(value)
79-
elif key == 'proxy_pass':
81+
elif key == 'proxyPass':
8082
self.options['proxy_pass'] = '-proxyPass ' + str(value)
8183
elif key == 'hosts':
8284
self.options['hosts'] = str(value)
8385
elif key == 'logfile':
8486
self.options['logfile_flag'] = '-logFile'
8587
self.options['logfile'] = str(value)
8688
self.local_logfile_path = str(value)
89+
elif key == 'binarypath':
90+
self.options['binarypath'] = str(value)
8791
elif key != 'onlyCommand':
8892
raise BrowserStackLocalError('Attempted to pass invalid option to binary')
8993

tests/test_local.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,22 @@ def test_force_kill(self):
2626
self.assertIn('-force', self.local._generate_cmd())
2727

2828
def test_only_automate(self):
29-
self.local.start(only_automate=True, onlyCommand=True)
29+
self.local.start(onlyAutomate=True, onlyCommand=True)
3030
self.assertIn('-onlyAutomate', self.local._generate_cmd())
3131

3232
def test_force_local(self):
3333
self.local.start(forcelocal=True, onlyCommand=True)
3434
self.assertIn('-forcelocal', self.local._generate_cmd())
3535

3636
def test_proxy(self):
37-
self.local.start(proxy_host='localhost', proxy_port=2000, proxy_user='hello', proxy_pass='test123', onlyCommand=True)
37+
self.local.start(proxyHost='localhost', proxyPort=2000, proxyUser='hello', proxyPass='test123', onlyCommand=True)
3838
self.assertIn('-proxyHost localhost', self.local._generate_cmd())
3939
self.assertIn('-proxyPort 2000', self.local._generate_cmd())
4040
self.assertIn('-proxyUser hello', self.local._generate_cmd())
4141
self.assertIn('-proxyPass test123', self.local._generate_cmd())
4242

4343
def test_local_identifier(self):
44-
self.local.start(local_identifier='mytunnel', onlyCommand=True)
44+
self.local.start(localIdentifier='mytunnel', onlyCommand=True)
4545
self.assertIn('-localIdentifier mytunnel', self.local._generate_cmd())
4646

4747
def test_invalid_option(self):

0 commit comments

Comments
 (0)