Example #1
0
def test_specification():
    spec = synccopy.Specification(synccopy_options=options.SyncCopy(
        access_tier=None,
        delete_extraneous_destination=False,
        dest_mode=azmodels.StorageModes.Auto,
        mode=azmodels.StorageModes.Auto,
        overwrite=True,
        recursive=True,
        rename=False,
    ),
                                  skip_on_options=options.SkipOn(
                                      filesize_match=True,
                                      lmt_ge=False,
                                      md5_match=True,
                                  ))

    spec.add_azure_source_path(mock.MagicMock())
    assert len(spec.sources) == 1

    spec.add_azure_destination_path(mock.MagicMock())
    assert len(spec.destinations) == 1
def test_output_parameters():
    go = mock.MagicMock()
    go.log_file = 'abc'

    spec = modelsdl.Specification(
        download_options=options.Download(
            check_file_md5=True,
            chunk_size_bytes=4194304,
            delete_extraneous_destination=False,
            mode=azmodels.StorageModes.Auto,
            overwrite=True,
            recursive=True,
            rename=False,
            restore_file_attributes=False,
            rsa_private_key=None,
        ),
        skip_on_options=options.SkipOn(
            filesize_match=True,
            lmt_ge=False,
            md5_match=True,
        ),
        local_destination_path=mock.MagicMock(),
    )
    ops.output_parameters(go, spec)
    assert util.is_not_empty(go.log_file)

    spec = modelsul.Specification(upload_options=options.Upload(
        chunk_size_bytes=4194304,
        delete_extraneous_destination=False,
        mode=azmodels.StorageModes.Auto,
        one_shot_bytes=0,
        overwrite=True,
        recursive=True,
        rename=False,
        rsa_public_key=None,
        stdin_as_page_blob_size=0,
        store_file_properties=options.FileProperties(
            attributes=True,
            md5=True,
        ),
        strip_components=0,
        vectored_io=None,
    ),
                                  skip_on_options=options.SkipOn(
                                      filesize_match=True,
                                      lmt_ge=False,
                                      md5_match=True,
                                  ),
                                  local_source_path=mock.MagicMock())
    ops.output_parameters(go, spec)
    assert util.is_not_empty(go.log_file)

    spec = modelssc.Specification(synccopy_options=options.SyncCopy(
        delete_extraneous_destination=False,
        dest_mode=azmodels.StorageModes.Auto,
        mode=azmodels.StorageModes.Auto,
        overwrite=True,
        recursive=True,
        rename=False,
    ),
                                  skip_on_options=options.SkipOn(
                                      filesize_match=True,
                                      lmt_ge=False,
                                      md5_match=True,
                                  ))
    ops.output_parameters(go, spec)
    assert util.is_not_empty(go.log_file)