def test_dont_modify_default_params(self):
        """should not modify the default_params when building params"""
        self.config["default_params"] = {"foo": "bar"}
        expected = copy(self.config["default_params"])

        adapter = RestfulHttpAdapter(self.config, mode="read")
        params = adapter.params_for(self.model)
        self.assertEqual(adapter.config.default_params, expected)
    def test_dont_modify_default_params(self):
        """should not modify the default_params when building params"""
        self.config['default_params'] = {'foo': 'bar'}
        expected = copy(self.config['default_params'])

        adapter = RestfulHttpAdapter(self.config)
        params = adapter.params_for(self.model)
        self.assertEqual(adapter.config['default_params'], expected)
    def test_dont_modify_default_params(self):
        """should not modify the default_params when building params"""
        self.config['default_params'] = {'foo':'bar'}
        expected = copy(self.config['default_params'])

        adapter = RestfulHttpAdapter(self.config)
        params = adapter.params_for(self.model)
        self.assertEqual(adapter.config['default_params'], expected)
    def test_with_default_params(self):
        """should include the default_options with the attribuets"""
        self.config["default_params"] = {"foo": "bar"}
        expected = copy(self.model.attributes)
        expected.update({"foo": "bar"})

        adapter = RestfulHttpAdapter(self.config, mode="read")
        params = adapter.params_for(self.model)
        self.assertEqual(params, expected)
    def test_with_default_params(self):
        """should include the default_options with the attribuets"""
        self.config['default_params'] = {'foo': 'bar'}
        expected = copy(self.model.fields)
        expected.update({'foo': 'bar'})

        adapter = RestfulHttpAdapter(self.config)
        params = adapter.params_for(self.model)
        self.assertEqual(params, expected)
    def test_with_default_params(self):
        """should include the default_options with the attribuets"""
        self.config['default_params'] = {'foo': 'bar'}
        expected = copy(self.model.fields)
        expected.update({'foo':'bar'})

        adapter = RestfulHttpAdapter(self.config)
        params = adapter.params_for(self.model)
        self.assertEqual(params, expected)
    def test_with_default_params_and_params_wrapper(self):
        """should include the attributes inside the wrapper and the default
        params outside the wrapper"""
        self.config["default_params"] = {"foo": "bar", "widget": 5}
        self.config["params_wrapper"] = "widget"
        expected = copy(self.config["default_params"])
        expected.update(copy({"widget": self.model.attributes}))

        adapter = RestfulHttpAdapter(self.config, mode="read")
        params = adapter.params_for(self.model)
        self.assertEqual(params, expected)
    def test_with_default_params_and_params_wrapper(self):
        """should include the attributes inside the wrapper and the default
        params outside the wrapper"""
        self.config['default_params'] = {'foo': 'bar', 'widget': 5}
        self.config['params_wrapper'] = 'widget'
        expected = copy(self.config['default_params'])
        expected.update(copy({'widget': self.model.fields}))

        adapter = RestfulHttpAdapter(self.config)
        params = adapter.params_for(self.model)
        self.assertEqual(params, expected)
    def test_with_default_params_and_params_wrapper(self):
        """should include the attributes inside the wrapper and the default
        params outside the wrapper"""
        self.config['default_params'] = {'foo': 'bar', 'widget': 5}
        self.config['params_wrapper'] = 'widget'
        expected = copy(self.config['default_params'])
        expected.update(copy({'widget':self.model.fields}))

        adapter = RestfulHttpAdapter(self.config)
        params = adapter.params_for(self.model)
        self.assertEqual(params, expected)
Example #10
0
 def test_with_wrapper(self):
     """should wrap the model's attributes with the given string"""
     self.config["params_wrapper"] = "widget"
     adapter = RestfulHttpAdapter(self.config, mode="read")
     params = adapter.params_for(self.model)
     self.assertEqual(params, {"widget": self.model.attributes})
 def test_with_wrapper(self):
     """should wrap the model's attributes with the given string"""
     self.config['params_wrapper'] = 'widget'
     adapter = RestfulHttpAdapter(self.config)
     params = adapter.params_for(self.model)
     self.assertEqual(params, {'widget': self.model.fields})
 def test_with_wrapper(self):
     """should wrap the model's attributes with the given string"""
     self.config['params_wrapper'] = 'widget'
     adapter = RestfulHttpAdapter(self.config)
     params = adapter.params_for(self.model)
     self.assertEqual(params, {'widget': self.model.fields})