#!/usr/bin/env python # Copyright 2018 The LUCI Authors. All rights reserved. # Use of this source code is governed under the Apache License, Version 2.0 # that can be found in the LICENSE file. import logging import sys import unittest import test_env_platforms test_env_platforms.setup_test_env() from depot_tools import auto_stub # Disable caching before importing gce. from utils import tools tools.cached = lambda func: func import gce class TestGCE(auto_stub.TestCase): def test_get_zones(self): self.mock(gce, 'get_zone', lambda: 'us-central2-a') self.assertEqual(['us', 'us-central', 'us-central2', 'us-central2-a'], gce.get_zones()) self.mock(gce, 'get_zone', lambda: 'europe-west1-b') self.assertEqual( ['europe', 'europe-west', 'europe-west1', 'europe-west1-b'], gce.get_zones())
#!/usr/bin/env python # Copyright 2015 The LUCI Authors. All rights reserved. # Use of this source code is governed by the Apache v2.0 license that can be # found in the LICENSE file. import logging import sys import unittest import test_env_platforms test_env_platforms.setup_test_env() import win class TestWin(unittest.TestCase): def test_from_cygwin_path(self): data = [ ('foo', None), ('x:\\foo$', None), ('X:\\foo$', None), ('/cygdrive/x/foo$', 'x:\\foo$'), ] for i, (inputs, expected) in enumerate(data): actual = win.from_cygwin_path(inputs) self.assertEqual(expected, actual, (inputs, expected, actual, i)) def test_to_cygwin_path(self): data = [ ('foo', None), ('x:\\foo$', '/cygdrive/x/foo$'),