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", )
def test_str_no_password(self): """Test string representation of FramePasswordChangeNotification with no password.""" frame = FramePasswordChangeNotification() self.assertEqual( str(frame), '<FramePasswordChangeNotification newpassword="******"/>')
def test_str(self): """Test string representation of FramePasswordChangeNotification.""" frame = FramePasswordChangeNotification(newpassword="******") self.assertEqual( str(frame), '<FramePasswordChangeNotification newpassword="******"/>')
def test_errors(self): """Test FramePasswordChangeNotification with wrong password.""" with self.assertRaises(PyVLXException): bytes(FramePasswordChangeNotification()) with self.assertRaises(PyVLXException): bytes(FramePasswordChangeNotification(newpassword="******" * 33))
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")