Sha256: cbb47b0f5f884feb0dd97ca369ce60a14b1458b1ae190be6370a69792c14e807

Contents?: true

Size: 1.61 KB

Versions: 6

Compression:

Stored size: 1.61 KB

Contents

#!/usr/bin/python
#
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Unit tests for the zone commands."""



import path_initializer
path_initializer.InitializeSysPath()

import copy

import gflags as flags
import unittest

from gcutil import command_base
from gcutil import mock_api
from gcutil import zone_cmds

FLAGS = flags.FLAGS


class ZoneCmdsTest(unittest.TestCase):

  def testGetZoneGeneratesCorrectRequest(self):
    flag_values = copy.deepcopy(FLAGS)

    command = zone_cmds.GetZone('getzone', flag_values)

    expected_jurisdiction = 'test_jurisdiction'
    expected_region = 'test_region'
    expected_zone = 'z'
    submitted_full_zone = '%s-%s-%s' % (expected_jurisdiction,
                                        expected_region,
                                        expected_zone)
    flag_values.service_version = command_base.CURRENT_VERSION

    command.SetFlags(flag_values)
    command.SetApi(mock_api.MockApi())

    result = command.Handle(submitted_full_zone)

    self.assertEqual(result['zone'], submitted_full_zone)


if __name__ == '__main__':
  unittest.main()

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
googlecloud-0.0.7 packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/zone_cmds_test.py
gcloud-0.0.7 packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/zone_cmds_test.py
googlecloud-0.0.6 packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/zone_cmds_test.py
gcloud-0.0.6 packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/zone_cmds_test.py
googlecloud-0.0.4 packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/zone_cmds_test.py
gcloud-0.0.4 packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/zone_cmds_test.py