本文整理汇总了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')
示例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)