Ejemplo n.º 1
0
def test_can_load_index_missing_url(bundle_archive):
    cut = HTTPBundleLoader('index_url')
    with successful_get(
        {'test_bundle': {
            '1': {
                'hashes': {
                    'sha224': 'deadbeef'
                }
            }
        }}):
        assert not cut.can_load('test_bundle')
Ejemplo n.º 2
0
def test_can_load_in_index_with_releases_and_matching_version_provided():
    cut = HTTPBundleLoader('index_url')
    with successful_get({'test_bundle': {'1': {'url': 'http://some_host'}}}):
        assert cut.can_load('test_bundle', 1)
Ejemplo n.º 3
0
def test_cannot_load_not_in_index():
    cut = HTTPBundleLoader('index_url')
    with successful_get({}):
        assert not cut.can_load('test_bundle', 2)
Ejemplo n.º 4
0
def test_cannot_load_in_index_with_no_releases():
    cut = HTTPBundleLoader('index_url')
    with successful_get({'test_bundle': {}}):
        assert not cut.can_load('test_bundle', 2)
Ejemplo n.º 5
0
def test_can_load_in_index_with_releases_bad_bundle_info():
    cut = HTTPBundleLoader('index_url')
    with successful_get({'test_bundle': {'1': 'http://some_host'}}):
        assert not cut.can_load('test_bundle')
Ejemplo n.º 6
0
def test_cannot_load_in_index_with_releases_but_bad_url_no_version_provided():
    cut = HTTPBundleLoader('index_url')
    with successful_get({'test_bundle': {'1': 'http://'}}):
        assert not cut.can_load('test_bundle')
Ejemplo n.º 7
0
def test_error_response_on_index_load():
    cut = HTTPBundleLoader('index_url')
    with patch('requests.get') as get:
        get.status_code = 500
        assert not cut.can_load('test_bundle')