added 'test_' and 'Test' to file and classnames, and resolved some type errors

This commit is contained in:
naomi 2021-10-24 20:19:30 +01:00
parent b393d818c9
commit c7e9b7e0b6
5 changed files with 12 additions and 13 deletions

View File

@ -117,7 +117,7 @@ class BaseTester:
def _test(self, *args): def _test(self, *args):
"""Placeholder to be overwritten by overloading classes""" """Placeholder to be overwritten by overloading classes"""
def _test_all(self, test_strings: tuple[str]): def _test_all(self, test_strings: tuple[str, str, str]):
"""Loops testing over the given terms""" """Loops testing over the given terms"""
try: try:
self.login() self.login()
@ -151,7 +151,7 @@ class SearchExportTester(BaseTester):
self.contact_selectall_id = "CIVICRM_QFID_ts_all_4" self.contact_selectall_id = "CIVICRM_QFID_ts_all_4"
self.contact_dropdown_id = "select2-chosen-4" self.contact_dropdown_id = "select2-chosen-4"
def _get_export_id(self) -> str: def _get_export_id(self) -> list[str]:
"""Parses url to get the param used to ID what search we are currently doing""" """Parses url to get the param used to ID what search we are currently doing"""
export_page_url = self.browser.current_url export_page_url = self.browser.current_url
parsed = urlparse.urlparse(export_page_url) parsed = urlparse.urlparse(export_page_url)

View File

@ -4,7 +4,7 @@ from selenium.webdriver.support.select import Select
from .base import BaseTester from .base import BaseTester
class ActivitiesTab(BaseTester): class TestActivitiesTab(BaseTester):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
self.title("Activities Tab") self.title("Activities Tab")

View File

@ -6,7 +6,7 @@ from selenium.webdriver.common.keys import Keys
from .base import SearchExportTester from .base import SearchExportTester
class ContactExport(SearchExportTester): class TestContactExport(SearchExportTester):
"""Tests if exporting contacts from a search returns a CSV file with all contacts.""" """Tests if exporting contacts from a search returns a CSV file with all contacts."""
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)

View File

@ -6,7 +6,7 @@ from selenium.webdriver.common.keys import Keys
from .base import SearchExportTester from .base import SearchExportTester
class SteeringCommitteePrintLabels(SearchExportTester): class TestSteeringCommitteePrintLabels(SearchExportTester):
"""Tests the pdf labels for the SteeringCommitee show all contacts names""" """Tests the pdf labels for the SteeringCommitee show all contacts names"""
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)

13
main.py
View File

@ -1,9 +1,8 @@
import argparse import argparse
from civicrm_tester.activities_tab import ActivitiesTab from civicrm_tester.test_activities_tab import TestActivitiesTab
from civicrm_tester.contact_export import ContactExport from civicrm_tester.test_contact_export import TestContactExport
from civicrm_tester.steeringcommittee_print_labels import \ from civicrm_tester.test_steeringcommittee_print_labels import TestSteeringCommitteePrintLabels
SteeringCommitteePrintLabels
if __name__ == "__main__": if __name__ == "__main__":
parser = argparse.ArgumentParser(description="") parser = argparse.ArgumentParser(description="")
@ -32,9 +31,9 @@ if __name__ == "__main__":
cl_arg = ( cl_arg = (
arguments.user, arguments.passwd, arguments.dev, arguments.show_browser arguments.user, arguments.passwd, arguments.dev, arguments.show_browser
) )
ActivitiesTab(*cl_arg).test_all_hardcoded_contacts() TestActivitiesTab(*cl_arg).test_all_hardcoded_contacts()
ContactExport(*cl_arg).test_hardcoded_search_terms() TestContactExport(*cl_arg).test_hardcoded_search_terms()
SteeringCommitteePrintLabels(*cl_arg).test() TestSteeringCommitteePrintLabels(*cl_arg).test()
# Mailing list # Mailing list
# Load mailing list test and enter test data # Load mailing list test and enter test data