Example #1
0
    def test_get_path(self, monkeypatch):
        def mock_expanduser(user):
            return os.getcwd().rstrip(os.sep)
        monkeypatch.setattr(os.path, 'expanduser', mock_expanduser)
        index_path = Index.get_path(DummyClass)
        class_name = DummyClass.__name__.lower()
        package = [m.lower() for m in Introspection.get_instance_path(DummyClass)]
        expected = os.sep.join([os.getcwd().rstrip(os.sep), '.data'] + package + [class_name])
        assert index_path == expected

        index_path = Index.get_path(DummyClass())
        assert index_path == expected