Beispiel #1
0
 def test_str_no_password(self):
     """Test string representation of FramePasswordChangeRequest with no password."""
     frame = FramePasswordChangeRequest()
     self.assertEqual(
         str(frame),
         '<FramePasswordChangeRequest currentpassword="******" newpassword="******"/>'
     )
Beispiel #2
0
 def test_str(self):
     """Test string representation of FramePasswordChangeRequest."""
     frame = FramePasswordChangeRequest(currentpassword="******",
                                        newpassword="******")
     self.assertEqual(
         str(frame),
         '<FramePasswordChangeRequest currentpassword="******" newpassword="******"/>'
     )
Beispiel #3
0
 def test_bytes_long_bothpw(self):
     """Test FramePasswordChangeRequest with long passwords."""
     frame = FramePasswordChangeRequest(currentpassword="******" * 32,
                                        newpassword="******" * 32)
     self.assertEqual(
         bytes(frame),
         b"\x00C0\x02xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyq"
     )
Beispiel #4
0
 def test_errors(self):
     """Test FramePasswordChangeRequest with wrong password."""
     with self.assertRaises(PyVLXException):
         bytes(FramePasswordChangeRequest())
     with self.assertRaises(PyVLXException):
         bytes(FramePasswordChangeRequest(currentpassword="******"))
     with self.assertRaises(PyVLXException):
         bytes(
             FramePasswordChangeRequest(currentpassword="******",
                                        newpassword="******" * 33))
     with self.assertRaises(PyVLXException):
         bytes(
             FramePasswordChangeRequest(newpassword="******",
                                        currentpassword="******" * 33))
     with self.assertRaises(PyVLXException):
         bytes(
             FramePasswordChangeRequest(newpassword="******" * 33,
                                        currentpassword="******" * 33))
Beispiel #5
0
 def test_bytes_long_oldpw(self):
     """Test FramePasswordChangeRequest with long old password."""
     frame = FramePasswordChangeRequest(currentpassword="******" * 32,
                                        newpassword="******")
     self.assertEqual(
         bytes(frame),
         b"\x00C0\x02xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxbfeld\x00\x00\x00" +
         b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x18"
     )
Beispiel #6
0
 def test_bytes_long_newpw(self):
     """Test FramePasswordChangeRequest with long new password."""
     frame = FramePasswordChangeRequest(currentpassword="******",
                                        newpassword="******" * 32)
     self.assertEqual(
         bytes(frame),
         b"\x00C0\x02fnord\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" +
         b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\x00"
     )
Beispiel #7
0
 def test_bytes(self):
     """Test FramePasswordChangeRequest."""
     frame = FramePasswordChangeRequest(currentpassword="******",
                                        newpassword="******")
     self.assertEqual(
         bytes(frame),
         b"\x00C0\x02fnord\x00\x00\x00\x00\x00\x00\x00\x00" +
         b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" +
         b"\x00\x00\x00\x00\x00\x00\x00bfeld\x00\x00\x00\x00" +
         b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" +
         b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00i",
     )