commit | ad9da22e9740a5525777e1dc82198ec0dfdc350d | [log] [tgz] |
---|---|---|
author | Ben Chan <benchan@chromium.org> | Wed May 08 14:41:20 2013 -0700 |
committer | ChromeBot <chrome-bot@google.com> | Thu May 09 14:31:23 2013 -0700 |
tree | adf2c14567fabbc25b98dd5e9f17f5918dbaa029 | |
parent | 7efde5b3b20f36716b10bdd9691823443704caf1 [diff] |
shill-test: Add shill_context.ServiceAutoConnectContext helper. Add a context manager 'shill_context.ServiceAutoConnectContext' for temporarily overriding the 'AutoConnect' property of a service object. BUG=chromium:238855 TEST=Tested the following: 1. Run pylint on shill_context.py. 2. Test the following code in a Python shell on daisy with a cellular service: from shill_context import ServiceAutoConnectContext from shill_proxy import ShillProxy shill = ShillProxy() get_service = lambda: shill.find_object('Service', {'Type': 'cellular'}) with ServiceAutoConnectContext(get_service, autoconnect=False) as c: print('initial autoconnect: %s' % c.initial_autoconnect) print('autoconnect: %s' % c.autoconnect) with ServiceAutoConnectContext(get_service, autoconnect=True) as c: print('initial autoconnect: %s' % c.initial_autoconnect) print('autoconnect: %s' % c.autoconnect) Change-Id: I3e7d2cfb2d6ce81e5363e3e91e3886a44a9e8190 Reviewed-on: https://gerrit.chromium.org/gerrit/50497 Reviewed-by: Thieu Le <thieule@chromium.org> Reviewed-by: Christopher Wiley <wiley@chromium.org> Commit-Queue: Ben Chan <benchan@chromium.org> Tested-by: Ben Chan <benchan@chromium.org>