コード例 #1
0
def test_read_write(testdata_path, metadata_path):
    """
    :type testdata_path: Path
    :type metadata_path: Path
    """
    assert not metadata_path.exists()

    dd = directory.read_directory(testdata_path)
    original_names = dd.names()
    original_data = {}

    for name in original_names:
        data = dd[name]
        assert data["file"]["updated"]
        del data["file"]["updated"]

        assert "updated" in dd[name]["file"]  # Should not affect internal data

        original_data[name] = data

    dd.write_if_updated()

    assert metadata_path.exists()

    dd2 = directory.read_directory(testdata_path)

    assert original_names == dd2.names()

    for name in original_names:
        data = dd2[name]
        assert not data["file"]["updated"]
        del data["file"]["updated"]
        assert original_data[name] == data
コード例 #2
0
def test_read_write(testdata_path, metadata_path):
    """
    :type testdata_path: Path
    :type metadata_path: Path
    """
    assert not metadata_path.exists()
    
    dd = directory.read_directory(testdata_path)
    original_names =  dd.names()
    original_data = {}
    
    for name in original_names:
        data = dd[name]
        assert data['file']['updated']
        del data['file']['updated']
        
        assert 'updated' in dd[name]['file']  # Should not affect internal data
        
        original_data[name] = data
    
    
    dd.write_if_updated()
    
    assert metadata_path.exists()
    
    
    dd2 = directory.read_directory(testdata_path) 
    
    assert original_names == dd2.names()
    
    for name in original_names:
        data = dd2[name]
        assert not data['file']['updated']
        del data['file']['updated']
        assert original_data[name] == data
コード例 #3
0
def test_hash(blocksize, testdata_path, hashes):
    dd = directory.read_directory(testdata_path)
    assert len(hashes) == len(dd._data)

    for name in hashes:
        assert hashes[name] == dd[name]['file']['sha1']