Beispiel #1
0
    def test_post_customer_creation_first_method(self, mock_post):
        expected_body = {
            'base': {
                'contacts': {
                    'email': '*****@*****.**'
                }
            },
            'extra': 'extra',
            'extended': {
                'prova': 'prova'
            },
            'tags': {
                'auto': ['auto'],
                'manual': ['manual']
            }
        }
        mock_post.return_value = json.loads(
            FakeHTTPResponse(resp_path='tests/util/fake_post_response').text)
        c = Customer(
            node=self.node,
            base=Properties(contacts=Properties(email='*****@*****.**')))

        c.extra = 'extra'
        c.extended.prova = 'prova'
        c.tags.auto = ['auto']
        c.tags.manual = ['manual']

        c.post()
        mock_post.assert_called_with(body=expected_body, force_update=False)
 def test_update_customer_not_full(self, mock_patch):
     c = Customer(node=self.node,
                  id='01',
                  base=Properties(contacts=Properties(email='email')))
     c.extra = 'extra'
     self.node.update_customer(c.id, **c.get_mutation_tracker())
     body = {'extra': 'extra'}
     mock_patch.assert_called_with(self.base_url + '/01',
                                   headers=self.headers_expected,
                                   json=body)