当前位置: 首页>>代码示例>>Python>>正文


Python ProfitBricksService.get_location方法代码示例

本文整理汇总了Python中profitbricks.client.ProfitBricksService.get_location方法的典型用法代码示例。如果您正苦于以下问题:Python ProfitBricksService.get_location方法的具体用法?Python ProfitBricksService.get_location怎么用?Python ProfitBricksService.get_location使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在profitbricks.client.ProfitBricksService的用法示例。


在下文中一共展示了ProfitBricksService.get_location方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: TestLocation

# 需要导入模块: from profitbricks.client import ProfitBricksService [as 别名]
# 或者: from profitbricks.client.ProfitBricksService import get_location [as 别名]
class TestLocation(unittest.TestCase):
    def setUp(self):
        self.location = ProfitBricksService(
            username='username', password='password')

    def test_list_locations(self):
        locations = self.location.list_locations()

        self.assertEqual(len(locations), 4)
        self.assertEqual(locations['items'][0]['id'], 'de/fra')
        self.assertEqual(
            locations['items'][0]['properties']['name'], 'Europe / Germany / Frankfurt')

    def test_get_location(self):
        location = self.location.get_location(location_id)

        self.assertEqual(location['id'], 'de/fra')
        self.assertEqual(
            location['properties']['name'], 'Europe / Germany / Frankfurt')
开发者ID:grandvizier,项目名称:profitbricks-sdk-python,代码行数:21,代码来源:test_location.py

示例2: TestLocation

# 需要导入模块: from profitbricks.client import ProfitBricksService [as 别名]
# 或者: from profitbricks.client.ProfitBricksService import get_location [as 别名]
class TestLocation(unittest.TestCase):
    @classmethod
    def setUpClass(self):
        self.resource = resource()
        self.client = ProfitBricksService(
            username=configuration.USERNAME, password=configuration.PASSWORD, headers=configuration.HEADERS
        )

    def test_list_locations(self):
        locations = self.client.list_locations()

        self.assertEqual(len(locations), 4)
        for location in locations["items"]:
            self.assertEqual(location["type"], "location")
            self.assertIn(location["id"], self.resource["locations"])

    def test_get_location(self):
        location = self.client.get_location(configuration.LOCATION)

        self.assertEqual(location["type"], "location")
        self.assertEqual(location["id"], configuration.LOCATION)
开发者ID:fbrehm,项目名称:profitbricks-sdk-python,代码行数:23,代码来源:test_location_live.py


注:本文中的profitbricks.client.ProfitBricksService.get_location方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。