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):
"""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"""
try:
self.login()
@ -151,7 +151,7 @@ class SearchExportTester(BaseTester):
self.contact_selectall_id = "CIVICRM_QFID_ts_all_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"""
export_page_url = self.browser.current_url
parsed = urlparse.urlparse(export_page_url)

View File

@ -4,7 +4,7 @@ from selenium.webdriver.support.select import Select
from .base import BaseTester
class ActivitiesTab(BaseTester):
class TestActivitiesTab(BaseTester):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.title("Activities Tab")
@ -65,4 +65,4 @@ class ActivitiesTab(BaseTester):
cid_na = "42269" # Nigel Addams
#cid_db = "43193" Use to test 100 max limit
cid_tuple = (cid_da, cid_kh, cid_na)
self._test_all(cid_tuple)
self._test_all(cid_tuple)

View File

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

View File

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

13
main.py
View File

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