mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-06-05 21:59:24 +02:00
Bug fix for loading model after loading a model duplicating the settings menu until the website is refreshed
Fixed escaping warnings Added back/redo unit test
This commit is contained in:
@ -170,3 +170,47 @@ def test_load_model_from_command_line(client_data, model, expected_load_options)
|
||||
|
||||
generate_story_data(client_data)
|
||||
|
||||
def test_back_redo(client_data):
|
||||
(client, app, socketio_client) = client_data
|
||||
|
||||
|
||||
#Make sure we have known story in the ui
|
||||
test_load_story_from_web_ui(client_data)
|
||||
|
||||
#Clear out any old messages
|
||||
response = socketio_client.get_received()
|
||||
|
||||
#run a back action
|
||||
socketio_client.emit('message',{'cmd': 'back', 'data': ''})
|
||||
response = socketio_client.get_received()[0]['args'][0]
|
||||
assert response == {'cmd': 'removechunk', 'data': 3}
|
||||
|
||||
#Run a redo action
|
||||
socketio_client.emit('message',{'cmd': 'redo', 'data': ''})
|
||||
response = socketio_client.get_received()[0]['args'][0]
|
||||
assert response == {'cmd': 'updatechunk', 'data': {'index': 3, 'html': '<chunk n="3" id="n3" tabindex="-1"> where to find the chicken and then how to make off with it.<br/><br/>A soft thud caused Niko to quickly lift his head. Standing behind the stall where the butcher had been cutting his chicken,</chunk>'}}
|
||||
|
||||
#Go all the way back, then all the way forward
|
||||
socketio_client.emit('message',{'cmd': 'back', 'data': ''})
|
||||
response = socketio_client.get_received()[0]['args'][0]
|
||||
assert response == {'cmd': 'removechunk', 'data': 3}
|
||||
socketio_client.emit('message',{'cmd': 'back', 'data': ''})
|
||||
response = socketio_client.get_received()[0]['args'][0]
|
||||
assert response == {'cmd': 'removechunk', 'data': 2}
|
||||
socketio_client.emit('message',{'cmd': 'back', 'data': ''})
|
||||
response = socketio_client.get_received()[0]['args'][0]
|
||||
assert response == {'cmd': 'removechunk', 'data': 1}
|
||||
socketio_client.emit('message',{'cmd': 'back', 'data': ''})
|
||||
response = socketio_client.get_received()[0]['args'][0]
|
||||
assert response == {'cmd': 'errmsg', 'data': 'Cannot delete the prompt.'}
|
||||
socketio_client.emit('message',{'cmd': 'redo', 'data': ''})
|
||||
socketio_client.emit('message',{'cmd': 'redo', 'data': ''})
|
||||
socketio_client.emit('message',{'cmd': 'redo', 'data': ''})
|
||||
response = socketio_client.get_received()
|
||||
assert response == [{'name': 'from_server', 'args': [{'cmd': 'updatescreen', 'gamestarted': True, 'data': '<chunk n="0" id="n0" tabindex="-1">Niko the kobold stalked carefully down the alley, his small scaly figure obscured by a dusky cloak that fluttered lightly in the cold winter breeze. Holding up his tail to keep it from dragging in the dirty snow that covered the cobblestone, he waited patiently for the butcher to turn his attention from his stall so that he could pilfer his next meal: a tender-looking</chunk><chunk n="1" id="n1" tabindex="-1"> chicken. He crouched just slightly as he neared the stall to ensure that no one was watching, not that anyone would be dumb enough to hassle a small kobold. What else was there for a lowly kobold to</chunk>'}], 'namespace': '/'}, {'name': 'from_server', 'args': [{'cmd': 'texteffect', 'data': 1}], 'namespace': '/'}, {'name': 'from_server', 'args': [{'cmd': 'updatechunk', 'data': {'index': 2, 'html': '<chunk n="2" id="n2" tabindex="-1"> do in a city? All that Niko needed to know was</chunk>'}}], 'namespace': '/'}, {'name': 'from_server', 'args': [{'cmd': 'texteffect', 'data': 2}], 'namespace': '/'}, {'name': 'from_server', 'args': [{'cmd': 'updatechunk', 'data': {'index': 3, 'html': '<chunk n="3" id="n3" tabindex="-1"> where to find the chicken and then how to make off with it.<br/><br/>A soft thud caused Niko to quickly lift his head. Standing behind the stall where the butcher had been cutting his chicken,</chunk>'}}], 'namespace': '/'}, {'name': 'from_server', 'args': [{'cmd': 'texteffect', 'data': 3}], 'namespace': '/'}]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user