def test_ip_max_valid_character_validation(request): """Test to validate max character for ip address field with valid ip address""" prov = OpenStackProvider( name=fauxfactory.gen_alphanumeric(5), hostname=fauxfactory.gen_alphanumeric(5), ip_address=fauxfactory.gen_ipaddr(prefix=[10])) request.addfinalizer(prov.delete_if_exists) prov.create()
def test_ip_max_invalid_character_validation(request): """Test to validate max character for ip address field using random string""" prov = OpenStackProvider( name=fauxfactory.gen_alphanumeric(5), hostname=fauxfactory.gen_alphanumeric(5), ip_address=fauxfactory.gen_alphanumeric(15)) request.addfinalizer(prov.delete_if_exists) prov.create()
def test_api_port_max_character_validation(request): """Test to validate max character for api port field""" prov = OpenStackProvider( name=fauxfactory.gen_alphanumeric(5), hostname=fauxfactory.gen_alphanumeric(5), ip_address=fauxfactory.gen_ipaddr(prefix=[10]), api_port=fauxfactory.gen_alphanumeric(15)) request.addfinalizer(prov.delete_if_exists) prov.create()
def test_ip_address_required_validation(request): """Test to validate the ip address while adding a provider""" prov = OpenStackProvider( name=fauxfactory.gen_alphanumeric(5), hostname=fauxfactory.gen_alphanumeric(5), ip_address=None) request.addfinalizer(prov.delete_if_exists) with error.expected("IP Address can't be blank"): prov.create()
def test_hostname_max_character_validation(): """Test to validate max character for hostname field""" endpoint = RHOSEndpoint(hostname=fauxfactory.gen_alphanumeric(256), api_port=None, security_protocol=None) prov = OpenStackProvider(name=fauxfactory.gen_alphanumeric(5), endpoints=endpoint) try: prov.create() except AssertionError: endpoints = prov.create_view(prov.endpoints_form) assert endpoints.default.hostname.value == prov.hostname[0:255]
def test_api_port_max_character_validation(): """Test to validate max character for api port field""" endpoint = RHOSEndpoint(hostname=fauxfactory.gen_alphanumeric(5), api_port=fauxfactory.gen_alphanumeric(16), security_protocol='Non-SSL') prov = OpenStackProvider(name=fauxfactory.gen_alphanumeric(5), endpoints=endpoint) try: prov.create() except AssertionError: view = prov.create_view(prov.endpoints_form) text = view.default.api_port.value assert text == prov.default_endpoint.api_port[0:15]
def test_hostname_max_character_validation(request): """Test to validate max character for hostname field""" prov = OpenStackProvider( 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]
def test_host_name_required_validation(request): """Test to validate the hostname while adding a provider""" prov = OpenStackProvider(name=fauxfactory.gen_alphanumeric(5), hostname=None, ip_address=fauxfactory.gen_ipaddr(prefix=[10])) request.addfinalizer(prov.delete_if_exists) # It must raise an exception because it keeps on the form with pytest.raises(AssertionError): prov.create() endpoints = prov.create_view(prov.endpoints_form) assert endpoints.default.hostname.help_block == "Required"
def test_hostname_max_character_validation(): """Test to validate max character for hostname field""" prov = OpenStackProvider(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]
def test_host_name_required_validation(request): """Test to validate the hostname while adding a provider""" prov = OpenStackProvider( name=fauxfactory.gen_alphanumeric(5), hostname=None, ip_address=fauxfactory.gen_ipaddr(prefix=[10])) request.addfinalizer(prov.delete_if_exists) # It must raise an exception because it keeps on the form with pytest.raises(AssertionError): prov.create() endpoints = prov.create_view(prov.endpoints_form) assert endpoints.default.hostname.help_block == "Required"
def test_api_port_max_character_validation(): """Test to validate max character for api port field""" prov = OpenStackProvider(name=fauxfactory.gen_alphanumeric(5), hostname=fauxfactory.gen_alphanumeric(5), ip_address='10.10.10.15', api_port=fauxfactory.gen_alphanumeric(16)) try: prov.create() except FlashMessageException: element = sel.move_to_element( prov.properties_form.locators["api_port"]) text = element.get_attribute('value') assert text == prov.api_port[0:15]
def test_api_port_blank_validation(request): """Test to validate blank api port while adding a provider""" endpoint = RHOSEndpoint(hostname=fauxfactory.gen_alphanumeric(5), ip_address=fauxfactory.gen_ipaddr(prefix=[10]), api_port='', security_protocol='Non-SSL') prov = OpenStackProvider(name=fauxfactory.gen_alphanumeric(5), endpoints=endpoint) request.addfinalizer(prov.delete_if_exists) # It must raise an exception because it keeps on the form with pytest.raises(AssertionError): prov.create() endpoints = prov.create_view(prov.endpoints_form) assert endpoints.default.api_port.help_block == "Required"
def test_api_port_blank_validation(request): """Test to validate blank api port while adding a provider""" prov = OpenStackProvider(name=fauxfactory.gen_alphanumeric(5), hostname=fauxfactory.gen_alphanumeric(5), ip_address=fauxfactory.gen_ipaddr(prefix=[10]), api_port='') request.addfinalizer(prov.delete_if_exists) if version.current_version() < "5.5": prov.create() else: # It must raise an exception because it keeps on the form with error.expected(FlashMessageException): prov.create() assert prov.properties_form.api_port.angular_help_block == "Required"
def test_api_port_blank_validation(request): """Test to validate blank api port while adding a provider""" prov = OpenStackProvider( name=fauxfactory.gen_alphanumeric(5), hostname=fauxfactory.gen_alphanumeric(5), ip_address=fauxfactory.gen_ipaddr(prefix=[10]), api_port='') request.addfinalizer(prov.delete_if_exists) if version.current_version() < "5.5": prov.create() else: # It must raise an exception because it keeps on the form with error.expected(FlashMessageException): prov.create() assert prov.properties_form.api_port.angular_help_block == "Required"