def test_create_parameter(self, post_mock):
        # type: (Mock) -> None
        post_mock.return_value = Response(True, create_parameter_response, 200)
        body = create_parameter_body
        request = ProductsResource(config=self.config)
        request.create_parameter('PRD-075-401-854', body)

        post_mock.assert_called_with(
            headers={
                'Content-Type': 'application/json',
                'Authorization': 'ApiKey XXXX:YYYYY'
            },
            json=body,
            timeout=300,
            url=
            'http://localhost:8080/public/v1/products/PRD-075-401-854/parameters/'
        )
Exemple #2
0
 def create_parameter(self, product_id, body):
     product = ProductsResource(config=self.configuration)
     return product.create_parameter(product_id, body)
 def test_create_parameter_bad(self):
     request = ProductsResource(config=self.config)
     with pytest.raises(ValueError) as e:
         request.create_parameter(None, None)
     assert str(e.value) == 'Invalid ID'