def test_add_cancelled_validation_infra(appliance):
    """Tests that the flash message is correct when add is cancelled."""
    prov = VMwareProvider()
    prov.create(cancel=True)
    view = appliance.browser.create_view(InfraProvidersView)
    view.flash.assert_success_message(
        'Add of Infrastructure Provider was cancelled by the user')
Exemplo n.º 2
0
def test_ip_required_validation():
    """Test to validate the ip address while adding a provider"""
    prov = VMwareProvider(name=fauxfactory.gen_alphanumeric(5),
                          hostname=fauxfactory.gen_alphanumeric(5),
                          ip_address=None)

    with error.expected("IP Address can't be blank"):
        prov.create()
Exemplo n.º 3
0
def test_ip_max_character_validation():
    """Test to validate max character for ip address field"""
    prov = VMwareProvider(
        name=fauxfactory.gen_alphanumeric(5),
        hostname=fauxfactory.gen_alphanumeric(5),
        ip_address='10.10.10.14')
    prov.create()
    prov.delete(cancel=False)
Exemplo n.º 4
0
def test_host_name_max_character_validation_infra():
    """Test to validate max character for host name field"""
    endpoint = VirtualCenterEndpoint(hostname=fauxfactory.gen_alphanumeric(256))
    prov = VMwareProvider(name=fauxfactory.gen_alphanumeric(5), endpoints=endpoint)
    try:
        prov.create()
    except AssertionError:
        view = prov.create_view(prov.endpoints_form)
        assert view.hostname.value == prov.hostname[0:255]
Exemplo n.º 5
0
def test_host_name_max_character_validation_infra():
    """Test to validate max character for host name field"""
    endpoint = VirtualCenterEndpoint(hostname=fauxfactory.gen_alphanumeric(256))
    prov = VMwareProvider(name=fauxfactory.gen_alphanumeric(5), endpoints=endpoint)
    try:
        prov.create()
    except AssertionError:
        view = prov.create_view(prov.endpoints_form)
        assert view.hostname.value == prov.hostname[0:255]
Exemplo n.º 6
0
def test_add_cancelled_validation():
    """Tests that the flash message is correct when add is cancelled."""
    prov = VMwareProvider()
    prov.create(cancel=True)
    if version.current_version() >= 5.6:
        msg = 'Add of Infrastructure Provider was cancelled by the user'
    else:
        msg = 'Add of new Infrastructure Provider was cancelled by the user'
    flash.assert_message_match(msg)
Exemplo n.º 7
0
def test_add_cancelled_validation():
    """Tests that the flash message is correct when add is cancelled."""
    prov = VMwareProvider()
    prov.create(cancel=True)
    if version.current_version() >= 5.6:
        msg = 'Add of Infrastructure Provider was cancelled by the user'
    else:
        msg = 'Add of new Infrastructure Provider was cancelled by the user'
    flash.assert_message_match(msg)
Exemplo n.º 8
0
def test_ip_required_validation():
    """Test to validate the ip address while adding a provider"""
    prov = VMwareProvider(
        name=fauxfactory.gen_alphanumeric(5),
        hostname=fauxfactory.gen_alphanumeric(5),
        ip_address=None)

    with error.expected("IP Address can't be blank"):
        prov.create()
def test_name_required_validation_infra():
    """Tests to validate the name while adding a provider"""
    endpoint = VirtualCenterEndpoint(hostname=fauxfactory.gen_alphanumeric(5))
    prov = VMwareProvider(name=None, endpoints=endpoint)

    with pytest.raises(AssertionError):
        prov.create()

    view = prov.create_view(InfraProviderAddView)
    assert view.name.help_block == "Required"
    assert not view.add.active
Exemplo n.º 10
0
def test_host_name_max_character_validation():
    """Test to validate max character for host name field"""
    prov = VMwareProvider(
        name=fauxfactory.gen_alphanumeric(5),
        hostname=fauxfactory.gen_alphanumeric(256),
        ip_address='10.10.10.13')
    try:
        prov.create()
    except FlashMessageException:
        element = sel.move_to_element(prov.properties_form.locators["hostname_text"])
        text = element.get_attribute('value')
        assert text == prov.hostname[0:255]
Exemplo n.º 11
0
def test_host_name_max_character_validation():
    """Test to validate max character for host name field"""
    prov = VMwareProvider(name=fauxfactory.gen_alphanumeric(5),
                          hostname=fauxfactory.gen_alphanumeric(256),
                          ip_address='10.10.10.13')
    try:
        prov.create()
    except FlashMessageException:
        element = sel.move_to_element(
            prov.properties_form.locators["hostname_text"])
        text = element.get_attribute('value')
        assert text == prov.hostname[0:255]
Exemplo n.º 12
0
def test_infrastructure_add_provider_trailing_whitespaces():
    """Test to validate the hostname and username should be without whitespaces"""
    credentials = Credential(principal="test test", secret=fauxfactory.gen_alphanumeric(5))
    endpoint = VirtualCenterEndpoint(hostname="test test", credentials=credentials)
    prov = VMwareProvider(name=fauxfactory.gen_alphanumeric(5), endpoints=endpoint)
    with pytest.raises(AssertionError):
        prov.create()

    view = prov.create_view(prov.endpoints_form)
    assert view.hostname.help_block == "Spaces are prohibited"
    assert view.username.help_block == "Spaces are prohibited"
    view = prov.create_view(InfraProviderAddView)
    assert not view.add.active
Exemplo n.º 13
0
def test_name_required_validation_infra():
    """Tests to validate the name while adding a provider"""
    endpoint = VirtualCenterEndpoint(hostname=fauxfactory.gen_alphanumeric(5))
    prov = VMwareProvider(
        name=None,
        endpoints=endpoint)

    with pytest.raises(AssertionError):
        prov.create()

    view = prov.create_view(InfraProviderAddView)
    assert view.name.help_block == "Required"
    assert not view.add.active
Exemplo n.º 14
0
def test_infrastructure_add_provider_trailing_whitespaces():
    """Test to validate the hostname and username should be without whitespaces"""
    credentials = Credential(principal="test test", secret=fauxfactory.gen_alphanumeric(5))
    endpoint = VirtualCenterEndpoint(hostname="test test", credentials=credentials)
    prov = VMwareProvider(name=fauxfactory.gen_alphanumeric(5), endpoints=endpoint)
    with pytest.raises(AssertionError):
        prov.create()

    view = prov.create_view(prov.endpoints_form)
    assert view.hostname.help_block == "Spaces are prohibited"
    assert view.username.help_block == "Spaces are prohibited"
    view = prov.create_view(InfraProviderAddView)
    assert not view.add.active
Exemplo n.º 15
0
def test_host_name_required_validation():
    """Test to validate the hostname while adding a provider"""
    endpoint = VirtualCenterEndpoint(hostname=None)
    prov = VMwareProvider(name=fauxfactory.gen_alphanumeric(5),
                          endpoints=endpoint)

    err = FlashMessageException

    with error.expected(err):
        prov.create()

    view = prov.create_view(prov.endpoints_form)
    assert view.hostname.help_block == "Required"
    view = prov.create_view(ProviderAddView)
    assert not view.add.active
Exemplo n.º 16
0
def test_name_required_validation():
    """Tests to validate the name while adding a provider"""
    endpoint = VirtualCenterEndpoint(hostname=fauxfactory.gen_alphanumeric(5))
    prov = VMwareProvider(name=None, endpoints=endpoint)

    err = version.pick({
        version.LOWEST: "Name can't be blank",
        '5.6': FlashMessageException
    })

    with error.expected(err):
        prov.create()

    view = prov.create_view(ProviderAddView)
    assert view.name.help_block == "Required"
    assert not view.add.active
Exemplo n.º 17
0
def test_host_name_required_validation():
    """Test to validate the hostname while adding a provider"""
    prov = VMwareProvider(
        name=fauxfactory.gen_alphanumeric(5),
        hostname=None,
        ip_address='10.10.10.11')

    err = version.pick(
        {version.LOWEST: "Host Name can't be blank",
         '5.6': FlashMessageException})

    with error.expected(err):
        prov.create()

    if version.current_version() >= 5.6:
        assert prov.properties_form.hostname_text.angular_help_block == "Required"
        assert prov.add_provider_button.is_dimmed
Exemplo n.º 18
0
def test_host_name_required_validation():
    """Test to validate the hostname while adding a provider"""
    prov = VMwareProvider(name=fauxfactory.gen_alphanumeric(5),
                          hostname=None,
                          ip_address='10.10.10.11')

    err = version.pick({
        version.LOWEST: "Host Name can't be blank",
        '5.6': FlashMessageException
    })

    with error.expected(err):
        prov.create()

    if version.current_version() >= 5.6:
        assert prov.properties_form.hostname_text.angular_help_block == "Required"
        assert prov.add_provider_button.is_dimmed
Exemplo n.º 19
0
def test_add_cancelled_validation_infra(appliance):
    """Tests that the flash message is correct when add is cancelled."""
    prov = VMwareProvider()
    prov.create(cancel=True)
    view = appliance.browser.create_view(InfraProvidersView)
    view.flash.assert_success_message('Add of Infrastructure Provider was cancelled by the user')