示例#1
0
def test_form_url_servers_smt_xml():
    """Form the URL for all SMT servers in XML"""
    url = ifsrequest.__form_url('google', 'servers', server_type='smt')
    # all requests are in JSON, regardless of output format
    expected = ('https://susepubliccloudinfo.suse.com'
                '/v1/google/servers/smt.json')
    assert_equals(expected, url)
def test_all_frameworks():
    """As new frameworks are added, we smoketest the values"""
    frameworks = ['amazon', 'google', 'microsoft', 'oracle']
    for framework in frameworks:
        url = ifsrequest.__form_url(framework, 'images', region='dummy')
        expected = ('https://susepubliccloudinfo.suse.com'
                    '/v1/' + framework + '/dummy/images.json')
        assert_equals(expected, url)
示例#3
0
def test_region_is_url_quoted():
    """Region may contain spaces; it should be URL quoted"""
    url = ifsrequest.__form_url('microsoft', 'images', region='West US')
    expected = (
        'https://susepubliccloudinfo.suse.com'
        '/v1/microsoft/West%20US/images.json'
    )
    assert_equals(expected, url)
示例#4
0
def test_form_url_images_active_region_json():
    """Form the URL for active images in JSON format in a given region"""
    url = ifsrequest.__form_url('amazon',
                                'images',
                                result_format='json',
                                region='us-east-1',
                                image_state='active')
    expected = 'https://susepubliccloudinfo.suse.com/v1/'
    expected += 'amazon/us-east-1/images/active.json'
    assert_equals(expected, url)
示例#5
0
def test_form_url_images_active_region_json():
    """Form the URL for active images in JSON format in a given region"""
    url = ifsrequest.__form_url(
        'amazon',
        'images',
        result_format='json',
        region='us-east-1',
        image_state='active')
    expected = 'https://susepubliccloudinfo.suse.com/v1/'
    expected += 'amazon/us-east-1/images/active.json'
    assert_equals(expected, url)
示例#6
0
def test_region_is_url_quoted():
    """Region may contain spaces; it should be URL quoted"""
    url = ifsrequest.__form_url('microsoft', 'images', region='West US')
    expected = ('https://susepubliccloudinfo.suse.com'
                '/v1/microsoft/West%20US/images.json')
    assert_equals(expected, url)
示例#7
0
def test_form_url_images_all_xml():
    """Form URL for all images in XML format"""
    url = ifsrequest.__form_url('google', 'images')
    # all requests are in JSON, regardless of output format
    expected = 'https://susepubliccloudinfo.suse.com/v1/google/images.json'
    assert_equals(expected, url)
示例#8
0
def test_form_url_servers_all_json():
    """Form the URL for all servers in JSON format"""
    url = ifsrequest.__form_url('amazon', 'servers', 'json')
    expected = 'https://susepubliccloudinfo.suse.com/v1/amazon/servers.json'
    assert_equals(expected, url)
def test_form_url_providers_xml():
    """Form the URL for all providers in XML"""
    url = ifsrequest.__form_url('', 'providers')
    # all requests are in JSON, regardless of output format
    expected = ('https://susepubliccloudinfo.suse.com' '/v1/providers.json')
    assert_equals(expected, url)
def test_form_url_images_inactive():
    """Form URL for inactive images (defaults to JSON)"""
    url = ifsrequest.__form_url('microsoft', 'images', image_state='inactive')
    expected = ('https://susepubliccloudinfo.suse.com/v1/'
                'microsoft/images/inactive.json')
    assert_equals(expected, url)
def test_form_url_regions():
    """Form URL for regions list (defaults to JSON)"""
    url = ifsrequest.__form_url('amazon', 'regions')
    expected = ('https://susepubliccloudinfo.suse.com/v1/'
                'amazon/regions.json')
    assert_equals(expected, url)
def test_form_url_servers_types():
    """Form URL for servers types (defaults to JSON)"""
    url = ifsrequest.__form_url('microsoft', 'types')
    expected = ('https://susepubliccloudinfo.suse.com/v1/'
                'microsoft/servers/types.json')
    assert_equals(expected, url)
def test_form_url_images_states():
    """Form URL for image states (defaults to JSON)"""
    url = ifsrequest.__form_url('', 'states')
    expected = ('https://susepubliccloudinfo.suse.com/v1/'
                'images/states.json')
    assert_equals(expected, url)
示例#14
0
def test_form_url_images_all_xml():
    """Form URL for all images in XML format"""
    url = ifsrequest.__form_url('google', 'images')
    # all requests are in JSON, regardless of output format
    expected = 'https://susepubliccloudinfo.suse.com/v1/google/images.json'
    assert_equals(expected, url)
示例#15
0
def test_form_url_servers_smt_xml():
    """Form the URL for all SMT servers in XML"""
    url = ifsrequest.__form_url('hp', 'servers', server_type='smt')
    # all requests are in JSON, regardless of output format
    expected = 'https://susepubliccloudinfo.suse.com/v1/hp/servers/smt.json'
    assert_equals(expected, url)
示例#16
0
def test_form_url_servers_all_json():
    """Form the URL for all servers in JSON format"""
    url = ifsrequest.__form_url('amazon', 'servers', 'json')
    expected = 'https://susepubliccloudinfo.suse.com/v1/amazon/servers.json'
    assert_equals(expected, url)