Example #1
0
def test_data_model():
    strio = StringIO(
        u"-User(tos,hash,eq)\nid:i;url:[u;title;author:r;follows(type=Follow):[r;counts:[i;created:di;realname\n"
    )
    sys.stdin = strio
    text = generate("model")
    print(text)
Example #2
0
def test_with_underscore():
    strio = StringIO(u"""
MyDay(tos)
id;udid;group_id:i;date:di;memo;color;status:i;countdown_enabled:b;cover;pics;extras:j
    """)
    sys.stdin = strio
    text = generate("model")
    print(text)
Example #3
0
def test_form():
    strio = StringIO(u"""
    UserEditor(m=User)
    _:c;label:l;name(required):f;button:b;view:v;imageView:i;field:f;addr:tc
    """)
    sys.stdin = strio
    output = generate("form")
    print(output)
Example #4
0
def test_dao2():
    strio = StringIO("""
-MyDay
id;udid;group_id:i;date:di;memo;color;status:i;countdown_enabled:b;cover;pics;extras:j
        """)
    sys.stdin = strio
    text = generate('dao')
    print(text)
Example #5
0
def test_dao1():
    strio = StringIO("""
         -ClockRecord
        id:i;created:d;last_modified:d;clock_time:d;type:i;memo;props:j
        """)
    sys.stdin = strio
    text = generate('dao')
    print(text)
Example #6
0
def test_bxrouter1():
    strio = StringIO(u"""
-ApiRouter(prefix=api/appShop)
/api/appShop/registerPush?deviceToken=
/api/appShop/index
    """)
    sys.stdin = strio
    output = generate('router')
    print(output)
Example #7
0
def test_no_model():
    strio = StringIO(u'''
    /v1/signup(params,c=注册):post
    /v1/login(params,c=登录):post
    /v1/token/refresh/(params,c=更新Token):patch
    v1/logout/?login_id(c=注销登录):delete
    ''')
    sys.stdin = strio
    output = generate('router')
    print(output)
Example #8
0
def test_button_group():
    strio = StringIO("""
    -AccountCell(m=Account):button_group
    edit(title=设置库存):ob
    del(title=取消代理):ob
    update(title=取消代理):b
    """)
    sys.stdin = strio
    text = generate('button_group')
    print(text)
Example #9
0
def test_bxrouter_01():
    strio = StringIO(u'''
    -CommonApiRouter(prefix=v1)\n
    /v1/signup(params,c=注册):post
    /v1/login(params,c=登录):post
    /v1/token/refresh/(params,c=更新Token):patch
    v1/logout/?login_id(c=注销登录):delete
    ''')
    sys.stdin = strio
    output = generate('router')
    print(output)
Example #10
0
def test_const():
    strio = StringIO(u"-User\nvideo;list;table;text;picture")
    sys.stdin = strio
    text = generate('const')
    print(text)
Example #11
0
def test_refModel():
    strio = StringIO(u"-ShopCard\nshopCardBase:r;shopCardLog(field=logs):[r\n")
    sys.stdin = strio
    text = generate("model")
    print(text)