Exemple #1
0
 def test_empty_vars(self):
     with pytest.raises(Exception):
         self.patient = LightSwitch(('primary', {
             'username': None,
             'password': None,
             'machineName': 'test'
         }))
Exemple #2
0
 def setUp(self):
     self.patient = LightSwitch(('primary', {
         'machineName': 'machine.name',
         'username': '******',
         'password': '******',
         'protocol': 'protocol',
         'port': 6080
     }))
Exemple #3
0
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))
Exemple #4
0
 def setUp(self):
     self.patient = LightSwitch()
     self.patient.username = '******'
     self.patient.password = '******'
     self.patient.server = 'host'
Exemple #5
0
 def test_missing_vars(self):
     with pytest.raises(KeyError):
         self.patient = LightSwitch(('primary', {'a': 1}))