def test_complete_auto_tests(self): """ Test a regular autotest """ # call with channel/flash/no_gps and blinking leds extra = query_string('channel=22&flash=1&gps=') ret = self.server.put('/autotest/blink', extra_environ=extra) ret_dict = ret.json print >> sys.stderr, ret_dict self.assertEqual([], ret_dict['error']) self.assertIn('on_serial_echo', ret_dict['success']) self.assertTrue('GWT' in ret_dict['mac']) self.assertEqual(0, ret_dict['ret']) # test that ON still on if self.board_cfg.board_type == 'a8': # Don't know ip address, just check TTY self.assertTrue(os.path.exists(self.board_cfg.board_class.TTY)) else: self.g_m.open_node.serial_redirection.start() ret = OpenNodeConnection.send_one_command(['get_time']) self.g_m.open_node.serial_redirection.stop() self.assertIsNotNone(ret) if self.board_cfg.linux_on_class is not None: autotest = self.board_cfg.linux_on_class.AUTOTEST_AVAILABLE not_tested = (set(autotest) - set(AutoTestManager.TESTED_FEATURES)) else: not_tested = (set(self.g_m.open_node.AUTOTEST_AVAILABLE) - set(AutoTestManager.TESTED_FEATURES)) self.assertEqual(not_tested, set())
def test_complete_auto_tests(self): """ Test a regular autotest """ # call with channel/flash/no_gps and blinking leds extra = query_string('channel=22&flash=1&gps=') ret = self.server.put('/autotest/blink', extra_environ=extra) ret_dict = ret.json print >> sys.stderr, ret_dict self.assertEquals([], ret_dict['error']) self.assertIn('on_serial_echo', ret_dict['success']) self.assertTrue('GWT' in ret_dict['mac']) self.assertEquals(0, ret_dict['ret']) # test that ON still on if self.board_cfg.board_type == 'a8': # Don't know ip address, just check TTY self.assertTrue(os.path.exists(self.board_cfg.board_class.TTY)) else: self.g_m.open_node.serial_redirection.start() ret = OpenNodeConnection.send_one_command(['get_time']) self.g_m.open_node.serial_redirection.stop() self.assertIsNotNone(ret) not_tested = (set(self.g_m.open_node.AUTOTEST_AVAILABLE) - set(AutoTestManager.TESTED_FEATURES)) self.assertEquals(not_tested, set())
def test_experiment_with_timeout(self): """ Start an experiment with a timeout. """ extra = query_string('timeout=5') ret = self.server.post(EXP_START, extra_environ=extra) self.assertEqual(0, ret.json['ret']) # Wait max 10 seconds for experiment to have been stopped self.assertTrue(wait_cond(10, False, self._safe_exp_is_running)) self.assertTrue(self.timeout_mock.called)
def test_experiment_with_timeout(self): """ Start an experiment with a timeout. """ extra = query_string('timeout=5') ret = self.server.post(EXP_START, extra_environ=extra) self.assertEquals(0, ret.json['ret']) # Wait max 10 seconds for experiment to have been stopped self.assertTrue(wait_cond(10, False, self._safe_exp_is_running)) self.assertTrue(self.timeout_mock.called)
def test_exp_stop_removes_timeout(self): """ Test exp_stop removes timeout stop """ extra = query_string('timeout=5') ret = self.server.post(EXP_START, extra_environ=extra) self.assertEqual(0, ret.json['ret']) # Stop to remove timeout self.assertEqual(0, self.server.delete('/exp/stop').json['ret']) time.sleep(10) # Ensure that timeout could have occured # Timeout never called self.assertFalse(self.timeout_mock.called)
def test_exp_stop_removes_timeout(self): """ Test exp_stop removes timeout stop """ extra = query_string('timeout=5') ret = self.server.post(EXP_START, extra_environ=extra) self.assertEquals(0, ret.json['ret']) # Stop to remove timeout self.assertEquals(0, self.server.delete('/exp/stop').json['ret']) time.sleep(10) # Ensure that timeout could have occured # Timeout never called self.assertFalse(self.timeout_mock.called)