def test_add_cancelled_validation(request): """Tests that the flash message is correct when add is cancelled.""" prov = EC2Provider() request.addfinalizer(prov.delete_if_exists) prov.create(cancel=True) view = prov.browser.create_view(CloudProvidersView) view.flash.assert_success_message('Add of Cloud Provider was cancelled by the user')
def test_add_cancelled_validation(request): """Tests that the flash message is correct when add is cancelled.""" prov = EC2Provider() request.addfinalizer(prov.delete_if_exists) prov.create(cancel=True) flash.assert_message_match({ version.LOWEST: 'Add of new Cloud Provider was cancelled by the user', '5.5': 'Add of Cloud Provider was cancelled by the user'})
def test_name_max_character_validation(request): """Test to validate max character for name field""" prov = EC2Provider( name=fauxfactory.gen_alphanumeric(255), region='us-east-1') request.addfinalizer(prov.delete_if_exists) prov.create()
def test_region_required_validation(request, soft_assert): """Tests to validate the region while adding a provider""" prov = EC2Provider(name=fauxfactory.gen_alphanumeric(5), region=None) request.addfinalizer(prov.delete_if_exists) with pytest.raises(AssertionError): prov.create() view = prov.create_view(CloudProviderAddView) soft_assert(view.region.help_block == "Required")
def test_name_required_validation(request): """Tests to validate the name while adding a provider""" prov = EC2Provider(name=None, region='US East (Northern Virginia)') request.addfinalizer(prov.delete_if_exists) with pytest.raises(AssertionError): prov.create() view = prov.create_view(CloudProviderAddView) assert view.name.help_block == "Required" assert not view.add.active
def test_add_cancelled_validation_cloud(request): """Tests that the flash message is correct when add is cancelled.""" prov = EC2Provider() request.addfinalizer(prov.delete_if_exists) try: prov.create(cancel=True) except MoveTargetOutOfBoundsException: # TODO: Remove once fixed 1475303 prov.create(cancel=True) view = prov.browser.create_view(CloudProvidersView) view.flash.assert_success_message( 'Add of Cloud Provider was cancelled by the user')
def test_region_required_validation(request, soft_assert): """Tests to validate the region while adding a provider""" prov = EC2Provider(name=fauxfactory.gen_alphanumeric(5), region=None) request.addfinalizer(prov.delete_if_exists) if version.current_version() < "5.5": with error.expected('Region is not included in the list'): prov.create() else: with error.expected(FlashMessageException): prov.create() soft_assert("ng-invalid-required" in prov.properties_form.region_select.classes)
def test_name_required_validation(request): """Tests to validate the name while adding a provider""" prov = EC2Provider(name=None, region='us-east-1') request.addfinalizer(prov.delete_if_exists) if version.current_version() < "5.5": with error.expected("Name can't be blank"): prov.create() else: # It must raise an exception because it keeps on the form with error.expected(FlashMessageException): prov.create() assert prov.properties_form.name_text.angular_help_block == "Required"