Пример #1
0
def test_rest_desc_handles_unicode(requests):
    snowman = u'☃'
    response = Mock()
    response.json.return_value = {
        'fields': {
            'summary': snowman,
        },
    }
    requests.get.return_value = response

    assert jira._rest_desc(snowman, snowman) == u'[{0}] {0} ({0})'.format(snowman)

    response.json.side_effect = Exception
    assert jira._rest_desc(snowman, snowman) == u'[{0}] {0}'.format(snowman)
Пример #2
0
def test_rest_desc_handles_unicode(requests):
    snowman = u'☃'
    response = Mock()
    response.json.return_value = {
        'fields': {
            'summary': snowman,
        },
    }
    requests.get.return_value = response

    assert jira._rest_desc(snowman,
                           snowman) == u'[{0}] {0} ({0})'.format(snowman)

    response.json.side_effect = Exception
    assert jira._rest_desc(snowman, snowman) == u'[{0}] {0}'.format(snowman)
Пример #3
0
def test_rest_desc(requests):
    response = Mock()
    response.json.return_value = {
        'fields': {
            'summary': 'title',
        },
    }
    requests.get.return_value = response

    assert jira._rest_desc('foo', 'url') == '[FOO] title (url)'
Пример #4
0
def test_rest_desc(requests):
    response = Mock()
    response.json.return_value = {
        'fields': {
            'summary': 'title',
        },
    }
    requests.get.return_value = response

    assert jira._rest_desc('foo', 'url') == '[FOO] title (url)'
Пример #5
0
def test_rest_desc_without_summary(requests):
    response = Mock()
    response.json.side_effect = Exception
    requests.get.return_value = response

    assert jira._rest_desc('foo', 'url') == '[FOO] url'
Пример #6
0
def test_rest_desc_request_error(requests):
    response = Mock()
    response.raise_for_status.side_effect = Exception
    requests.get.return_value = response
    assert jira._rest_desc('foo', 'url') is None
Пример #7
0
def test_rest_desc_without_summary(requests):
    response = Mock()
    response.json.side_effect = Exception
    requests.get.return_value = response

    assert jira._rest_desc('foo', 'url') == '[FOO] url'
Пример #8
0
def test_rest_desc_request_error(requests):
    response = Mock()
    response.raise_for_status.side_effect = Exception
    requests.get.return_value = response
    assert jira._rest_desc('foo', 'url') is None