Beispiel #1
0
    def test_find_latest_raises_TrashNotFoundError(self):
        class TrashCanMock:
            def trashed_files(self):
                yield TrashedFileMock(Path('/foo'), datetime(2009, 01, 01))
                yield TrashedFileMock(Path('/foo'), datetime(2010, 01, 01))
                yield TrashedFileMock(Path('/bar'), datetime(2010, 01, 01))
        trashcan = TrashCanMock()

        # execute
        find_latest(trashcan, Path('/goo'))
Beispiel #2
0
    def test_find_latest(self):
        a_foo      = TrashedFileMock(Path('/foo'), datetime(2009, 01, 01))
        latest_foo = TrashedFileMock(Path('/foo'), datetime(2010, 01, 01))
        a_bar      = TrashedFileMock(Path('/bar'), datetime(2010, 01, 01))

        class TrashCanMock:
            def trashed_files(self):
                yield a_foo
                yield latest_foo
                yield a_bar
        trashcan = TrashCanMock()

        # execute
        result = find_latest(trashcan, Path('/foo'))

        # test
        assert_equals(latest_foo, result)