コード例 #1
0
 def test_bytes(self):
     """Test FramePasswordChangeNotification."""
     frame = FramePasswordChangeNotification(newpassword="******")
     self.assertEqual(
         bytes(frame),
         b"\x00#0\x04fnord\x00\x00\x00\x00\x00\x00" +
         b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" +
         b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00f",
     )
コード例 #2
0
 def test_str_no_password(self):
     """Test string representation of FramePasswordChangeNotification with no password."""
     frame = FramePasswordChangeNotification()
     self.assertEqual(
         str(frame),
         '<FramePasswordChangeNotification newpassword="******"/>')
コード例 #3
0
 def test_str(self):
     """Test string representation of FramePasswordChangeNotification."""
     frame = FramePasswordChangeNotification(newpassword="******")
     self.assertEqual(
         str(frame),
         '<FramePasswordChangeNotification newpassword="******"/>')
コード例 #4
0
 def test_errors(self):
     """Test FramePasswordChangeNotification with wrong password."""
     with self.assertRaises(PyVLXException):
         bytes(FramePasswordChangeNotification())
     with self.assertRaises(PyVLXException):
         bytes(FramePasswordChangeNotification(newpassword="******" * 33))
コード例 #5
0
 def test_bytes_long_pw(self):
     """Test FramePasswordChangeNotification with long new password."""
     frame = FramePasswordChangeNotification(newpassword="******" * 32)
     self.assertEqual(bytes(frame),
                      b"\x00#0\x04xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\x17")