本文整理匯總了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)