コード例 #1
0
def setup():
    command = Command.from_JSON(command_string)
コード例 #2
0
def test_to_json():
    command.username = '******'
    to_json_command = Command.from_JSON(Command.to_JSON(command))
    assert to_json_command.username == 'some-user'
コード例 #3
0
def test_no_exit_status():
    no_exit_status = Command.from_JSON(no_exit_status_string)
    assert no_exit_status.exit_status == None
コード例 #4
0
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":"******","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":"******","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 = '******'
    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