def prepare_delete_response(self): line = {'id': self.line_id, 'protocol': self.protocol} endpoint = {'id': self.endpoint_id} self.confd.add_json_response(urljoin('lines', self.line_id), line, method='GET') endpoint_association = {'line_id': self.line_id, 'endpoint_id': self.endpoint_id} self.confd.add_json_response(urljoin('lines', self.line_id, 'endpoints', self.protocol), endpoint_association, method='GET') self.confd.add_json_response(urljoin('endpoints', self.protocol, self.endpoint_id), endpoint, method='GET') self.confd.add_response(urljoin('lines', self.line_id), method='DELETE', code=204) # add device device_association = {'device_id': self.device_id} self.confd.add_json_response(urljoin('lines', self.line_id, 'devices'), device_association, method='GET') self.confd.add_response(urljoin('lines', self.line_id, 'devices', self.device_id), method='DELETE', code=204) # add 1 user user_association = {'items': [{'user_id': self.user_id}]} self.confd.add_json_response(urljoin('lines', self.line_id, 'users'), user_association, method='GET') self.confd.add_response(urljoin('users', self.user_id, 'lines', self.line_id), method='DELETE', code=204) # add 1 extension extension_association = {'items': [{'extension_id': self.extension_id}]} self.confd.add_json_response(urljoin('lines', self.line_id, 'extensions'), extension_association, method='GET') self.confd.add_response(urljoin('lines', self.line_id, 'extensions', self.extension_id), method='DELETE', code=204) extension = {'context': self.context} self.confd.add_json_response(urljoin('extensions', self.extension_id), extension, method='GET') self.confd.add_response(urljoin('extensions', self.extension_id), method='DELETE', code=204)
def assert_line_edited(self, endpoint): self.confd.assert_json_request(urljoin('endpoints', self.protocol, self.endpoint_id), endpoint, method='PUT')
def assert_line_added(self, endpoint): line = {'context': self.context} self.confd.assert_json_request('/lines', line, method='POST') self.confd.assert_json_request(urljoin('endpoints', self.protocol), endpoint, method='POST') self.confd.assert_request_sent(urljoin('lines', self.line_id, 'endpoints', self.protocol, self.endpoint_id), method='PUT')
def add_custom(self, **extra): custom = self.build_custom(**extra) url = urljoin("endpoints", "custom", custom['id']) self.confd.add_json_response(url, custom, preserve=True) return custom
def add_sccp(self, **extra): sccp = self.build_sccp(**extra) url = urljoin("endpoints", "sccp", sccp['id']) self.confd.add_json_response(url, sccp, preserve=True) return sccp
def add_sip(self, **extra): sip = self.build_sip(**extra) self.confd.add_json_response(urljoin("endpoints", "sip", sip['id']), sip, preserve=True) return sip