def test_construct_message(self): bug = AttrDict({'summary': 'some issue subject', 'weburl': 'http://bz.example.com/1'}) nick = 'ktdreyer' result = construct_message([bug], nick) expected = ('ktdreyer might be talking about ' 'http://bz.example.com/1 [some issue subject]') assert result == expected
def test_two_tickets(self): bugs = [] bugs.append(AttrDict({'summary': 'some issue subject', 'weburl': 'http://bz.example.com/1'})) bugs.append(AttrDict({'summary': 'another issue subject', 'weburl': 'http://bz.example.com/2'})) nick = 'ktdreyer' result = construct_message(bugs, nick) expected = ('ktdreyer might be talking about ' 'http://bz.example.com/1 [some issue subject] and ' 'http://bz.example.com/2 [another issue subject]') assert result == expected
def test_four_tickets(self): """ Verify that commas "," and "and" get put in the right places. """ bugs = [] bugs.append(AttrDict({'summary': 'subj 1', 'weburl': 'http://bz.example.com/1'})) bugs.append(AttrDict({'summary': 'subj 2', 'weburl': 'http://bz.example.com/2'})) bugs.append(AttrDict({'summary': 'subj 3', 'weburl': 'http://bz.example.com/3'})) bugs.append(AttrDict({'summary': 'subj 4', 'weburl': 'http://bz.example.com/4'})) nick = 'ktdreyer' result = construct_message(bugs, nick) expected = ('ktdreyer might be talking about ' 'http://bz.example.com/1 [subj 1], ' 'http://bz.example.com/2 [subj 2], ' 'http://bz.example.com/3 [subj 3] and ' 'http://bz.example.com/4 [subj 4]') assert result == expected