def test_get_ticket_children(get, loads): get.return_value.status_code = 200 centipede = Centipede('http://centipede') ret = centipede.get_ticket_children('US123') assert_called_once(get, ('http://centipede/tickets/US123/tickets/',)) assert_equal([((get.return_value.content,), {})], loads.call_args_list) assert_equal(loads.return_value, ret)
def test_get_ticket_children(get, loads): get.return_value.status_code = 200 centipede = Centipede('http://centipede') ret = centipede.get_ticket_children('US123') assert_called_once(get, ('http://centipede/tickets/US123/tickets/', )) assert_equal([((get.return_value.content, ), {})], loads.call_args_list) assert_equal(loads.return_value, ret)
def view_ticket(request, ticket_id): centipede = Centipede(settings.CENTIPEDE_URL) ticket_dict = centipede.get_ticket(ticket_id) try: ticket_dict['children'] = centipede.get_ticket_children(ticket_id) except DeadbeatTicket: pass return render_to_response('tickets/view.html', ticket_dict)
def test_get_ticket_children_unsupported(get): get.return_value.status_code = 404 centipede = Centipede('http://centipede') assert_raises(DeadbeatTicket, centipede.get_ticket_children, 'US123')