blackify 02

This commit is contained in:
Jean-Marie Place 2021-08-18 15:55:30 +02:00
parent 0d177f7b0b
commit 0d860f2406

View File

@ -34,6 +34,7 @@ URL_ADMIN = "/".join((URL_ROOT, "ScoDoc", "admin"))
ACRONYME_FORMATION = "formationtest" ACRONYME_FORMATION = "formationtest"
URL = URL_SCODOC8 URL = URL_SCODOC8
class PythonOrgSearch(unittest.TestCase): class PythonOrgSearch(unittest.TestCase):
# Permet de se connecter et se remettre sur la page d'accueil avant chaque test # Permet de se connecter et se remettre sur la page d'accueil avant chaque test
def setUp(self): def setUp(self):
@ -42,7 +43,7 @@ class PythonOrgSearch(unittest.TestCase):
else: else:
self.driver = webdriver.Chrome() self.driver = webdriver.Chrome()
self.wait = WebDriverWait(self.driver, 10) self.wait = WebDriverWait(self.driver, 10)
auth_page = URL_AUTH + ("?next=" + URL_HOME).replace("/", "%2F") auth_page = URL_AUTH
self.driver.get(auth_page) self.driver.get(auth_page)
self.driver.find_element_by_id("user_name").send_keys(SCODOC_ADMIN_ID) self.driver.find_element_by_id("user_name").send_keys(SCODOC_ADMIN_ID)
self.driver.find_element_by_id("password").send_keys(SCODOC_ADMIN_PASS) self.driver.find_element_by_id("password").send_keys(SCODOC_ADMIN_PASS)
@ -76,7 +77,7 @@ class PythonOrgSearch(unittest.TestCase):
driver = self.driver driver = self.driver
wait = self.wait wait = self.wait
driver.get(URL) driver.get(URL)
id_edit_formation = "edit-formation-" + ACRONYME_FORMATION.replace(" ","-") id_edit_formation = "edit-formation-" + ACRONYME_FORMATION.replace(" ", "-")
driver.find_element_by_id(id_edit_formation).click() driver.find_element_by_id(id_edit_formation).click()
wait.until(EC.url_changes(URL)) wait.until(EC.url_changes(URL))
driver.find_element_by_id("tf_acronyme").send_keys(ACRONYME_FORMATION) driver.find_element_by_id("tf_acronyme").send_keys(ACRONYME_FORMATION)
@ -86,7 +87,9 @@ class PythonOrgSearch(unittest.TestCase):
text_element_acronyme = [] text_element_acronyme = []
for formation in formations: for formation in formations:
text_element_acronyme.append(formation.text) text_element_acronyme.append(formation.text)
self.assertTrue(ACRONYME_FORMATION + ACRONYME_FORMATION in text_element_acronyme) self.assertTrue(
ACRONYME_FORMATION + ACRONYME_FORMATION in text_element_acronyme
)
# Remise du nom à celui de départ # Remise du nom à celui de départ
driver.get(URL) driver.get(URL)
id_edit_formation = "edit-formation-" + ACRONYME_FORMATION + ACRONYME_FORMATION id_edit_formation = "edit-formation-" + ACRONYME_FORMATION + ACRONYME_FORMATION
@ -174,7 +177,9 @@ class PythonOrgSearch(unittest.TestCase):
wait.until(EC.url_changes(URL)) wait.until(EC.url_changes(URL))
driver.find_element_by_name("date_debut").send_keys("01/01/2021") driver.find_element_by_name("date_debut").send_keys("01/01/2021")
driver.find_element_by_name("date_fin").send_keys("30/06/2021") driver.find_element_by_name("date_fin").send_keys("30/06/2021")
driver.find_element_by_name("responsable_id").send_keys("BACH Jean-Sebastien (Bach)") driver.find_element_by_name("responsable_id").send_keys(
"BACH Jean-Sebastien (Bach)"
)
Select(driver.find_element_by_id("tf_semestre_id")).select_by_value("4") Select(driver.find_element_by_id("tf_semestre_id")).select_by_value("4")
driver.find_element_by_id("tf_submit").click() driver.find_element_by_id("tf_submit").click()
wait.until(EC.url_changes(URL)) wait.until(EC.url_changes(URL))