Exemplo n.º 1
0
def test_annex_set_description():
    path = '/tmp/test-ddr-dvcs/test-repo'
    
    repo = make_repo(path, ['testing'])
    annex_init(repo)
    out0 = dvcs.annex_set_description(repo, annex_status=SAMPLE_ANNEX_STATUS, description='testing')
    expected0 = 'testing'
    cleanup_repo(path)
    
    repo = make_repo(path, ['testing'])
    annex_init(repo)
    out1 = dvcs.annex_set_description(repo, annex_status=SAMPLE_ANNEX_STATUS, drive_label='usb2015')
    expected1 = 'usb2015'
    cleanup_repo(path)
    
    repo = make_repo(path, ['testing'])
    annex_init(repo)
    out2 = dvcs.annex_set_description(repo, annex_status=SAMPLE_ANNEX_STATUS, hostname='machine',)
    expected2 = 'machine'
    cleanup_repo(path)
    
    repo = make_repo(path, ['testing'])
    annex_init(repo)
    out3 = dvcs.annex_set_description(
        repo, annex_status=SAMPLE_ANNEX_STATUS, hostname='pnr',
    )
    expected3 = 'pnr:densho.org'
    cleanup_repo(path)
    
    assert out0 == expected0
    assert out1 == expected1
    assert out2 == expected2
    assert out3 == expected3
Exemplo n.º 2
0
def test_annex_set_description():
    dl = 'WD201405'
    hn = 'ddrworkstation'
    ph = 'testing'
    ml = '*****@*****.**'
    # drive label
    assert dvcs.annex_set_description(drive_label=dl, hostname=hn, partner_host=ph, mail=ml) == dl
    # hostname:domainname
    expected1 = 'ddrworkstation:densho.org'
    assert dvcs.annex_set_description(drive_label=None, hostname=hn, partner_host=hn, mail=ml) == expected1
    # hostname
    assert dvcs.annex_set_description(drive_label=None, hostname=hn, partner_host=ph, mail=ml) == hn
Exemplo n.º 3
0
def test_annex_set_description():
    path = '/tmp/test-ddr-dvcs/test-repo'

    repo = make_repo(path, ['testing'])
    annex_init(repo)
    out0 = dvcs.annex_set_description(repo,
                                      annex_status=SAMPLE_ANNEX_STATUS,
                                      description='testing')
    expected0 = 'testing'
    cleanup_repo(path)

    repo = make_repo(path, ['testing'])
    annex_init(repo)
    out1 = dvcs.annex_set_description(repo,
                                      annex_status=SAMPLE_ANNEX_STATUS,
                                      drive_label='usb2015')
    expected1 = 'usb2015'
    cleanup_repo(path)

    repo = make_repo(path, ['testing'])
    annex_init(repo)
    out2 = dvcs.annex_set_description(
        repo,
        annex_status=SAMPLE_ANNEX_STATUS,
        hostname='machine',
    )
    expected2 = 'machine'
    cleanup_repo(path)

    repo = make_repo(path, ['testing'])
    annex_init(repo)
    out3 = dvcs.annex_set_description(
        repo,
        annex_status=SAMPLE_ANNEX_STATUS,
        hostname='pnr',
    )
    expected3 = 'pnr:'
    cleanup_repo(path)

    assert out0 == expected0
    assert out1 == expected1
    assert out2 == expected2
    # description may change depending on the machine
    # examples: pnr:densho.org, pnr:mydomain.com
    # so just check that contains "pnr:"
    assert expected3 in out3
Exemplo n.º 4
0
def test_annex_set_description():
    dl = 'WD201405'
    hn = 'ddrworkstation'
    ph = 'testing'
    ml = '*****@*****.**'
    # drive label
    assert dvcs.annex_set_description(drive_label=dl,
                                      hostname=hn,
                                      partner_host=ph,
                                      mail=ml) == dl
    # hostname:domainname
    expected1 = 'ddrworkstation:densho.org'
    assert dvcs.annex_set_description(drive_label=None,
                                      hostname=hn,
                                      partner_host=hn,
                                      mail=ml) == expected1
    # hostname
    assert dvcs.annex_set_description(drive_label=None,
                                      hostname=hn,
                                      partner_host=ph,
                                      mail=ml) == hn