def test_createNewContact(self): contact = { 'full_name': 'Kurt Test Mandela', 'contact_type': 'human', 'enabled': False } headers, body = self.adminServer.createContact(contact) jsonBody = json.loads(body) try: contactId = jsonBody['id'] #Validate that the create made a correct contact. headers, body = self.adminServer.getContact(contactId) jsonBody = json.loads(body) schema = self.contactSchema utilities.verifySchema(schema, jsonBody) assert contact['full_name'] == jsonBody['full_name'], 'full_name in Contact and response is not equal' assert contact['contact_type'] == jsonBody['contact_type'], 'contact_type in Contact and response is not equal.' assert contact['enabled'] == jsonBody['enabled'], 'enabled in Contact and response is not equal' self.adminServer.deleteContact(contactId) except Exception as e: self.log.info('Contact: ' + str(contact) + ' Json: ' + str(jsonBody)) self.fail('Creating a new contact did not give the expected output. Response: "' + str(jsonBody) + '" Error ' + str(e))
def test_createNewContact(self): contact = { 'full_name': 'Kurt Test Mandela', 'contact_type': 'human', 'enabled': False } headers, body = self.adminServer.createContact(contact) jsonBody = json.loads(body) try: contactId = jsonBody['id'] #Validate that the create made a correct contact. headers, body = self.adminServer.getContact(contactId) jsonBody = json.loads(body) schema = self.contactSchema utilities.verifySchema(schema, jsonBody) assert contact['full_name'] == jsonBody[ 'full_name'], 'full_name in Contact and response is not equal' assert contact['contact_type'] == jsonBody[ 'contact_type'], 'contact_type in Contact and response is not equal.' assert contact['enabled'] == jsonBody[ 'enabled'], 'enabled in Contact and response is not equal' self.adminServer.deleteContact(contactId) except Exception as e: self.log.info('Contact: ' + str(contact) + ' Json: ' + str(jsonBody)) self.fail( 'Creating a new contact did not give the expected output. Response: "' + str(jsonBody) + '" Error ' + str(e))
def test_getOrganizationContactList(self): organizationId = 1 headers, body = self.adminServer.getOrganizationContactList( organizationId) jsonBody = json.loads(body) schema = self.contactListSchema utilities.verifySchema(schema, jsonBody)
def test_getFirstReception(self): organizationId = 1 receptionId = 1 headers, body = self.adminServer.getReception(organizationId, receptionId) jsonBody = json.loads(body) schema = self.receptionSchema utilities.verifySchema(schema, jsonBody)
def test_getReceptionContact(self): receptionId = 1 contactId = 1 headers, body = self.adminServer.getReceptionContact( receptionId, contactId) jsonBody = json.loads(body) schema = self.receptionContactSchema utilities.verifySchema(schema, jsonBody)
def test_createNewReceptionContact(self): receptionContact = { 'wants_messages': True, 'attributes': { "backup": [], "department": "", "emailaddresses": [], "handling": [], "info": "", "position": "", "relations": "", "responsibility": "", "telephonenumbers": [], "tags": [], "workhours": [] }, 'enabled': False } receptionId = 1 contactId = 10 body = self.adminServer.createReceptionContact(receptionId, contactId, receptionContact)[1] jsonBody = json.loads(body) try: #Validate that the create made a correct receptionContact. body = self.adminServer.getReceptionContact( receptionId, contactId)[1] jsonBody = json.loads(body) schema = self.receptionContactSchema utilities.verifySchema(schema, jsonBody) assert receptionContact['wants_messages'] == jsonBody[ 'wants_messages'], 'wants_messages in ReceptionContact and response is not equal' assert receptionContact['attributes'] == jsonBody[ 'attributes'], 'attributes in ReceptionContact and response is not equal' assert receptionContact['enabled'] == jsonBody[ 'reception_enabled'], 'enabled in ReceptionContact and response is not equal. ' + jsonBody except Exception as e: self.log.info('ReceptionContact: ' + str(receptionContact) + ' Json: ' + str(jsonBody)) self.fail( 'Creating a new receptionContact did not give the expected output. Response: "' + str(jsonBody) + '"\n Error ' + str(e)) finally: self.adminServer.deleteReceptionContact(receptionId, contactId)
def test_getUserList(self): headers, body = self.adminServer.getUserList() jsonBody = json.loads(body) schema = self.userListSchema utilities.verifySchema(schema, jsonBody)
def test_getUser(self): userId = 1 headers, body = self.adminServer.getUser(userId) jsonBody = json.loads(body) schema = self.userSchema utilities.verifySchema(schema, jsonBody)
def test_getContactList(self): headers, body = self.adminServer.getContactList() jsonBody = json.loads(body) schema = self.contactListSchema utilities.verifySchema(schema, jsonBody)
def test_getDialplan(self): reception_id = 1 response = self.adminServer.getDialplan(reception_id)[1] jsonBody = json.loads(response) schema = self.dialplanSchema utilities.verifySchema(schema, jsonBody)
def test_getOrganizationList(self): headers, body = self.adminServer.getOrganizationList() jsonBody = json.loads(body) schema = self.organizationListSchema utilities.verifySchema(schema, jsonBody)
def test_getOrganization(self): contactId = 1 headers, body = self.adminServer.getContactOrganization(contactId) jsonBody = json.loads(body) schema = self.organizationListSchema utilities.verifySchema(schema, jsonBody)
def test_getFirstContact(self): headers, body = self.adminServer.getContact(1) jsonBody = json.loads(body) schema = self.contactSchema utilities.verifySchema(schema, jsonBody)
def test_getContactTypeList(self): headers, body = self.adminServer.getContactTypes() jsonBody = json.loads(body) schema = self.contactTypeSchema utilities.verifySchema(schema, jsonBody)