Skip to content

Commit 518b8ae

Browse files
committed
Merge pull request #4 from browserstack/force_proxy
Force proxy
2 parents 5721cb3 + e14ba90 commit 518b8ae

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

browserstack/local.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def __xstr(self, obj):
1818
return str(obj)
1919

2020
def _generate_cmd(self):
21-
options_order = ['logfile_flag', 'logfile_path', 'folder_flag', 'key', 'folder_path', 'forcelocal', 'local_identifier', 'only', 'only_automate', 'proxy_host', 'proxy_port', 'proxy_user', 'proxy_pass', 'force', 'verbose', 'hosts']
21+
options_order = ['logfile_flag', 'logfile_path', 'folder_flag', 'key', 'folder_path', 'forcelocal', 'local_identifier', 'only', 'only_automate', 'proxy_host', 'proxy_port', 'proxy_user', 'proxy_pass', 'forceproxy', 'force', 'verbose', 'hosts']
2222
cmd = [self.__xstr(self.options.get(o)) for o in options_order if self.options.get(o) is not None]
2323
return [self.binary_path] + cmd
2424

@@ -82,6 +82,8 @@ def __add_arg(self, key, value):
8282
self.options['proxy_pass'] = '-proxyPass ' + str(value)
8383
elif key == 'hosts':
8484
self.options['hosts'] = str(value)
85+
elif key == 'forceproxy' and value:
86+
self.options['forceproxy'] = '-forceproxy'
8587
elif key == 'logfile':
8688
self.options['logfile_flag'] = '-logFile'
8789
self.options['logfile'] = str(value)

tests/test_local.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ def test_proxy(self):
4040
self.assertIn('-proxyUser hello', self.local._generate_cmd())
4141
self.assertIn('-proxyPass test123', self.local._generate_cmd())
4242

43+
def test_force_proxy(self):
44+
self.local.start(forceproxy=True, onlyCommand=True)
45+
self.assertIn('-forceproxy', self.local._generate_cmd())
46+
4347
def test_local_identifier(self):
4448
self.local.start(localIdentifier='mytunnel', onlyCommand=True)
4549
self.assertIn('-localIdentifier mytunnel', self.local._generate_cmd())

0 commit comments

Comments
 (0)