def skip_as_jenkins(): """Skip test when running as Jenkins user.""" try: user = os.environ['USER'] except KeyError: user = '******' if user.lower() == 'jenkins': skip()
assert_url, get_element_by_css, go_to, skip, sleep, write_textfield, ) from u1testutils.sst import config from acceptance import urls from identityprovider.utils import get_current_brand if get_current_brand() != 'ubuntuone': skip('Test only compatible with ubuntuone brand') config.set_base_url_from_env() go_to(urls.NEW_ACCOUNT) assert_url(urls.NEW_ACCOUNT) assert_title('Create account') elem = get_element_by_css('.yui3-passwordmeter-indicatorNode p') write_textfield('id_password', password) # wait for animation sleep(1) assert_text(elem, error)
from sst.actions import skip skip() raise AssertionError('should never get here')
go_to, skip, wait_for, write_textfield, ) from u1testutils import mail from u1testutils.sst import config from acceptance import helpers, urls from identityprovider.utils import get_current_brand if get_current_brand() == 'ubuntuone': skip( 'The ubuntuone brand does client side validation' ) config.set_base_url_from_env() # Create and verify account A helpers.register_account() # Add and verify 2nd email go_to(urls.EMAILS) wait_for(assert_title_contains, "'s email addresses") write_textfield('id_newemail', address) click_button(get_element(name='continue')) # Check the outcome if valid:
get_element, go_to, skip, write_textfield, wait_for, ) from sst import config as sst_config from u1testutils import mail from u1testutils.sso import mail as sso_mail from u1testutils.sst import config from acceptance import helpers, urls if 'allow_unverified' in sst_config.flags: skip("allow_unverified makes this test irrelevant") config.set_base_url_from_env() go_to(urls.NEW_ACCOUNT) assert_title('Create account') email_address = mail.make_unique_test_email_address() helpers.fill_registration_form(email_address) click_button(get_element(name='continue')) assert_title_contains('Account creation mail sent') assert_text_contains(get_element(id='content'), r'just emailed .* \(from .*\) to confirm your address\.', regex=True) vcode = sso_mail.get_verification_code_for_address(email_address)
def production_only(): if not is_production(): print 'This is a test only for Production.' skip()
def skip_production(): if is_production(): print 'This test should not run against production.' skip()
def skip_unless_staging_or_production(): """Skip a test if not running against staging or production.""" if not (is_staging() or is_production()): print "This test can only be run against staging or production." skip()
from sst.actions import ( assert_displayed, assert_title, click_button, exists_element, get_element, go_to, skip, write_textfield, ) from u1testutils.sst import config from acceptance import helpers, urls if not exists_element(id='recaptcha_response_field'): skip("Test skipped - no captcha present") config.set_base_url_from_env() helpers.skip_unless_staging_or_production() go_to(urls.NEW_ACCOUNT) assert_title('Create account') # explicitly don't set captcha email_address = '*****@*****.**' write_textfield('id_displayname', "My Name") write_textfield('id_email', email_address) write_textfield('id_password', "Admin007") write_textfield('id_passwordconfirm', "Admin007") # Even though the recaptcha field is ignored for our tests, we do want to
go_to, skip ) from u1testutils.sst import config from acceptance import helpers, urls from identityprovider.utils import get_current_brand # the reason why this test is incompatible # with the u1 brand is because of the # input email type usage. Firefox will # prevent user from submitting the form # if the email is not valid if get_current_brand() == 'ubuntuone': skip('Test not compatible with ubuntuone brand') # Set to Production, Staging, VPS, Developer etc.. config.set_base_url_from_env() # Attempt to create a new account using invalid emails go_to(urls.NEW_ACCOUNT) helpers.fill_registration_form( invalid_email, displayname='test name', password=settings.SSO_TEST_ACCOUNT_PASSWORD ) click_button(get_element(name="continue")) assert_element(text='Invalid email.')
click_button, exists_element, get_element, skip, sleep, write_textfield, wait_for, ) from sst import config as sst_config from u1testutils import mail from u1testutils.sst import config from acceptance import helpers if 'allow_unverified' in sst_config.flags: skip("allow_unverified means this test is irrelevant") config.set_base_url_from_env() email_address_for_token = mail.make_unique_test_email_address() token = helpers.register_account(email_address_for_token) # Now we create a second account and try to use the original # verification code/token. another_email = mail.make_unique_test_email_address() helpers.logout() helpers.register_account(another_email, verify=False) write_textfield(get_element(name='confirmation_code'), token) sleep(1) # we have no idea why this is needed but bad things happen if omitted click_button(get_element(css_class='btn'))
from sst.actions import skip skip() raise AssertionError("should never get here")