Ejemplo n.º 1
0
def test_manifest_from_filesystem():
    tree = Tree(DirectoryEntry.for_directory(temp_dir), [])
    expected_entries = { e.path: e for d in tree for e in d }
    expected_name = 'manifest/hostname/username/2013-03-18T15:33:50.122018'
    expected = Manifest(expected_name, expected_entries)

    with patch("tardis.manifest.iso8601") as iso8601:
        iso8601.return_value = '2013-03-18T15:33:50.122018'

        assert_really_equal(expected, Manifest.from_filesystem('hostname', 'username', [temp_dir]))
Ejemplo n.º 2
0
def test_directory_entry_for_directory_no_files(isfile_mock):
    isfile_mock.return_value = False

    expected = DirectoryEntry(temp_dir, [])
    assert_really_equal(expected, DirectoryEntry.for_directory(temp_dir))
Ejemplo n.º 3
0
def test_directory_entry_for_directory():
    expected_entries = [expected_file_entry_for(i) for i in range(10)]
    expected = DirectoryEntry(temp_dir, expected_entries)

    assert_really_equal(expected, DirectoryEntry.for_directory(temp_dir))
Ejemplo n.º 4
0
def test_directory_entry_for_directory_not_dir(isdir_mock):
    isdir_mock.return_value = False
    DirectoryEntry.for_directory(temp_dir)