當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。