def test_0120_comment_handler_post_1(self): """ Test the CommentHandler POST method """ ticket = Ticket( subject = "Testing", message = "Sample testing", status = "new", user = self.user, assigned_to = self.user, comment = [] ) ticket.save() response = self.fetch( '/ticket/%s/comment' % ticket.id, method="POST", follow_redirects=False, body=urlencode({ 'comment' : 'Tickets testing', 'status' : 'new', }), headers={ 'Cookie': self.get_login_cookie() }, ) self.assertEqual(response.code, 302)
def test_0040_tickethandler_get_1(self): """ Test the Ticket handler get method without logged in """ ticket = Ticket( subject = "Testing", message = "Sample testing", status = "new", user = self.user, assigned_to = self.user, comment = [] ) ticket.save() response = self.fetch( '/ticket/%s' % ticket.id, method="GET", follow_redirects=False, ) self.assertEqual(response.code, 302)
def test_0050_tickethandler_get_2(self): """ Test the Ticket handler get method with logged in with correct ticket Id """ ticket = Ticket( subject = "Testing", message = "Sample testing", status = "new", user = self.user, assigned_to = self.user, comment = [] ) ticket.save() response = self.fetch( '/ticket/%s' % ticket.id, method="GET", follow_redirects=False, headers={ 'Cookie': self.get_login_cookie() }, ) self.assertEqual(response.code, 200)
def test_0020_ticketlisthandler_get_2(self): """ Test the TicketList handler with logged in and HTML response with pagination (Render first page with 10 tickets) """ for i in xrange(0, 100): ticket = Ticket( subject = "Testing", message = "Sample testing", status = "new", user = self.user, assigned_to = self.user, comment = [] ) ticket.save() response = self.fetch( '/ticket-list', method="GET", follow_redirects=False, headers={ 'Cookie': self.get_login_cookie() } ) self.assertEqual(response.code, 200)