def test_empty_vars(self): with pytest.raises(Exception): self.patient = LightSwitch(('primary', { 'username': None, 'password': None, 'machineName': 'test' }))
def setUp(self): self.patient = LightSwitch(('primary', { 'machineName': 'machine.name', 'username': '******', 'password': '******', 'protocol': 'protocol', 'port': 6080 }))
def main(): light_switch = LightSwitch() print('ensuring that services are on to begin with...') light_switch.ensure('on', SERVICES) def benchmark(): start = clock() print('stopping services...') light_switch.ensure('off', SERVICES) print('restarting services...') light_switch.ensure('on', SERVICES) return clock() - start sum_times = 0 for i in range(1, NUM_REPEATS + 1): print('repetition #:{}'.format(i)) sum_times = sum_times + benchmark() print('average time: {} seconds'.format(sum_times / NUM_REPEATS)) print('total time: {} seconds'.format(sum_times))
def setUp(self): self.patient = LightSwitch() self.patient.username = '******' self.patient.password = '******' self.patient.server = 'host'
def test_missing_vars(self): with pytest.raises(KeyError): self.patient = LightSwitch(('primary', {'a': 1}))