Example #1
0
    def test_picam_still_catches_exceptions(self, cv_get_settings_document):

        cv_get_settings_document.side_effect = ThermalBaseError("gruyere")

        resp_object = cv.picam_still()
        assert resp_object.data == '"gruyere"'
        assert resp_object.status_code == 400
Example #2
0
    def test_picam_still_catches_exceptions(self,
                                            cv_get_settings_document):

        cv_get_settings_document.side_effect = ThermalBaseError('gruyere')

        resp_object = cv.picam_still()
        assert resp_object.data == '"gruyere"'
        assert resp_object.status_code == 400
Example #3
0
    def test_picam_still_no_delay_or_repeat_calls_appropriate_methods(self,
                                                                      cv_get_settings_document,
                                                                      cv_gather_and_enforce_request_args,
                                                                      cv_take_picam_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': 54, 'repeat': 32, 'clean_up_files': False}
        cv_take_picam_still.return_value = {'a': 'b'}

        resp_object = cv.picam_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_picam_still.assert_called_once_with(snap_id=ANY, group_id=group_id, delay=54, repeat=32, clean_up_files=False)
        assert resp_object.status_code == 202
        assert 'a' in response_data_dict
        assert len(response_data_dict.keys()) == 1
Example #4
0
    def test_picam_still_no_delay_or_repeat_calls_appropriate_methods(
        self, cv_get_settings_document, cv_gather_and_enforce_request_args, cv_take_picam_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": 54, "repeat": 32, "clean_up_files": False}
        cv_take_picam_still.return_value = {"a": "b"}

        resp_object = cv.picam_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_picam_still.assert_called_once_with(
            snap_id=ANY, group_id=group_id, delay=54, repeat=32, clean_up_files=False
        )
        assert resp_object.status_code == 202
        assert "a" in response_data_dict
        assert len(response_data_dict.keys()) == 1
Example #5
0
    def test_picam_still_no_delay_or_repeat_calls_appropriate_methods(self,
                                                                      cv_get_settings_document,
                                                                      cv_get_delay_parameter,
                                                                      cv_get_repeat_parameter,
                                                                      cv_take_picam_still):
        group_id = uuid.uuid4()
        cv_get_settings_document.return_value = {'current_group_id': group_id}
        cv_get_delay_parameter.return_value = 54
        cv_get_repeat_parameter.return_value = 32
        cv_take_picam_still.return_value = {'a': 'b'}

        resp_object = cv.picam_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_take_picam_still.assert_called_once_with(snap_id=ANY, group_id=group_id, delay=54, repeat=32)
        assert resp_object.status_code == 202
        assert 'a' in response_data_dict
        assert len(response_data_dict.keys()) == 1
Example #6
0
    def test_picam_still_no_delay_or_repeat_calls_appropriate_methods(
            self, cv_get_settings_document, cv_get_delay_parameter,
            cv_get_repeat_parameter, cv_take_picam_still):
        group_id = uuid.uuid4()
        cv_get_settings_document.return_value = {'current_group_id': group_id}
        cv_get_delay_parameter.return_value = 54
        cv_get_repeat_parameter.return_value = 32
        cv_take_picam_still.return_value = {'a': 'b'}

        resp_object = cv.picam_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_take_picam_still.assert_called_once_with(snap_id=ANY,
                                                    group_id=group_id,
                                                    delay=54,
                                                    repeat=32)
        assert resp_object.status_code == 202
        assert 'a' in response_data_dict
        assert len(response_data_dict.keys()) == 1