Example #1
0
def test_keys():
    pkg = Package()
    assert not pkg.keys()

    pkg.set('asdf', LOCAL_MANIFEST)
    assert set(pkg.keys()) == {'asdf'}

    pkg.set('jkl;', REMOTE_MANIFEST)
    assert set(pkg.keys()) == {'asdf', 'jkl;'}

    pkg.delete('asdf')
    assert set(pkg.keys()) == {'jkl;'}
Example #2
0
def test_tophash_changes(tmpdir):
    test_file = tmpdir / 'test.txt'
    test_file.write_text('asdf', 'utf-8')

    pkg = Package()
    th1 = pkg.top_hash()
    pkg.set('asdf', test_file)
    pkg.build()
    th2 = pkg.top_hash()
    assert th1 != th2

    test_file.write_text('jkl', 'utf-8')
    pkg.set('jkl', test_file)
    pkg.build()
    th3 = pkg.top_hash()
    assert th1 != th3
    assert th2 != th3

    pkg.delete('jkl')
    th4 = pkg.top_hash()
    assert th2 == th4