Beispiel #1
0
def test_manifest_equality():
    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]))

    with patch("tardis.manifest.iso8601") as iso8601:
        iso8601.return_value = '2013-03-24T00:00:00.000000'
        assert_really_not_equal(expected, Manifest.from_filesystem('hostname', 'username', [temp_dir]))

    assert_equal(NotImplemented, expected.__eq__(1))
    assert_equal(NotImplemented, expected.__ne__(1))