def test_str_no_password(self): """Test string representation of FramePasswordChangeRequest with no password.""" frame = FramePasswordChangeRequest() self.assertEqual( str(frame), '<FramePasswordChangeRequest currentpassword="******" newpassword="******"/>' )
def test_str(self): """Test string representation of FramePasswordChangeRequest.""" frame = FramePasswordChangeRequest(currentpassword="******", newpassword="******") self.assertEqual( str(frame), '<FramePasswordChangeRequest currentpassword="******" newpassword="******"/>' )
def test_bytes_long_bothpw(self): """Test FramePasswordChangeRequest with long passwords.""" frame = FramePasswordChangeRequest(currentpassword="******" * 32, newpassword="******" * 32) self.assertEqual( bytes(frame), b"\x00C0\x02xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyq" )
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))
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" )
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" )
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", )