forked from rcaloras/bashhub-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_command.py
More file actions
24 lines (15 loc) · 1.06 KB
/
Copy pathtest_command.py
File metadata and controls
24 lines (15 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from bashhub.model import Command
command_string = '{"command":"vim bashhub/model/min_command.py","path":"/home/elementz/git/bashhub-client","created":1438653799957,"uuid":"4e7860d4-19e7-4e72-9bf5-f76f3f78d60d","exitStatus":0,"username":"rccola","systemName":"Kashmir","sessionId":"55c00b6ae4b0e2abc9bc0da1"}'
no_exit_status_string = '{"command":"vim bashhub/model/min_command.py","path":"/home/elementz/git/bashhub-client","created":1438653799957,"uuid":"4e7860d4-19e7-4e72-9bf5-f76f3f78d60d","username":"rccola","systemName":"Kashmir","sessionId":"55c00b6ae4b0e2abc9bc0da1"}'
command = Command.from_JSON(command_string)
def setup():
command = Command.from_JSON(command_string)
def test_from_json():
assert command.path == '/home/elementz/git/bashhub-client'
def test_to_json():
command.username = 'some-user'
to_json_command = Command.from_JSON(Command.to_JSON(command))
assert to_json_command.username == 'some-user'
def test_no_exit_status():
no_exit_status = Command.from_JSON(no_exit_status_string)
assert no_exit_status.exit_status == None