def test_thermal_still_no_delay_or_repeat_calls_appropriate_methods(self, cv_get_settings_document, cv_gather_and_enforce_request_args, cv_take_thermal_still): group_id = uuid.uuid4() cv_get_settings_document.return_value = {'current_group_id': group_id} cv_gather_and_enforce_request_args.return_value = {'delay': 28, 'repeat': 37, 'scale_image': True, 'clean_up_files': False} cv_take_thermal_still.return_value = {'c': 'd'} resp_object = cv.thermal_still() response_data_dict = json.loads(resp_object.data) cv_get_settings_document.assert_called_once_with() cv_gather_and_enforce_request_args.assert_called_once_with(ANY) cv_take_thermal_still.assert_called_once_with(snap_id=ANY, group_id=group_id, delay=28, repeat=37, scale_image=True, clean_up_files=False) assert resp_object.status_code == 202 assert 'c' in response_data_dict assert len(response_data_dict.keys()) == 1
def test_thermal_still_catches_exceptions(self, cv_get_settings_document): cv_get_settings_document.side_effect = ThermalBaseError("emmenthaler") resp_object = cv.thermal_still() assert resp_object.data == '"emmenthaler"' assert resp_object.status_code == 400
def test_thermal_still_no_delay_or_repeat_calls_appropriate_methods( self, cv_get_settings_document, cv_get_delay_parameter, cv_get_repeat_parameter, cv_get_scale_image_parameter, cv_take_thermal_still): group_id = uuid.uuid4() cv_get_settings_document.return_value = {'current_group_id': group_id} cv_get_delay_parameter.return_value = 28 cv_get_repeat_parameter.return_value = 37 cv_get_scale_image_parameter.return_value = True cv_take_thermal_still.return_value = {'c': 'd'} resp_object = cv.thermal_still() response_data_dict = json.loads(resp_object.data) cv_get_settings_document.assert_called_once_with() cv_get_delay_parameter.assert_called_once_with() cv_get_repeat_parameter.assert_called_once_with() cv_get_scale_image_parameter.assert_called_once_with() cv_take_thermal_still.assert_called_once_with(snap_id=ANY, group_id=group_id, delay=28, repeat=37, scale_image=True) assert resp_object.status_code == 202 assert 'c' in response_data_dict assert len(response_data_dict.keys()) == 1
def test_thermal_still_catches_exceptions(self, cv_get_settings_document): cv_get_settings_document.side_effect = ThermalBaseError('emmenthaler') resp_object = cv.thermal_still() assert resp_object.data == '"emmenthaler"' assert resp_object.status_code == 400
def test_thermal_still_no_delay_or_repeat_calls_appropriate_methods( self, cv_get_settings_document, cv_gather_and_enforce_request_args, cv_take_thermal_still ): group_id = uuid.uuid4() cv_get_settings_document.return_value = {"current_group_id": group_id} cv_gather_and_enforce_request_args.return_value = { "delay": 28, "repeat": 37, "scale_image": True, "clean_up_files": False, } cv_take_thermal_still.return_value = {"c": "d"} resp_object = cv.thermal_still() response_data_dict = json.loads(resp_object.data) cv_get_settings_document.assert_called_once_with() cv_gather_and_enforce_request_args.assert_called_once_with(ANY) cv_take_thermal_still.assert_called_once_with( snap_id=ANY, group_id=group_id, delay=28, repeat=37, scale_image=True, clean_up_files=False ) assert resp_object.status_code == 202 assert "c" in response_data_dict assert len(response_data_dict.keys()) == 1
def test_thermal_still_no_delay_or_repeat_calls_appropriate_methods(self, cv_get_settings_document, cv_get_delay_parameter, cv_get_repeat_parameter, cv_get_scale_image_parameter, cv_take_thermal_still): group_id = uuid.uuid4() cv_get_settings_document.return_value = {'current_group_id': group_id} cv_get_delay_parameter.return_value = 28 cv_get_repeat_parameter.return_value = 37 cv_get_scale_image_parameter.return_value = True cv_take_thermal_still.return_value = {'c': 'd'} resp_object = cv.thermal_still() response_data_dict = json.loads(resp_object.data) cv_get_settings_document.assert_called_once_with() cv_get_delay_parameter.assert_called_once_with() cv_get_repeat_parameter.assert_called_once_with() cv_get_scale_image_parameter.assert_called_once_with() cv_take_thermal_still.assert_called_once_with(snap_id=ANY, group_id=group_id, delay=28, repeat=37, scale_image=True) assert resp_object.status_code == 202 assert 'c' in response_data_dict assert len(response_data_dict.keys()) == 1