def testSendUpdateWithBadParameters(self): """ Test the ability to send a message to the CyberQ with bad parameters """ with patch.object(requests, 'post') as mockMethod: with self.assertRaises(ParameterValidationException): mockMethod.return_value.status_code = 200 cqi = CyberQInterface("127.0.0.1") cqi.sendUpdate({'FOOD1_NME' : "Tri-Tip Roast", 'FOOD1_SET': '140', 'COOK_SET' : '300'})
def testSendUpdateWithBadResponse(self): """ Test the ability to send a message to the CyberQ with good parameters but a bad response """ with patch.object(requests, 'post') as mockMethod: with self.assertRaises(ResponseHTTPException): mockMethod.return_value.status_code = 500 cqi = CyberQInterface("127.0.0.1") cqi.sendUpdate({'FOOD1_NAME' : "Tri-Tip Roast", 'FOOD1_SET': '140', 'COOK_SET' : '300'})
def testSendUpdateWithBadParameters(self): """ Test the ability to send a message to the CyberQ with bad parameters """ with patch.object(requests, 'post') as mockMethod: with self.assertRaises(ParameterValidationException): mockMethod.return_value.status_code = 200 cqi = CyberQInterface("127.0.0.1") cqi.sendUpdate({ 'FOOD1_NME': "Tri-Tip Roast", 'FOOD1_SET': '140', 'COOK_SET': '300' })
def testSendUpdateWithBadResponse(self): """ Test the ability to send a message to the CyberQ with good parameters but a bad response """ with patch.object(requests, 'post') as mockMethod: with self.assertRaises(ResponseHTTPException): mockMethod.return_value.status_code = 500 cqi = CyberQInterface("127.0.0.1") cqi.sendUpdate({ 'FOOD1_NAME': "Tri-Tip Roast", 'FOOD1_SET': '140', 'COOK_SET': '300' })
def testSendUpdate(self): """ Test the ability to send a message to the CyberQ with good parameters """ with patch.object(requests, 'post') as mockMethod: mockMethod.return_value.status_code = 200 cqi = CyberQInterface("127.0.0.1") self.assertEqual(cqi.sendUpdate({'FOOD1_NAME' : "Tri-Tip Roast", 'FOOD1_SET': '140', 'COOK_SET' : '300'}),True)
def testSendUpdate(self): """ Test the ability to send a message to the CyberQ with good parameters """ with patch.object(requests, 'post') as mockMethod: mockMethod.return_value.status_code = 200 cqi = CyberQInterface("127.0.0.1") self.assertEqual( cqi.sendUpdate({ 'FOOD1_NAME': "Tri-Tip Roast", 'FOOD1_SET': '140', 'COOK_SET': '300' }), True)