Example #1
0
def test_URLColumn_prepare_string_nones_unclean_input(monkeypatch):
    uc = columns.URLColumn('test', False, 100)

    def mock_sanitize_string(some_string):
        return some_string + 'diff string'
    monkeypatch.setattr(uc, '_Column__sanitize_string', mock_sanitize_string)
    actual_str = uc.prepare_string('test string')
    expect_str = None
    assert actual_str == expect_str
Example #2
0
import logging
import os

from common.licenses import licenses
from common.storage import util
from common.storage import columns

logger = logging.getLogger(__name__)

_IMAGE_TSV_COLUMNS = [
    # The order of this list maps to the order of the columns in the TSV.
    columns.StringColumn(name='foreign_identifier',
                         required=False,
                         size=3000,
                         truncate=False),
    columns.URLColumn(name='foreign_landing_url', required=True, size=1000),
    columns.URLColumn(
        # `url` in DB
        name='image_url',
        required=True,
        size=3000),
    columns.URLColumn(
        # `thumbnail` in DB
        name='thumbnail_url',
        required=False,
        size=3000),
    columns.IntegerColumn(name='width', required=False),
    columns.IntegerColumn(name='height', required=False),
    columns.IntegerColumn(name='filesize', required=False),
    columns.StringColumn(name='license_',
                         required=True,