Beispiel #1
0
    def _callFUT(self, project_id=None):
        from gcloud._helpers import _default_service_project_id
        from gcloud._testing import _Monkey

        def mock_expanduser(path=None):
            if project_id and path:
                __import__('pwd')  # Simulate actual expanduser imports.
                return self.temp_config_file
            return ''

        with _Monkey(os.path, expanduser=mock_expanduser):
            return _default_service_project_id()
    def callFUT(self, project_id=None):
        from gcloud._helpers import _default_service_project_id
        import os

        def mock_expanduser(path=''):
            if project_id and path.startswith('~'):
                return self.temp_config_file
            return ''

        from gcloud._testing import _Monkey
        with _Monkey(os.path, expanduser=mock_expanduser):
            return _default_service_project_id()
Beispiel #3
0
    def callFUT(self, project_id=None):
        import os
        from gcloud._helpers import _default_service_project_id
        from gcloud._testing import _Monkey

        def mock_expanduser(path=None):
            if project_id and path:
                __import__('pwd')  # Simulate actual expanduser imports.
                return self.temp_config_file
            return ''

        with _Monkey(os.path, expanduser=mock_expanduser):
            return _default_service_project_id()