Skip to content

fix: handle false value in boolean arguments #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions browserstack/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ def __xstr(self, key, value):
return ['']
if str(value).lower() == "true":
return ['-' + key]
elif str(value).lower() == "false":
return ['']
else:
return ['-' + key, value]

Expand Down
5 changes: 5 additions & 0 deletions tests/test_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ def test_custom_boolean_argument(self):
self.assertIn('-boolArg1', self.local._generate_cmd())
self.assertIn('-boolArg2', self.local._generate_cmd())

def test_custom_boolean_argument_false(self):
self.local.start(boolArg1=False, boolArg2=False, onlyCommand=True)
self.assertNotIn('-boolArg1', self.local._generate_cmd())
self.assertNotIn('-boolArg2', self.local._generate_cmd())

def test_custom_keyval(self):
self.local.start(customKey1="custom value1", customKey2="custom value2", onlyCommand=True)
self.assertIn('-customKey1', self.local._generate_cmd())
Expand Down