def test__irmc_redfish_patch__bad_etag(self, patch):
     requests.Session.patch.return_value = self.mockdata
     etag = "abcde"
     status, data, msg = irmc.irmc_redfish_patch(self.mod, "redfish_path", json.dumps({'Patch': 'mockpatch'}), etag)
     self.assertEqual(97, status)
     self.assertEqual("etag is no number: " + etag, data)
     self.assertEqual("etag is no number: " + etag, msg)
 def test__irmc_redfish_patch__bad_status_without_reason(self, patch):
     requests.Session.patch.return_value = self.mockdata
     self.mockdata.status_code = 100
     status, data, msg = irmc.irmc_redfish_patch(self.mod, "redfish_path", json.dumps({'Patch': 'mockpatch'}), 12345)
     self.assertEqual(self.mockdata.status_code, status)
     self.assertEqual(self.mockdata.json.return_value, data.json.return_value)
     self.assertEqual("PATCH request was not successful (" + self.url + "), status " + str(status) + ".", msg)
 def test__irmc_redfish_patch__etag_is_extra_large(self, patch):
     requests.Session.patch.return_value = self.mockdata
     status, data, msg = irmc.irmc_redfish_patch(self.mod, "redfish_path", json.dumps({'Patch': 'mockpatch'}),
                                                 1234567890123456789)
     self.assertEqual(self.mockdata.status_code, status)
     self.assertEqual(self.mockdata.json.return_value, data.json.return_value)
     self.assertEqual("OK", msg)
 def test__irmc_redfish_patch__exception(self, patch):
     requests.Session.patch.side_effect = Timeout()
     status, data, msg = irmc.irmc_redfish_patch(self.mod, "redfish_path", json.dumps({'Patch': 'mockpatch'}), 12345)
     self.assertEqual(99, status)
     self.assertIn("Traceback", str(data))
     self.assertIn("PATCH request encountered exception (" + self.url + ")", msg)
 def test__irmc_redfish_patch__bad_body(self, patch):
     requests.Session.patch.return_value = self.mockdata
     status, data, msg = irmc.irmc_redfish_patch(self.mod, "redfish_path", "{ 'Patch': 'mockpatch' }", 12345)
     self.assertEqual(98, status)
     self.assertIn("Traceback", str(data))
     self.assertIn("PATCH request got invalid JSON body", msg)