示例#1
0
def test_get_photo_with_basic_authetication(mock_get):
    photos = Photos('http://example.com/%PHOTO%.jpg', username='******')
    photos.clear()
    content, content_type = photos.get('theodore')
    mock_get.assert_called_with('http://example.com/theodore.jpg',
        headers={},
        auth=('token', str('')))
示例#2
0
def test_get_photo_without_basic_authetication(mock_get):
    photos = Photos('https://api.github.com/repos/_organisation_/_repository_/contents/photos/%PHOTO%.jpg')
    photos.clear()
    content, content_type = photos.get('theodore')
    mock_get.assert_called_with(
        'https://api.github.com/repos/_organisation_/_repository_/contents/photos/theodore.jpg',
        headers={'Accept': 'application/vnd.github.VERSION.raw'},
        auth=None)
    assert content_type == 'image/jpeg'