コード例 #1
0
 def test_rpc_query_get(self):
     # TODO
     ecs_client = EcsClient(self.client_config, self.init_credentials_provider())
     tag = "hi"
     try:
         context = ecs_client.add_tags(list_of_tag=tag, resource_type="instance",
                                       resource_id="i-bp13ozj6v9ckzcq8sjxw")
         assert False
     except ParamValidationException as e:
         if six.PY2:
             self.assertEqual(e.error_message,
                              "Parameter validation failed: Invalid type for parameter Tag, value: hi, type: <type 'str'>, valid types: <type 'list'>")
         else:
             self.assertEqual(e.error_message,
                              "Parameter validation failed: Invalid type for parameter Tag, value: hi, type: <class 'str'>, valid types: <class 'list'>")
コード例 #2
0
 def test_rpc_query_list(self):
     ecs_client = EcsClient(self.client_config, self.init_credentials_provider())
     tag = [
         {"xxx": 123,
          "aaaa": 456,
          },
         {"Key": 234,
          "qqq": 345,
          },
     ]
     try:
         context = ecs_client.add_tags(list_of_tag=tag, resource_type="instance",
                                       resource_id="i-bp13ozj6v9ckzcq8sjxw")
         assert False
     except ServerException as e:
         self.assertEqual(e.http_status, 400)
         self.assertEqual(e.endpoint, 'ecs-cn-hangzhou.aliyuncs.com')
         self.assertEqual(e.error_code, 'InvalidTagValue.Malformed')
         self.assertEqual(e.error_message, 'The specified Tag.n.Value is not valid.')