我很开心哦,呵呵!","comments":5,"created_on":"2008-01-30 15:59:00+08"}
]
--- response
{"last_row":"/=/model/Post/id/3","rows_affected":3,"success":1}
=== TEST 8: Create a feed without "view"
--- request
POST /=/feed/Post
{
"description": "View for post feeds",
"author": "agentzh",
"link": "http://blog.agentzh.org",
"copyright": "Copyright 2008 by Agent Zhang",
"language": "en",
"title": "Human & Machine"
}
--- response
{"error":"No 'view' specified.","success":0}
=== TEST 9: Create a feed with an undefined view
--- request
POST /=/feed/Post
{
"description": "View for post feeds",
"author": "agentzh",
"link": "http://blog.agentzh.org",
"copyright": "Copyright 2008 by Agent Zhang",
"language": "en",
"title": "Human & Machine",
"view": "Blah"
}
--- response
{"error":"View \"Blah\" not found.","success":0}
=== TEST 10: Create a view
--- request
POST /=/view/PostFeed
{
"description": "View for post feeds",
"definition": "select author, title, 'http://blog.agentzh.org/#post-' || id as link, content, created_on as published, 'http://blog.agentzh.org/#post-' || id || ':comments' as comments from Post order by created_on desc limit $count | 20"
}
--- response
{"success":1}
=== TEST 11: Create a feed without link
--- request
POST /=/feed/Post
{
"description": "Feed for blog posts",
"author": "agentzh",
"copyright": "Copyright 2008 by Agent Zhang",
"language": "en",
"title": "Human & Machine",
"view": "PostFeed"
}
--- response
{"error":"No 'link' specified.","success":0}
=== TEST 12: Create a feed successfully
--- request
POST /=/feed/Post
{
"description": "Feed for blog posts",
"author": "agentzh",
"link": "http://blog.agentzh.org",
"copyright": "Copyright 2008 by Agent Zhang",
"language": "en",
"title": "Human & Machine - Blog posts",
"view": "PostFeed",
"logo": "http://localhost/Blog/out/me.jpg"
}
--- response
{"success":1}
=== TEST 13: Try to create a feed twice
--- request
POST /=/feed/Post
{
"description": "Feed for blog posts",
"author": "agentzh",
"link": "http://blog.agentzh.org",
"copyright": "Copyright 2008 by Agent Zhang",
"language": "en",
"title": "Human & Machine - Blog posts",
"view": "PostFeed"
}
--- response
{"error":"Feed \"Post\" already exists.","success":0}
=== TEST 14: Get the feed list
--- request
GET /=/feed
--- response
[{"src":"/=/feed/Post","name":"Post","description":"Feed for blog posts"}]
=== TEST 15: Get the "Post" feed
--- request
GET /=/feed/Post
--- response
{
"name":"Post",
"description":"Feed for blog posts",
"author":"agentzh",
"link":"http://blog.agentzh.org",
"copyright":"Copyright 2008 by Agent Zhang",
"language":"en",
"logo":"http://localhost/Blog/out/me.jpg",
"title":"Human & Machine - Blog posts",
"view":"PostFeed"
}
=== TEST 16: Obtain the feed content (XML)
--- request
GET /=/feed/Post/~/~
--- res_type: application/rss+xml; charset=utf-8
--- format: feed
--- response
Human & Machine - Blog posts
http://blog.agentzh.org
enCopyright 2008 by Agent ZhangOpenResty RSS Feed WriterXXXXXXhttp://localhost/Blog/out/me.jpg
http://blog.agentzh.org
Human & Machine - Blog postsHello, world
http://blog.agentzh.org/#post-1
<h1>This is my first program ;)</h1>agentzhhttp://blog.agentzh.org/#post-1:comments2008-03-12T15:20:00Zhttp://blog.agentzh.org/#post-1I'm going home
http://blog.agentzh.org/#post-2
<h1>At last, I'm home again! Yay!</h1>carriehttp://blog.agentzh.org/#post-2:comments2008-02-29T20:03:00Zhttp://blog.agentzh.org/#post-2我来了呀!
http://blog.agentzh.org/#post-3
<h1>呵呵,我<B>回来</B>了!</h1>我很开心哦,呵呵!章亦春http://blog.agentzh.org/#post-3:comments2008-01-30T15:59:00Zhttp://blog.agentzh.org/#post-3
=== TEST 17: Obtain the feed content using param (XML)
--- request
GET /=/feed/Post/count/1
--- res_type: application/rss+xml; charset=utf-8
--- format: feed
--- response
Human & Machine - Blog posts
http://blog.agentzh.org
enCopyright 2008 by Agent ZhangOpenResty RSS Feed WriterXXXXXXhttp://localhost/Blog/out/me.jpg
http://blog.agentzh.org
Human & Machine - Blog postsHello, world
http://blog.agentzh.org/#post-1
<h1>This is my first program ;)</h1>agentzhhttp://blog.agentzh.org/#post-1:comments2008-03-12T15:20:00Zhttp://blog.agentzh.org/#post-1
=== TEST 18: security hole suggested by laser++
--- debug: 1
--- request
GET /=/feed/Post/count/*
--- response
{"success":0,"error":"invalid input syntax for integer: \"*\""}
=== TEST 19: security hole suggested by laser++
--- debug: 0
--- request
GET /=/feed/Post/count/*
--- response
{"success":0,"error":"Operation failed."}
=== TEST 20: another security hole suggested by laser++
--- request
GET /=/feed/Post/count/-1
--- response
{"success":0,"error":"No entries found"}
=== TEST 21: Create another feed
--- request
POST /=/feed/Comment
{
"description": "Feed for blog comments",
"link": "http://blog.agentzh.org",
"copyright": "Copyright by the individual commment senders",
"language": "en",
"title": "Human & Machine - Blog comments",
"view": "PostFeed"
}
--- response
{"success":1}
=== TEST 22: Get the feed list again
--- request
GET /=/feed
--- response
[
{"src":"/=/feed/Post","name":"Post","description":"Feed for blog posts"},
{"src":"/=/feed/Comment","name":"Comment","description":"Feed for blog comments"}
]
=== TEST 23: Update some slots of the Comment feed
--- request
PUT /=/feed/Comment
{"language":"cn", "title":"Comments"}
--- response
{"success":1}
=== TEST 24: check the Comment feed
--- request
GET /=/feed/Comment
--- response
{
"link":"http://blog.agentzh.org",
"language":"cn",
"copyright":"Copyright by the individual commment senders",
"name":"Comment",
"author":null,
"description":"Feed for blog comments",
"view":"PostFeed",
"logo":null,
"title":"Comments"
}
=== TEST 25: Update all the slots
--- request
PUT /=/feed/Comment
{
"name": "Comment2",
"description": "Feed for blog comments2",
"link": "http://blog2.agentzh.org",
"copyright": "Copyright2 by the individual commment senders",
"language": "zh-CN",
"title": "Human & Machine2",
"view": "PostFeed",
"author":"agentzh",
"logo":"me.jpg"
}
--- response
{"success":1}
=== TEST 26: check the Comment2 feed
--- request
GET /=/feed/Comment2
--- response
{
"name": "Comment2",
"description": "Feed for blog comments2",
"link": "http://blog2.agentzh.org",
"copyright": "Copyright2 by the individual commment senders",
"language": "zh-CN",
"title": "Human & Machine2",
"view": "PostFeed",
"author":"agentzh",
"logo":"me.jpg"
}
=== TEST 27: Delete feed Comment
--- request
DELETE /=/feed/Comment
--- response
{"success":0,"error":"Feed \"Comment\" not found."}
=== TEST 28: Delete feed Comment2
--- request
DELETE /=/feed/Comment2
--- response
{"success":1}
=== TEST 29: Get the feed list again
--- request
GET /=/feed
--- response
[
{"src":"/=/feed/Post","name":"Post","description":"Feed for blog posts"}
]
=== TEST 30: Delete feed Comment again
--- request
DELETE /=/feed/Comment
--- response
{"error":"Feed \"Comment\" not found.","success":0}
=== TEST 31: logout
--- request
GET /=/logout
--- response
{"success":1}