コード例 #1
0
def test_json_handler_dict():
    data = json.dumps({'a':1,'b':2})
    json_file = cStringIO.StringIO(data)
    handler = JsonHandler(json_file)
    test_run = handler.run() 
    
    result = test_run.next()
    assert result['a'] == 1
    assert result['b'] == 2
コード例 #2
0
def test_json_handler_list():
    data = json.dumps([{'a':1,'b':2},{'a':3,'b':4}])
    json_file = cStringIO.StringIO(data)
    handler = JsonHandler(json_file)
    test_run = handler.run()
    
    result = test_run.next()
    assert result['a'] == 1
    assert result['b'] == 2
    
    result = test_run.next()
    assert result['a'] == 3
    assert result['b'] == 4