Пример #1
0
def test_run_command():
    result = todo.run_command("test", {"abcd": "efgh", "hijk": "hlmk"})
    expected = """Command 'test' returns:
abcd:efgh
hijk:hlmk"""
    assert result == expected, result + "!=" + expected
    print("Ok-run_command")
Пример #2
0
def test_run_command():
    result = todo.run_command('test', {'abcd': 'efgh', 'ijkl': 'mnop'})
    expected = """Command 'test' returned:
abcd: efgh
ijkl: mnop"""
    assert result == expected, result + " != " + expected
    print "ok - run_command"
Пример #3
0
def test_run_command():
    result = todo.run_command("test",
                {"abcd": "efgh", "hijk": "hlmk"})
    expected = """Command 'test' returns:
abcd:efgh
hijk:hlmk"""
    assert result == expected, result +"!=" + expected
    print("Ok-run_command")
Пример #4
0
def test_run_command():
    result = todo.run_command('test', {'abcd': 'edfg', 'ijkl': 'mnlo'})
    expected = """Command 'test' returned:
    abcd: edfg
    ijkl: mnlo """
    print result
    assert result == expected, \
        result + " != " + expected
    print "ok - run command"
Пример #5
0
def test_run_command():
    result = todo.run_command(
        'test',
        {'abcd': 'efgh', 'ijkl': 'mnop'}
    )
    expected = """Command 'test' returned:
abcd: efgh
ijkl: mnop"""
    assert result == expected, result + " != " + expected
    print "ok - run_command"
Пример #6
0
def test_run_command():
    result = todo.run_command(
        'test',
        {'abcd': 'edfg', 'ijkl': 'mnlo'}
    )
    expected = """Command 'test' returned:
    abcd: edfg
    ijkl: mnlo """
    print result
    assert result == expected, \
        result + " != " + expected
    print "ok - run command"
Пример #7
0
def test_run_command():
    # Create "test" command
    result = todo.run_command(
        'test',
        {'abcd': 'efgh', 'ijkl': 'mnop'}        # Design by wishful thinking
    )
    expected = """Command 'test' returned:
abcd: efgh
ijkl: mnop"""
    assert result == expected, \
                    result + " != " + expected
    print "OK - run_commnad"
Пример #8
0
def handle_request(uri, method):
    value = clean_uri(uri)
    # list comprehension, you dumbass
    commands = {
            'GET': ['show',{'which':value}],
            'DELETE':['delete',{'which':value}],
            'POST':[],
            'PUT':[],
            }

    result = todo.run_command(commands[method][0],commands[method][1])

    output = sock.send(str(result) + "\n")