test of ticket/create

This commit is contained in:
jysperm
2014-10-30 10:34:39 +08:00
parent cf226677c2
commit e43f42d2ed
4 changed files with 40 additions and 10 deletions

View File

@@ -92,7 +92,7 @@
"day": "Day"
},
"notification_title": {
"ticket": "<%= title %> | Ticket"
"ticket": "__title__ | Ticket"
},
"view": {
"layout": {

View File

@@ -99,7 +99,7 @@
"day": "天"
},
"notification_title": {
"ticket": "<%= title %> | 工单"
"ticket": "__title__ | 工单"
},
"view": {
"layout": {

View File

@@ -62,8 +62,9 @@ exports.post '/create', (req, res) ->
id: ticket._id
notification.createGroupNotice 'root', 'ticket_create',
title: _.template(res.t('notification_title.ticket')) ticket
body: _.template(app.template_data['ticket_create_email'])
title: res.t 'notification_title.ticket', ticket
body: _.template(app.templates['ticket_create_email'])
t: res.t
ticket: ticket
account: req.account
config: config
@@ -91,8 +92,9 @@ exports.post '/reply/:id', (req, res) ->
_id: member_id
, (err, account) ->
notification.createNotice account, 'ticket_reply',
title: _.template(res.t('notification_title.ticket')) ticket
body: _.template(app.template_data['ticket_reply_email'])
title: res.t 'notification_title.ticket', ticket
body: _.template(app.templates['ticket_reply_email'])
t: res.t
ticket: ticket
reply: reply
account: req.account

View File

@@ -1,12 +1,40 @@
describe 'router/ticket', ->
it 'GET list'
agent = null
csrf_token = null
it 'GET create'
before ->
{agent, csrf_token} = namespace.accountRouter
it 'GET create with not logged', (done) ->
supertest app.express
.get '/ticket/create'
.redirects 0
.expect 302
.expect 'location', '/account/login/'
.end done
it 'GET create', (done) ->
agent.get '/ticket/create'
.expect 200
.end done
it 'POST create', (done) ->
agent.post '/ticket/create'
.send
csrf_token: csrf_token
title: 'Title'
content: '**CONTENT**'
.expect 200
.end (err, res) ->
created_objects.tickets.push res.body.id
done err
it 'GET list'
it 'GET view/:id'
it 'POST create'
it 'POST reply'
it 'GET list when replied'
it 'POST update_status'