Skip to content

Commit

Permalink
Add test for finding a ticket
Browse files Browse the repository at this point in the history
  • Loading branch information
Alina Mackenzie committed Nov 15, 2015
1 parent 8df5298 commit 4686793
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test_requesttracker.py
Expand Up @@ -17,3 +17,28 @@ class TestRT(object):
def test_configuration(self, testbot):
testbot.push_message('!plugin config RT ' + str(RT_CONFIG))
assert 'Plugin configuration done.' in testbot.pop_message()

def test_find_ticket(self, testbot):
test_subject = 'err-request-tracker'
test_requestor = 'foo@example.com'

testbot.push_message('!plugin config RT ' + str(RT_CONFIG))
assert 'Plugin configuration done.' in testbot.pop_message()

tracker = rt.Rt(RT_CONFIG['REST_URL'])
tracker.login(RT_CONFIG['USER'], RT_CONFIG['PASSWORD'])

try:
ticket_id = tracker.create_ticket(Queue='General',
Subject=test_subject,
Requestors=test_requestor)
ticket = tracker.get_ticket(ticket_id)
except Exception as e:
raise Exception("Unable to create a test ticket: " + str(e))

testbot.push_message(str(ticket_id))
assert "%s (%s%s) in General from %s" % (
test_subject,
RT_CONFIG['DISPLAY_URL'],
str(ticket_id),
test_requestor) in testbot.pop_message()

0 comments on commit 4686793

Please sign in to comment.