예제 #1
0
파일: test_mac.py 프로젝트: zmole945/PyKMIP
    def test_read_valid(self):
        stream = self.encoding_full
        payload = payloads.MACResponsePayload()
        payload.read(stream)

        self.assertEqual(self.unique_identifier, payload.unique_identifier)
        self.assertEqual(self.mac_data, payload.mac_data)
예제 #2
0
파일: test_mac.py 프로젝트: zmole945/PyKMIP
    def test_write_valid(self):
        expected = self.encoding_full

        stream = utils.BytearrayStream()
        payload = payloads.MACResponsePayload(self.unique_identifier,
                                              self.mac_data)
        payload.write(stream)

        self.assertEqual(expected, stream)
예제 #3
0
파일: test_mac.py 프로젝트: zmole945/PyKMIP
 def test_init_valid(self):
     """
     Test that the payload can be properly constructed and the attributes
     can be properly set and retrieved.
     """
     payload = payloads.MACResponsePayload(self.unique_identifier,
                                           self.mac_data)
     self.assertEqual(payload.unique_identifier, self.unique_identifier)
     self.assertEqual(payload.mac_data, self.mac_data)
예제 #4
0
파일: test_mac.py 프로젝트: zmole945/PyKMIP
 def test_read_no_mac_data(self):
     """
     Test that an InvalidKmipEncoding error gets raised when attempting to
     read a mac response encoding with no mac data.
     """
     payload = payloads.MACResponsePayload()
     args = (self.encoding_no_mac_data, )
     self.assertRaisesRegexp(exceptions.InvalidKmipEncoding,
                             "expected mac response mac data not found",
                             payload.read, *args)
예제 #5
0
파일: test_mac.py 프로젝트: zmole945/PyKMIP
 def test_write_with_no_data(self):
     """
     Test that an InvalidField error gets raised when attempting to
     write a mac response with no mac data.
     """
     stream = utils.BytearrayStream()
     payload = payloads.MACResponsePayload(self.unique_identifier, None)
     args = (stream, )
     self.assertRaisesRegexp(exceptions.InvalidField,
                             "The mac response mac data is required",
                             payload.write, *args)
예제 #6
0
 def test_read_no_unique_identifier(self):
     """
     Test that an InvalidKmipEncoding error gets raised when attempting to
     read a mac response encoding with no unique identifier.
     """
     payload = payloads.MACResponsePayload()
     args = (self.encoding_no_unique_identifier, )
     self.assertRaisesRegex(
         exceptions.InvalidKmipEncoding,
         "expected mac response unique identifier not found", payload.read,
         *args)
예제 #7
0
파일: response.py 프로젝트: zmole945/PyKMIP
 def _create_mac_payload(self):
     return payloads.MACResponsePayload()
예제 #8
0
파일: test_mac.py 프로젝트: zmole945/PyKMIP
 def test_init_with_none(self):
     payloads.MACResponsePayload()