def test_030_checkUserRegistrationScript(self): """ checkUserRegistration """ # remove leading and trailing spaces. http_admin = global_functions.get_http_url() assert (http_admin) test_name = "randomName-" + "".join( [random.choice(string.ascii_letters) for i in range(15)]) test_name_lower = test_name.lower() result = register_username(http_admin, test_name) user_list = get_list_of_username_mapped() # print('test_name %s' % test_name) # print('result %s' % result) # print('user_list %s' % user_list) found_username = find_name_in_host_table(test_name_lower) assert (found_username) assert (result == 0) assert (test_name_lower in user_list) events = global_functions.get_events('Directory Connector', 'API Events', None, 1) assert (events != None) found_in_reports = global_functions.check_events( events.get('list'), 5, "login_name", test_name_lower, "client_addr", remote_control.client_ip) assert (found_in_reports)
def test_030_checkUserRegistrationScript(self): """ checkUserRegistration """ # remove leading and trailing spaces. http_admin = global_functions.get_http_url() assert(http_admin) test_name = "randomName-" + "".join( [random.choice(string.ascii_letters) for i in range(15)] ) test_name_lower = test_name.lower() result = register_username(http_admin, test_name) user_list = get_list_of_username_mapped() # print('test_name %s' % test_name) # print('result %s' % result) # print('user_list %s' % user_list) found_username = find_name_in_host_table(test_name_lower) assert(found_username) assert (result == 0) assert (test_name_lower in user_list) events = global_functions.get_events('Directory Connector','API Events',None,1) assert(events != None) found_in_reports = global_functions.check_events( events.get('list'), 5, "login_name",test_name_lower, "client_addr", remote_control.client_ip) assert( found_in_reports )
def test_020_changeBranding(self): global app, appWeb, appData appData['companyName'] = newCompanyName; appData['companyUrl'] = newURL; appData['contactName'] = newContactName; appData['contactEmail'] = newContactEmail; app.setSettings(appData) # test blockpage has all the changes result = remote_control.run_command("wget -q -O - \"$@\" www.playboy.com",stdout=True) # Verify Title of blockpage as company name myRegex = re.compile('<title>(.*?)</title>', re.IGNORECASE|re.DOTALL) matchText = myRegex.search(result).group(1) matchText = matchText.split("|")[0] matchText = matchText.strip() print("looking for: \"%s\""%newCompanyName) print("in :\"%s\""%matchText) assert(newCompanyName in matchText) # Verify email address is in the contact link myRegex = re.compile('mailto:(.*?)\?', re.IGNORECASE|re.DOTALL) matchText = myRegex.search(result).group(1) matchText = matchText.strip() print("looking for: \"%s\""%newContactEmail) print("in :\"%s\""%matchText) assert(newContactEmail in matchText) # Verify contact name is in the mailto myRegex = re.compile('mailto:.*?>(.*?)<\/a>', re.IGNORECASE|re.DOTALL) matchText = myRegex.search(result).group(1) matchText = matchText.strip() print("looking for: \"%s\""%newContactName) print("in :\"%s\""%matchText) assert(newContactName in matchText) # Verify URL is in the Logo box myRegex = re.compile('<a href\=\"(.*?)\"><img .* src\=\"\/images\/BrandingLogo', re.IGNORECASE|re.DOTALL) matchText = myRegex.search(result).group(1) print("looking for: \"%s\""%newURL) print("in :\"%s\""%matchText) assert(newURL in matchText) # Check login page for branding internalAdmin = None # print("IP address <%s>" % internalAdmin) result = remote_control.run_command("wget -q -O - \"$@\" " + global_functions.get_http_url() ,stdout=True) # print("page is <%s>" % result) # Verify Title of blockpage as company name myRegex = re.compile('<title>(.*?)</title>', re.IGNORECASE|re.DOTALL) matchText = myRegex.search(result).group(1) matchText = matchText.split("|")[0] matchText = matchText.strip() print("looking for: \"%s\""%newCompanyName) print("in :\"%s\""%matchText) assert(newCompanyName in matchText)
def test_110_verify_report_users(self): # Test report only user can login and report serlvet displays # add report user with test_email_address settings = app.getSettings() settings["reportsUsers"]["list"] = settings["reportsUsers"]["list"][:1] settings["reportsUsers"]["list"].append(create_reports_user(profile_email='test', access=True)) # password = passwd app.setSettings(settings) adminURL = global_functions.get_http_url() print("URL %s" % adminURL) resultLoginPage = subprocess.call("wget -q -O - " + adminURL + "reports 2>&1 | grep -q Login", shell=True) assert (resultLoginPage == 0) resultLoginPage = subprocess.call("wget -q -O - " + adminURL + '"auth/login?url=/reports&realm=Reports&username=test&password=passwd" 2>&1 | grep -q Report', shell=True) assert (resultLoginPage == 0)
def test_033_checkUserNotificationLoginScriptDownload(self): """ Check download of user notification script """ # remove leading and trailing spaces. http_admin = global_functions.get_http_url() assert (http_admin) script_uri = "userapi/registration?download=download" script_url = http_admin + script_uri response = requests.get(script_url) # print(user_script) assert ("serverLocation" in response.text) assert ("secret" in response.text) assert ("urlProtocol" in response.text)
def test_022_changeBranding_bannerMessage_removed(self): global app, appWeb, appData appData['companyName'] = newCompanyName; appData['companyUrl'] = newURL; appData['contactName'] = newContactName; appData['contactEmail'] = newContactEmail; appData['bannerMessage'] = "" app.setSettings(appData) internalAdmin = None result = remote_control.run_command("wget -q -O - \"$@\" " + global_functions.get_http_url() ,stdout=True) myRegex = re.compile('.*A regulation banner requirement containing a mix of text including <b>html<\/b> and<br\/>multiple<br\/>lines.*', re.DOTALL|re.MULTILINE) if re.match(myRegex,result): assert(False) else: assert(True)
def test_033_checkUserNotificationLoginScriptDownload(self): """ Check download of user notification script """ # remove leading and trailing spaces. http_admin = global_functions.get_http_url() assert(http_admin) script_uri = "userapi/registration?download=download" script_url = http_admin + script_uri response = requests.get(script_url) # print(user_script) assert ("serverLocation" in response.text) assert ("secret" in response.text) assert ("urlProtocol" in response.text)
def test_032_checkUserRegistrationScriptOld(self): """ Check old user registration """ # remove leading and trailing spaces. http_admin = global_functions.get_http_url() assert(http_admin) test_name = "randomName-" + "".join( [random.choice(string.ascii_letters) for i in range(15)] ) test_name = test_name.lower() result = register_username_old(http_admin, test_name) user_list = get_list_of_username_mapped() # print('result %s' % result) # print('num %s' % numUsers) found_username = find_name_in_host_table(test_name) assert(found_username) assert (result == 0) assert (test_name in user_list)
def test_031_checkUserRegistrationScriptMixedCase(self): """ checkUserRegistration, mixed character case in username """ # remove leading and trailing spaces. http_admin = global_functions.get_http_url().title() assert(http_admin) test_name = "randomName-" + "".join( [random.choice(string.ascii_letters) for i in range(15)] ) # Force at least one upper-case character result = register_username(http_admin, test_name.title()) user_list = get_list_of_username_mapped() # print('result %s' % result) # print('num %s' % numUsers) test_name = test_name.lower() found_username = find_name_in_host_table(test_name) assert(found_username) assert (result == 0) assert (test_name in user_list)
def test_110_verify_report_users(self): # Test report only user can login and report servlet displays # add report user with test_email_address settings = self._app.getSettings() settings["reportsUsers"]["list"] = settings["reportsUsers"]["list"][:1] settings["reportsUsers"]["list"].append( create_reports_user(profile_email='test', access=True)) # password = passwd self._app.setSettings(settings) adminURL = global_functions.get_http_url() print("URL %s" % adminURL) resultLoginPage = subprocess.call("wget -q -O - " + adminURL + "reports 2>&1 | grep -q Login", shell=True) assert (resultLoginPage == 0) resultLoginPage = subprocess.call( "wget -q -O - " + adminURL + '"auth/login?url=/reports&realm=Reports&username=test&password=passwd" 2>&1 | grep -q Report', shell=True) assert (resultLoginPage == 0)