def test_unresumable_upload(create_api):
    METHOD_SPECS = {
        "path": "resource/",
        "httpMethod": "GET",
        "parameters": {},
        "supportsMediaUpload": True,
        "mediaUpload": {
            "accept": ["*/*", "application/octet-stream", "text/xml"],
            "maxSize": "100MB",
            "protocols": {
                "simple": {
                    "multipart": True,
                    "path": "resource"
                }
            },
        },
    }
    ROOT_URL = "https://example.com/"
    BATCH_PATH = "https://example.com/api/v1/batch"
    SERVICE_PATH = "service/"

    method = Method(
        name="upload",
        method_specs=METHOD_SPECS,
        global_parameters={},
        schemas={},
        batch_path=BATCH_PATH,
        root_url=ROOT_URL,
        service_path=SERVICE_PATH,
        validate=False,
    )
    req = method(upload_file="/home/omar/resumable_file.file")
    assert req.media_upload.resumable is None
Esempio n. 2
0
def test_unresumable_upload(create_api):
    METHOD_SPECS = {
        'path': 'resource/',
        'httpMethod': 'GET',
        'parameters': {},
        'supportsMediaUpload': True,
        'mediaUpload': {
            'accept': [
                "*/*",
                "application/octet-stream",
                "text/xml"
            ],

            'maxSize': "100MB",
            
            'protocols': {
                'simple': {
                    'multipart': True,
                    'path': "resource"
                }
            },
        }
    }
    ROOT_URL = 'https://example.com/'
    BATCH_PATH = 'https://example.com/api/v1/batch'
    SERVICE_PATH = 'service/'

    method = Method(name='upload', method_specs=METHOD_SPECS, global_parameters={}, schemas={}, batch_path=BATCH_PATH, root_url=ROOT_URL, service_path=SERVICE_PATH, validate=False)
    req = method(upload_file='/home/omar/resumable_file.file')
    assert req.media_upload.resumable is None
Esempio n. 3
0
def test_getitem():
    method = Method(name='IRRELEVANT',
                    method_specs={
                        'am_i_here_1': True,
                        'am_i_here_2': None
                    },
                    global_parameters={'IRRELEVANT': 'IRRELAVANT'},
                    schemas={'IRRELEVANT': 'IRRELEVANT'},
                    batch_path='IRRELEVANT',
                    root_url='IRRELEVANT',
                    service_path='IRRELEVANT',
                    validate=False)

    assert method['am_i_here_1'] is True
    assert method['am_i_here_2'] is None
    assert method['i_dont_exist'] is None
Esempio n. 4
0
def test_getitem():
    method = Method(
        name="IRRELEVANT",
        method_specs={
            "am_i_here_1": True,
            "am_i_here_2": None
        },
        global_parameters={"IRRELEVANT": "IRRELAVANT"},
        schemas={"IRRELEVANT": "IRRELEVANT"},
        batch_path="IRRELEVANT",
        root_url="IRRELEVANT",
        service_path="IRRELEVANT",
        validate=False,
    )

    assert method["am_i_here_1"] is True
    assert method["am_i_here_2"] is None
    assert method["i_dont_exist"] is None