def test_happy_path(self):
        """
        Given:
            An asset_id and uploaded_status are supplied
        Then:
            A SQL update is performed
        """
        AssetDao.update_uploaded_status(1, UploadedStatus.COMPLETE.value, self.mock_cursor)

        self.mock_cursor.execute.assert_called_once_with(
            'update asset set uploaded_status = %s where id = %s',
            (UploadedStatus.COMPLETE.value, 1)
        )
def change_asset_upload_status(request, cursor):
    """
    Updates a requested asset to have a new status.

    :param request: a dict with keys `asset_id` and `uploaded_status`, denoting
    the asset's id and the new upload status.
    """
    _check_valid_change_upload_status_request(request)
    asset = AssetDao.get_by_id(request['asset_id'], cursor)

    if not asset:
        raise AssetNotFoundException(
            f'Asset with id {request["asset_id"]} not found')

    AssetDao.update_uploaded_status(request['asset_id'],
                                    request['uploaded_status'], cursor)

    return {
        'success': True,
        'uploaded_status': request['uploaded_status'],
    }