Example #1
0
def test_jira_match_does_async(reactor):
    client = Mock()
    settings_stub.JIRA_SHOW_FULL_DESCRIPTION = True
    urls = {'foo-123': 'http://example.com/foo-123'}
    expected_call = call(0, jira.jira_full_descriptions, client, '#bots', urls)
    with pytest.raises(ResponseNotReady):
        jira.jira_match(client, '#bots', 'me', 'ticket foo-123', ['foo-123'])
        assert reactor.callLater.call_args == expected_call
Example #2
0
def test_jira_match_does_async(reactor):
    client = Mock()
    settings_stub.JIRA_SHOW_FULL_DESCRIPTION = True
    urls = {'foo-123': 'http://example.com/foo-123'}
    expected_call = call(0, jira.jira_full_descriptions, client, '#bots', urls)
    with pytest.raises(ResponseNotReady):
        jira.jira_match(client, '#bots', 'me', 'ticket foo-123', ['foo-123'])
        assert reactor.callLater.call_args == expected_call
Example #3
0
def test_jira_match_handles_unicode():
    snowman = u'☃'
    expected = u'me might be talking about JIRA ticket: http://example.com/{0}'.format(
        snowman)
    response = jira.jira_match(None, '#bots', 'me',
                               u'this is about {0}'.format(snowman), [snowman])
    assert response == expected
Example #4
0
def test_jira_match_multiple():
    resp = jira.jira_match(None, '#bots', 'me', 'foo-123 and bar-456', ['foo-123', 'bar-456'])
    assert 'http://example.com/foo-123' in resp
    assert 'http://example.com/bar-456' in resp
Example #5
0
def test_jira_match():
    expected = 'me might be talking about JIRA ticket: http://example.com/foo-123'
    assert expected == jira.jira_match(None, '#bots', 'me', 'this is about foo-123', ['foo-123'])
Example #6
0
def test_jira_match_handles_unicode():
    snowman = u'☃'
    expected = u'me might be talking about JIRA ticket: http://example.com/{0}'.format(snowman)
    response = jira.jira_match(None, '#bots', 'me', u'this is about {0}'.format(snowman), [snowman])
    assert response == expected
Example #7
0
def test_jira_match_multiple():
    resp = jira.jira_match(None, "#bots", "me", "foo-123 and bar-456", ["foo-123", "bar-456"])
    assert "http://example.com/foo-123" in resp
    assert "http://example.com/bar-456" in resp
Example #8
0
def test_jira_match():
    expected = "me might be talking about JIRA ticket: http://example.com/foo-123"
    assert expected == jira.jira_match(None, "#bots", "me", "this is about foo-123", ["foo-123"])
Example #9
0
def test_jira_match_multiple():
    resp = jira.jira_match(None, '#bots', 'me', 'foo-123 and bar-456',
                           ['foo-123', 'bar-456'])
    assert 'http://example.com/foo-123' in resp
    assert 'http://example.com/bar-456' in resp
Example #10
0
def test_jira_match():
    expected = 'me might be talking about JIRA ticket: http://example.com/foo-123'
    assert expected == jira.jira_match(None, '#bots', 'me',
                                       'this is about foo-123', ['foo-123'])