forked from aurelien.plancke/ScodocTestClient
Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
0d860f2406 | |||
0d177f7b0b | |||
b66631cdcc | |||
2a57748959 | |||
d3d6b01931 | |||
|
d865041ec5 | ||
da81feb708 | |||
965182cf12 | |||
241b8984f6 | |||
795561f315 | |||
53fb0159ce |
@ -1,4 +1,5 @@
|
||||
BASE_URL = "https://scodoc-dev-iutinfo.univ-lille.fr/ScoDoc/"
|
||||
SCHEMA = "https"
|
||||
BASE_URL = "scodoc-dev-iutinfo.univ-lille.fr/ScoDoc/"
|
||||
NOM_DPT = "test01"
|
||||
SCODOC_ADMIN_ID = "admin_id"
|
||||
SCODOC_ADMIN_PASS = "admin_password"
|
||||
@ -7,5 +8,5 @@ SCODOC_ENS_PASS = "enseignant_password@10"
|
||||
SCODOC_CHEF_ID = "chef_id"
|
||||
SCODOC_CHEF_PASS = "p@ssword42@"
|
||||
LINK_SCODOC_SERVER = "root@ssh_server_scodoc"
|
||||
BASE_NOT_SECURED_URL = "scodoc-dev-iutinfo.univ-lille.fr/"
|
||||
BASE_SSH_URL = "scodoc-dev-iutinfo.univ-lille.fr/"
|
||||
NAVIGATEUR = "firefox"
|
@ -10,10 +10,12 @@ import suppressionSiteDepartement
|
||||
from setting import (
|
||||
SCODOC_ADMIN_ID,
|
||||
SCODOC_ADMIN_PASS,
|
||||
BASE_URL,
|
||||
SCHEMA,
|
||||
SCODOC_SERVER,
|
||||
SCODOC_PORT,
|
||||
NOM_DPT,
|
||||
LINK_SCODOC_SERVER,
|
||||
BASE_NOT_SECURED_URL,
|
||||
BASE_SSH_URL,
|
||||
NAVIGATEUR,
|
||||
)
|
||||
from selenium import webdriver
|
||||
@ -21,24 +23,27 @@ from selenium.webdriver.common.keys import Keys
|
||||
from selenium.webdriver.support.ui import Select
|
||||
from selenium.webdriver.support.select import Select
|
||||
|
||||
URL_ROOT = SCHEMA + "://" + + + ":" + SCODOC_PORT
|
||||
URL_AUTH = "/".join((URL_ROOT, "auth", "login"))
|
||||
URL_SCODOC8 = "/".join((URL_ROOT, "index"))
|
||||
URL_HOME = "/".join((URL_ROOT, "ScoDoc", "index"))
|
||||
URL_DEPT = "/".join((URL_ROOT, "ScoDoc", NOM_DPT, "Scolarite", "index_html"))
|
||||
URL_ADMIN = "/".join((URL_ROOT, "ScoDoc", "admin"))
|
||||
|
||||
class PythonOrgSearch(unittest.TestCase):
|
||||
# Permet de se connecter et se remettre sur la page d'accueil avant chaque test
|
||||
def setUp(self):
|
||||
next_page = ""
|
||||
if NAVIGATEUR == "firefox":
|
||||
self.driver = webdriver.Firefox()
|
||||
else:
|
||||
self.driver = webdriver.Chrome()
|
||||
self.driver.get(
|
||||
"https://"
|
||||
+ SCODOC_ADMIN_ID
|
||||
+ ":"
|
||||
+ SCODOC_ADMIN_PASS
|
||||
+ "@"
|
||||
+ BASE_NOT_SECURED_URL
|
||||
+ "force_admin_authentication"
|
||||
)
|
||||
self.driver.get(BASE_URL)
|
||||
auth_page = URL_AUTH + "?next=%2F" + next_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("password").send_keys(SCODOC_ADMIN_PASS)
|
||||
self.driver.find_element_by_id("submit").click()
|
||||
self.driver.get(URL_SCODOC8)
|
||||
|
||||
# Test : Verification de la connexion admin effective
|
||||
# @expected : "Bonjour admin" est présent sur la page d'accueil
|
||||
@ -50,25 +55,25 @@ class PythonOrgSearch(unittest.TestCase):
|
||||
# @expected : Le département est présent sur la page d'accueil
|
||||
def test_02_create_departement(self):
|
||||
driver = self.driver
|
||||
driver.get(BASE_URL + "/scodoc_admin")
|
||||
driver.get(SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT + "/scodoc_admin")
|
||||
time.sleep(2)
|
||||
select = Select(driver.find_element_by_id("create-dept"))
|
||||
select.select_by_visible_text(NOM_DPT)
|
||||
driver.find_element_by_id("create-dept").submit()
|
||||
time.sleep(1)
|
||||
driver.find_element_by_id("tf_submit").click()
|
||||
driver.get(BASE_URL)
|
||||
driver.get(URL_HOME)
|
||||
self.assertTrue(NOM_DPT in driver.page_source)
|
||||
|
||||
# Test : Suppresion d'un département, puis lancement d'un script coté serveur pour supprimer sa base de données
|
||||
# @expected : Le département n'apparait plus sur la page d'accueil
|
||||
def test_03_delete_departement(self):
|
||||
driver = self.driver
|
||||
driver.get(BASE_URL + "/scodoc_admin")
|
||||
driver.get(SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT + "/scodoc_admin")
|
||||
select = Select(driver.find_element_by_id("delete-dept"))
|
||||
select.select_by_visible_text(NOM_DPT)
|
||||
driver.find_element_by_id("delete-dept").submit()
|
||||
driver.get(BASE_URL)
|
||||
driver.get(SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT)
|
||||
self.assertTrue(NOM_DPT not in driver.page_source)
|
||||
|
||||
# ferme la fenetre à chaque fin de test
|
||||
|
@ -6,13 +6,14 @@ import HtmlTestRunner
|
||||
import createDepartement
|
||||
import creationSiteDepartement
|
||||
import deleteDepartement
|
||||
import creationUtilisateurs
|
||||
from setting import (
|
||||
SCODOC_ADMIN_ID,
|
||||
SCODOC_ADMIN_PASS,
|
||||
BASE_URL,
|
||||
SCHEMA,
|
||||
SCODOC_SERVER,
|
||||
SCODOC_PORT,
|
||||
NOM_DPT,
|
||||
LINK_SCODOC_SERVER,
|
||||
BASE_NOT_SECURED_URL,
|
||||
NAVIGATEUR,
|
||||
)
|
||||
from selenium import webdriver
|
||||
@ -23,9 +24,15 @@ from selenium.webdriver.common.keys import Keys
|
||||
from selenium.webdriver.support.ui import Select
|
||||
from selenium.webdriver.support.select import Select
|
||||
|
||||
URL = BASE_URL + NOM_DPT + "/Scolarite"
|
||||
URL_ROOT = SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT
|
||||
URL_AUTH = "/".join((URL_ROOT, "auth", "login"))
|
||||
URL_SCODOC8 = "/".join((URL_ROOT, "index"))
|
||||
URL_HOME = "/".join((URL_ROOT, "ScoDoc", "index"))
|
||||
URL_DEPT = "/".join((URL_ROOT, "ScoDoc", NOM_DPT, "Scolarite", "index_html"))
|
||||
URL_ADMIN = "/".join((URL_ROOT, "ScoDoc", "admin"))
|
||||
|
||||
ACRONYME_FORMATION = "formationtest"
|
||||
URL = URL_SCODOC8
|
||||
|
||||
|
||||
class PythonOrgSearch(unittest.TestCase):
|
||||
@ -36,27 +43,23 @@ class PythonOrgSearch(unittest.TestCase):
|
||||
else:
|
||||
self.driver = webdriver.Chrome()
|
||||
self.wait = WebDriverWait(self.driver, 10)
|
||||
self.driver.get(
|
||||
"https://"
|
||||
+ SCODOC_ADMIN_ID
|
||||
+ ":"
|
||||
+ SCODOC_ADMIN_PASS
|
||||
+ "@"
|
||||
+ BASE_NOT_SECURED_URL
|
||||
+ "force_admin_authentication"
|
||||
)
|
||||
self.driver.get(BASE_URL + "/ScoDoc")
|
||||
auth_page = URL_AUTH
|
||||
self.driver.get(auth_page)
|
||||
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("submit").click()
|
||||
|
||||
# Test Creer une formation
|
||||
# @expected : La formation se trouve dans le tableau de la liste des formations
|
||||
def test_011_create_formation(self):
|
||||
driver = self.driver
|
||||
global URL
|
||||
driver.get(URL)
|
||||
driver = self.driver
|
||||
wait = self.wait
|
||||
driver.get(URL_DEPT)
|
||||
driver.find_element_by_id("link-programmes").click()
|
||||
URL = driver.current_url
|
||||
driver.find_element_by_id("link-create-formation").click()
|
||||
self.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_titre").send_keys("TEST")
|
||||
driver.find_element_by_id("tf_titre_officiel").send_keys("formation de test")
|
||||
@ -72,24 +75,26 @@ class PythonOrgSearch(unittest.TestCase):
|
||||
# @expected : Le nom de la formation est changé sur la page des formations
|
||||
def test_012_change_name_formation(self):
|
||||
driver = self.driver
|
||||
global URL
|
||||
wait = self.wait
|
||||
driver.get(URL)
|
||||
idEditFormation = "edit-formation-" + ACRONYME_FORMATION.replace(" ","-")
|
||||
driver.find_element_by_id(idEditFormation).click()
|
||||
self.wait.until(EC.url_changes(URL))
|
||||
id_edit_formation = "edit-formation-" + ACRONYME_FORMATION.replace(" ", "-")
|
||||
driver.find_element_by_id(id_edit_formation).click()
|
||||
wait.until(EC.url_changes(URL))
|
||||
driver.find_element_by_id("tf_acronyme").send_keys(ACRONYME_FORMATION)
|
||||
driver.find_element_by_id("tf_submit").click()
|
||||
driver.get(URL)
|
||||
formations = driver.find_elements_by_class_name("acronyme")
|
||||
textElementAcronyme = []
|
||||
text_element_acronyme = []
|
||||
for formation in formations:
|
||||
textElementAcronyme.append(formation.text)
|
||||
self.assertTrue(ACRONYME_FORMATION + ACRONYME_FORMATION in textElementAcronyme)
|
||||
text_element_acronyme.append(formation.text)
|
||||
self.assertTrue(
|
||||
ACRONYME_FORMATION + ACRONYME_FORMATION in text_element_acronyme
|
||||
)
|
||||
# Remise du nom à celui de départ
|
||||
driver.get(URL)
|
||||
idEditFormation = "edit-formation-" + ACRONYME_FORMATION + ACRONYME_FORMATION
|
||||
driver.find_element_by_id(idEditFormation).click()
|
||||
self.wait.until(EC.url_changes(URL))
|
||||
id_edit_formation = "edit-formation-" + ACRONYME_FORMATION + ACRONYME_FORMATION
|
||||
driver.find_element_by_id(id_edit_formation).click()
|
||||
wait.until(EC.url_changes(URL))
|
||||
driver.find_element_by_id("tf_acronyme").clear()
|
||||
driver.find_element_by_id("tf_acronyme").send_keys(ACRONYME_FORMATION)
|
||||
driver.find_element_by_id("tf_submit").click()
|
||||
@ -98,10 +103,10 @@ class PythonOrgSearch(unittest.TestCase):
|
||||
# @expected : La formation n'as pas pu être créée et on arrive donc sur un message d'erreur à la création
|
||||
def test_013_same_name_formation(self):
|
||||
driver = self.driver
|
||||
global URL
|
||||
wait = self.wait
|
||||
driver.get(URL)
|
||||
driver.find_element_by_id("link-create-formation").click()
|
||||
self.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_titre").send_keys("TEST")
|
||||
driver.find_element_by_id("tf_titre_officiel").send_keys("formation de test")
|
||||
@ -117,19 +122,19 @@ class PythonOrgSearch(unittest.TestCase):
|
||||
# @Expected : L'UE est créée et elle apparait désormais dans la liste d'UE de la formation
|
||||
def test_014_ajout_UE(self):
|
||||
driver = self.driver
|
||||
global URL
|
||||
wait = self.wait
|
||||
driver.get(URL)
|
||||
idTitre = "titre-" + ACRONYME_FORMATION.replace(" ", "-")
|
||||
driver.find_element_by_id(idTitre).click()
|
||||
self.wait.until(EC.url_changes(URL))
|
||||
id_titre = "titre-" + ACRONYME_FORMATION.lower().replace(" ", "-")
|
||||
driver.find_element_by_id(id_titre).click()
|
||||
wait.until(EC.url_changes(URL))
|
||||
driver.find_element_by_xpath("//a[contains(@href,'ue_create?')]").click()
|
||||
driver.find_element_by_id("tf_titre").send_keys("UE TEST")
|
||||
driver.find_element_by_id("tf_acronyme").send_keys("TEST")
|
||||
driver.find_element_by_id("tf_submit").click()
|
||||
time.sleep(1)
|
||||
driver.get(URL)
|
||||
driver.find_element_by_id(idTitre).click()
|
||||
self.wait.until(EC.url_changes(URL))
|
||||
driver.find_element_by_id(id_titre).click()
|
||||
wait.until(EC.url_changes(URL))
|
||||
self.assertTrue("TEST UE TEST" in driver.page_source)
|
||||
driver.get(URL)
|
||||
|
||||
@ -137,13 +142,13 @@ class PythonOrgSearch(unittest.TestCase):
|
||||
# @Expected : La matière est créée et elle apparait désormais sur la page de détail de la formation
|
||||
def test_015_ajout_matiere(self):
|
||||
driver = self.driver
|
||||
global URL
|
||||
nomMat = "unematieretest"
|
||||
wait = self.wait
|
||||
driver.get(URL)
|
||||
nomMat = "unematieretest"
|
||||
time.sleep(3)
|
||||
idTitre = "titre-" + ACRONYME_FORMATION
|
||||
idTitre = "titre-" + ACRONYME_FORMATION.lower().replace(" ", "-")
|
||||
driver.find_element_by_id(idTitre).click()
|
||||
self.wait.until(EC.url_changes(URL))
|
||||
wait.until(EC.url_changes(URL))
|
||||
time.sleep(3)
|
||||
driver.find_element_by_xpath("//a[contains(@href,'matiere_create?')]").click()
|
||||
driver.find_element_by_id("tf_titre").send_keys(nomMat)
|
||||
@ -153,7 +158,7 @@ class PythonOrgSearch(unittest.TestCase):
|
||||
driver.get(URL)
|
||||
driver.find_element_by_id(idTitre).click()
|
||||
time.sleep(3)
|
||||
self.wait.until(EC.url_changes(URL))
|
||||
wait.until(EC.url_changes(URL))
|
||||
elements = driver.find_elements_by_xpath("//a[contains(@href,'matiere_edit?')]")
|
||||
matIsPresent = False
|
||||
for element in elements:
|
||||
@ -165,17 +170,19 @@ class PythonOrgSearch(unittest.TestCase):
|
||||
# @Expected : Le semestre est créé et il apparait désormais dans la table des formations
|
||||
def test_016_ajout_Semestre(self):
|
||||
driver = self.driver
|
||||
global URL
|
||||
wait = self.wait
|
||||
driver.get(URL)
|
||||
idAddSemestre = "add-semestre-" + ACRONYME_FORMATION.replace(" ", "-")
|
||||
idAddSemestre = "add-semestre-" + ACRONYME_FORMATION.lower().replace(" ", "-")
|
||||
driver.find_element_by_id(idAddSemestre).click()
|
||||
self.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_fin").send_keys("30/06/2021")
|
||||
driver.find_element_by_name("responsable_id").send_keys("BACH Test (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")
|
||||
driver.find_element_by_id("tf_submit").click()
|
||||
self.wait.until(EC.url_changes(URL))
|
||||
wait.until(EC.url_changes(URL))
|
||||
self.assertTrue(
|
||||
"Nouveau semestre créé"
|
||||
in driver.find_element_by_class_name("head_message").text
|
||||
@ -188,62 +195,62 @@ class PythonOrgSearch(unittest.TestCase):
|
||||
# @expected : La formation est dupliquée et à la version "2"
|
||||
def test_017_creer_nouvelle_version_formation(self):
|
||||
driver = self.driver
|
||||
global URL
|
||||
wait = self.wait
|
||||
driver.get(URL)
|
||||
idTitre = "titre-" + ACRONYME_FORMATION
|
||||
driver.find_element_by_id(idTitre).click()
|
||||
self.wait.until(EC.url_changes(URL))
|
||||
wait.until(EC.url_changes(URL))
|
||||
tmpurl = driver.current_url
|
||||
driver.find_element_by_xpath(
|
||||
"//a[contains(@href,'formation_create_new_version?')]"
|
||||
).click()
|
||||
self.wait.until(EC.url_changes(tmpurl))
|
||||
wait.until(EC.url_changes(tmpurl))
|
||||
self.assertTrue("Nouvelle version !" in driver.page_source)
|
||||
driver.get(URL)
|
||||
elements = driver.find_elements_by_class_name("version")
|
||||
versionIsPresent = False
|
||||
version_is_present = False
|
||||
for element in elements:
|
||||
if element.text == "2":
|
||||
versionIsPresent = True
|
||||
self.assertTrue(versionIsPresent)
|
||||
version_is_present = True
|
||||
self.assertTrue(version_is_present)
|
||||
|
||||
# Test : Supprime une formation après avoir supprimé les semestres qui y sont rattachés
|
||||
# @expected : La formation n'apparait plus dans le tableau des formations
|
||||
def test_020_delete_formation(self):
|
||||
driver = self.driver
|
||||
global URL
|
||||
wait = self.wait
|
||||
driver.get(URL)
|
||||
idButtonDelete = "delete-formation-" + ACRONYME_FORMATION
|
||||
driver.find_element_by_id(idButtonDelete).click()
|
||||
self.wait.until(EC.url_changes(URL))
|
||||
tmpURLDelete = driver.current_url
|
||||
listeSemestres = driver.find_elements_by_xpath(
|
||||
id_button_delete = "delete-formation-" + ACRONYME_FORMATION
|
||||
driver.find_element_by_id(id_button_delete).click()
|
||||
wait.until(EC.url_changes(URL))
|
||||
tmp_url_delete = driver.current_url
|
||||
liste_semestres = driver.find_elements_by_xpath(
|
||||
"//a[contains(@href, 'formsemestre_status?')]"
|
||||
)
|
||||
for semestre in listeSemestres:
|
||||
for semestre in liste_semestres:
|
||||
semestre.click()
|
||||
self.wait.until(EC.url_changes(URL))
|
||||
wait.until(EC.url_changes(URL))
|
||||
driver.find_element_by_xpath(
|
||||
"(//a[contains(text(),'Semestre')])[2]"
|
||||
).click()
|
||||
driver.find_element_by_xpath(
|
||||
"//a[contains(@href, 'formsemestre_delete?')]"
|
||||
).click()
|
||||
self.wait.until(EC.url_changes(URL))
|
||||
wait.until(EC.url_changes(URL))
|
||||
driver.find_element_by_id("tf_submit").click()
|
||||
time.sleep(2)
|
||||
driver.find_element_by_xpath("//input[@value='OK']").click()
|
||||
driver.get(tmpURLDelete)
|
||||
driver.get(tmp_url_delete)
|
||||
driver.find_element_by_xpath(
|
||||
"//input[@value='Supprimer cette formation']"
|
||||
).click()
|
||||
driver.get(URL)
|
||||
formations = driver.find_elements_by_class_name("version")
|
||||
formationDelete = True
|
||||
formation_delete = True
|
||||
for formation in formations:
|
||||
if "1" in formation.text:
|
||||
formationDelete = False
|
||||
self.assertTrue(formationDelete)
|
||||
formation_delete = False
|
||||
self.assertTrue(formation_delete)
|
||||
|
||||
# def test_create_module(self):
|
||||
# driver = self.driver
|
||||
@ -258,6 +265,7 @@ if __name__ == "__main__":
|
||||
deleteDepartement.main()
|
||||
createDepartement.main()
|
||||
creationSiteDepartement.main()
|
||||
creationUtilisateurs.main()
|
||||
|
||||
unittest.main(
|
||||
testRunner=HtmlTestRunner.HTMLTestRunner(
|
||||
|
@ -8,14 +8,14 @@ import deleteDepartement
|
||||
from setting import (
|
||||
SCODOC_ADMIN_ID,
|
||||
SCODOC_ADMIN_PASS,
|
||||
BASE_URL,
|
||||
SCHEMA,
|
||||
SCODOC_SERVER,
|
||||
SCODOC_PORT,
|
||||
NOM_DPT,
|
||||
LINK_SCODOC_SERVER,
|
||||
BASE_NOT_SECURED_URL,
|
||||
BASE_SSH_URL,
|
||||
NAVIGATEUR,
|
||||
)
|
||||
import urllib.parse as urlparse
|
||||
from urllib.parse import parse_qs
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
from selenium.webdriver.support import expected_conditions as EC
|
||||
@ -23,7 +23,7 @@ from selenium.common.exceptions import NoSuchElementException
|
||||
from selenium.webdriver.support.ui import Select, WebDriverWait
|
||||
from selenium.webdriver.support.select import Select
|
||||
|
||||
URL = BASE_URL + NOM_DPT + "/Scolarite"
|
||||
URL = SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT + NOM_DPT + "/Scolarite"
|
||||
nomEtu = "Semestre11"
|
||||
prenomEtu = "Etudiant1"
|
||||
nip = "11122234"
|
||||
@ -31,26 +31,31 @@ domicile = "50 rue de la marmite"
|
||||
codepostaldomicile = "59000"
|
||||
paysdomicile = "Lille"
|
||||
|
||||
URL_ROOT = SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT
|
||||
URL_AUTH = "/".join((URL_ROOT, "auth", "login"))
|
||||
URL_SCODOC8 = "/".join((URL_ROOT, "index"))
|
||||
URL_HOME = "/".join((URL_ROOT, "ScoDoc", "index"))
|
||||
URL_DEPT = "/".join((URL_ROOT, "ScoDoc", NOM_DPT, "Scolarite", "index_html"))
|
||||
URL_ADMIN = "/".join((URL_ROOT, "ScoDoc", "admin"))
|
||||
|
||||
ACRONYME_FORMATION = "formationtest"
|
||||
URL = URL_SCODOC8
|
||||
|
||||
class PythonOrgSearch(unittest.TestCase):
|
||||
# Permet de se connecter et se remettre sur la page d'accueil avant chaque test
|
||||
def setUp(self):
|
||||
next_page = ""
|
||||
if NAVIGATEUR == "firefox":
|
||||
self.driver = webdriver.Firefox()
|
||||
else:
|
||||
self.driver = webdriver.Chrome()
|
||||
self.wait = WebDriverWait(self.driver, 10)
|
||||
self.driver.get(
|
||||
"https://"
|
||||
+ SCODOC_ADMIN_ID
|
||||
+ ":"
|
||||
+ SCODOC_ADMIN_PASS
|
||||
+ "@"
|
||||
+ BASE_NOT_SECURED_URL
|
||||
+ "force_admin_authentication"
|
||||
)
|
||||
global URL
|
||||
self.driver.get(URL)
|
||||
auth_page = URL_AUTH + ("?next=" + next_page).replace("/", "%2F")
|
||||
self.driver.get(auth_page)
|
||||
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("submit").click()
|
||||
self.driver.get(URL_HOME)
|
||||
|
||||
# Test : creer un etudiant et verifie si sa fiche etudiante est creee
|
||||
# @expected : A la soumission du formulaire on retrouve la fiche d'information avec le nip (unique) dans la page, on a également un resultat en recherchant l'étudiant
|
||||
@ -134,20 +139,21 @@ class PythonOrgSearch(unittest.TestCase):
|
||||
semestres[0].click()
|
||||
driver.find_element_by_xpath("//input[@value='Inscrire']").click()
|
||||
time.sleep(2)
|
||||
boutonInscrireIsNotPresent = False
|
||||
bouton_inscrire_is_not_present = False
|
||||
try:
|
||||
driver.find_element_by_partial_link_text("inscrire")
|
||||
except:
|
||||
boutonInscrireIsNotPresent = True
|
||||
self.assertTrue(boutonInscrireIsNotPresent)
|
||||
bouton_inscrire_is_not_present = True
|
||||
self.assertTrue(bouton_inscrire_is_not_present)
|
||||
|
||||
# Test Supprime un étudiant
|
||||
# @expected : Lors d'une recherche sur le nom de l'étudiant, aucun résultat apparait
|
||||
def test_05_suppresion_etudiant(self):
|
||||
driver = self.driver
|
||||
urlRecherche = (
|
||||
"https://"
|
||||
+ BASE_NOT_SECURED_URL
|
||||
SCHEMA
|
||||
+ "://"
|
||||
+ SCODOC_SERVER + ":" + SCODOC_PORT
|
||||
+ "ScoDoc/"
|
||||
+ NOM_DPT
|
||||
+ "/Scolarite/search_etud_in_dept"
|
||||
@ -159,8 +165,9 @@ class PythonOrgSearch(unittest.TestCase):
|
||||
time.sleep(1)
|
||||
etudid = driver.find_element_by_id("euid")
|
||||
url = (
|
||||
"https://"
|
||||
+ BASE_NOT_SECURED_URL
|
||||
SCHEMA
|
||||
+ "://"
|
||||
+ SCODOC_SERVER + ":" + SCODOC_PORT
|
||||
+ "ScoDoc/"
|
||||
+ NOM_DPT
|
||||
+ "/Scolarite/etudident_delete?etudid="
|
||||
|
@ -9,10 +9,12 @@ import deleteDepartement
|
||||
from setting import (
|
||||
SCODOC_ADMIN_ID,
|
||||
SCODOC_ADMIN_PASS,
|
||||
BASE_URL,
|
||||
SCHEMA,
|
||||
SCODOC_SERVER,
|
||||
SCODOC_PORT,
|
||||
NOM_DPT,
|
||||
LINK_SCODOC_SERVER,
|
||||
BASE_NOT_SECURED_URL,
|
||||
BASE_SSH_URL,
|
||||
NAVIGATEUR,
|
||||
)
|
||||
from urllib.parse import parse_qs
|
||||
@ -22,7 +24,7 @@ from selenium.webdriver.support import expected_conditions as EC
|
||||
from selenium.webdriver.support.ui import Select, WebDriverWait
|
||||
from selenium.webdriver.support.select import Select
|
||||
|
||||
URL = BASE_URL + NOM_DPT + "/Scolarite"
|
||||
URL = SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT + NOM_DPT + "/Scolarite"
|
||||
NOM_ETU = "Semestre11"
|
||||
PRENOM_ETU = "EtudiantNumero1"
|
||||
dateDebutAbsenceNonJustifiee = "31/05/2021"
|
||||
@ -32,27 +34,22 @@ dateDebutAbsenceJustifiee = "25/05/2021"
|
||||
class PythonOrgSearch(unittest.TestCase):
|
||||
# Permet de se connecter et se remettre sur la page d'accueil avant chaque test
|
||||
def setUp(self):
|
||||
next_page = ""
|
||||
if NAVIGATEUR == "firefox":
|
||||
self.driver = webdriver.Firefox()
|
||||
else:
|
||||
self.driver = webdriver.Chrome()
|
||||
self.wait = WebDriverWait(self.driver, 10)
|
||||
self.driver.get(
|
||||
"https://"
|
||||
+ SCODOC_ADMIN_ID
|
||||
+ ":"
|
||||
+ SCODOC_ADMIN_PASS
|
||||
+ "@"
|
||||
+ BASE_NOT_SECURED_URL
|
||||
+ "force_admin_authentication"
|
||||
)
|
||||
global URL
|
||||
self.driver.get(URL)
|
||||
auth_page = SCHEMA + "://" + BASE_SSH_URL + "auth/login?next=%2F" + next_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("password").send_keys(SCODOC_ADMIN_PASS)
|
||||
self.driver.find_element_by_id("submit").click()
|
||||
self.driver.get(SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT)
|
||||
|
||||
def test_010_trouver_etudiant(self):
|
||||
driver = self.driver
|
||||
global URL
|
||||
self.driver.get(BASE_URL + NOM_DPT + "/Scolarite")
|
||||
self.driver.get(SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT + NOM_DPT + "/Scolarite")
|
||||
element = self.driver.find_element_by_id("in-expnom")
|
||||
element.send_keys(NOM_ETU)
|
||||
element.submit()
|
||||
|
@ -9,7 +9,9 @@ import deleteDepartement
|
||||
from setting import (
|
||||
SCODOC_ADMIN_ID,
|
||||
SCODOC_ADMIN_PASS,
|
||||
BASE_URL,
|
||||
SCHEMA,
|
||||
SCODOC_SERVER,
|
||||
SCODOC_PORT,
|
||||
NOM_DPT,
|
||||
SCODOC_ENS_ID,
|
||||
SCODOC_ENS_PASS,
|
||||
@ -17,7 +19,7 @@ from setting import (
|
||||
SCODOC_CHEF_PASS,
|
||||
NAVIGATEUR,
|
||||
LINK_SCODOC_SERVER,
|
||||
BASE_NOT_SECURED_URL,
|
||||
BASE_SSH_URL,
|
||||
)
|
||||
from urllib.parse import parse_qs
|
||||
from selenium import webdriver
|
||||
@ -29,7 +31,7 @@ from selenium.webdriver.support.select import Select
|
||||
|
||||
URL_MATIERE = ""
|
||||
URL_SEMESTRE = ""
|
||||
URL = BASE_URL + NOM_DPT + "/Scolarite"
|
||||
URL = SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT + NOM_DPT + "/Scolarite"
|
||||
PRENOM_ENS = "Ens"
|
||||
PRENOM_CHEF = "Chef"
|
||||
isAdmin = True
|
||||
@ -39,36 +41,25 @@ isEns = False
|
||||
class PythonOrgSearch(unittest.TestCase):
|
||||
# Permet de se connecter et se remettre sur la page d'accueil avant chaque test
|
||||
def setUp(self):
|
||||
next_page = ""
|
||||
if NAVIGATEUR == "firefox":
|
||||
self.driver = webdriver.Firefox()
|
||||
else:
|
||||
self.driver = webdriver.Chrome()
|
||||
self.wait = WebDriverWait(self.driver, 10)
|
||||
auth_page = SCHEMA + "://" + BASE_SSH_URL + "auth/login?next=%2F" + next_page
|
||||
self.driver.get(auth_page)
|
||||
if isAdmin:
|
||||
self.driver.get(
|
||||
"https://"
|
||||
+ SCODOC_ADMIN_ID
|
||||
+ ":"
|
||||
+ SCODOC_ADMIN_PASS
|
||||
+ "@"
|
||||
+ BASE_NOT_SECURED_URL
|
||||
+ "force_admin_authentication"
|
||||
)
|
||||
else:
|
||||
self.driver.get(BASE_URL + NOM_DPT + "/Scolarite")
|
||||
if isChef:
|
||||
self.driver.find_element_by_name("__ac_name").send_keys(SCODOC_CHEF_ID)
|
||||
self.driver.find_element_by_name("__ac_password").send_keys(
|
||||
SCODOC_CHEF_PASS
|
||||
)
|
||||
time.sleep(3)
|
||||
self.driver.find_element_by_name("submit").click()
|
||||
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)
|
||||
elif isChef:
|
||||
self.driver.find_element_by_id("user_name").send_keys(SCODOC_CHEF_ID)
|
||||
self.driver.find_element_by_id("password").send_keys(SCODOC_CHEF_PASS)
|
||||
elif isEns:
|
||||
self.driver.find_element_by_name("__ac_name").send_keys(SCODOC_ENS_ID)
|
||||
self.driver.find_element_by_name("__ac_password").send_keys(
|
||||
SCODOC_ENS_PASS
|
||||
)
|
||||
self.driver.find_element_by_name("submit").click()
|
||||
self.driver.find_element_by_id("user_name").send_keys(SCODOC_ENS_ID)
|
||||
self.driver.find_element_by_id("password").send_keys(SCODOC_ENS_PASS)
|
||||
self.driver.find_element_by_id("submit").click()
|
||||
self.driver.get(SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT)
|
||||
|
||||
# Test : Vérifie s'il y a un semestre en cours
|
||||
# @expected : La class listesems n'est pas vide et contient "Session en cours"
|
||||
@ -167,17 +158,18 @@ class PythonOrgSearch(unittest.TestCase):
|
||||
driver = self.driver
|
||||
global URL_MATIERE
|
||||
driver.get(
|
||||
"https://"
|
||||
SCHEMA
|
||||
+ "://"
|
||||
+ SCODOC_ADMIN_ID
|
||||
+ ":"
|
||||
+ SCODOC_ADMIN_PASS
|
||||
+ "@"
|
||||
+ BASE_NOT_SECURED_URL
|
||||
+ BASE_SSH_URL
|
||||
+ "force_admin_authentication"
|
||||
)
|
||||
# driver.get(BASE_URL)
|
||||
# driver.get(SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT)
|
||||
# driver.find_element_by_link_text("déconnecter").click()
|
||||
# driver.get(BASE_URL)
|
||||
# driver.get(SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT)
|
||||
# driver.find_element_by_id("name").send_keys(SCODOC_CHEF_ID)
|
||||
# driver.find_element_by_id("password").send_keys(SCODOC_CHEF_PASS)
|
||||
# driver.find_element_by_id("submit").click()
|
||||
@ -356,15 +348,16 @@ if __name__ == "__main__":
|
||||
process.wait()
|
||||
time.sleep(5)
|
||||
driver.get(
|
||||
"https://"
|
||||
SCHEMA
|
||||
+ "://"
|
||||
+ SCODOC_ADMIN_ID
|
||||
+ ":"
|
||||
+ SCODOC_ADMIN_PASS
|
||||
+ "@"
|
||||
+ BASE_NOT_SECURED_URL
|
||||
+ BASE_SSH_URL
|
||||
+ "force_admin_authentication"
|
||||
)
|
||||
driver.get(BASE_URL + NOM_DPT + "/Scolarite")
|
||||
driver.get(SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT + NOM_DPT + "/Scolarite")
|
||||
driver.find_element_by_id("link-view-users").click()
|
||||
time.sleep(5)
|
||||
noms = driver.find_elements_by_class_name("nom_fmt")
|
||||
|
@ -9,8 +9,10 @@ import deleteDepartement
|
||||
from setting import (
|
||||
SCODOC_ADMIN_ID,
|
||||
SCODOC_ADMIN_PASS,
|
||||
BASE_URL,
|
||||
BASE_NOT_SECURED_URL,
|
||||
SCHEMA,
|
||||
SCODOC_SERVER,
|
||||
SCODOC_PORT,
|
||||
BASE_SSH_URL,
|
||||
LINK_SCODOC_SERVER,
|
||||
NOM_DPT,
|
||||
SCODOC_ENS_ID,
|
||||
@ -43,15 +45,16 @@ class PythonOrgSearch(unittest.TestCase):
|
||||
self.driver = webdriver.Firefox()
|
||||
elif NAVIGATEUR == "chrome":
|
||||
self.driver = webdriver.Chrome()
|
||||
self.url = BASE_URL + NOM_DPT + "/Scolarite"
|
||||
self.url = SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT + NOM_DPT + "/Scolarite"
|
||||
self.wait = WebDriverWait(self.driver, 10)
|
||||
self.driver.get(
|
||||
"https://"
|
||||
SCHEMA
|
||||
+ "://"
|
||||
+ SCODOC_ADMIN_ID
|
||||
+ ":"
|
||||
+ SCODOC_ADMIN_PASS
|
||||
+ "@"
|
||||
+ BASE_NOT_SECURED_URL
|
||||
+ BASE_SSH_URL
|
||||
+ "force_admin_authentication"
|
||||
)
|
||||
|
||||
|
@ -9,8 +9,10 @@ import deleteDepartement
|
||||
from setting import (
|
||||
SCODOC_ADMIN_ID,
|
||||
SCODOC_ADMIN_PASS,
|
||||
BASE_URL,
|
||||
BASE_NOT_SECURED_URL,
|
||||
SCHEMA,
|
||||
SCODOC_SERVER,
|
||||
SCODOC_PORT,
|
||||
BASE_SSH_URL,
|
||||
LINK_SCODOC_SERVER,
|
||||
NOM_DPT,
|
||||
SCODOC_ENS_ID,
|
||||
@ -39,15 +41,16 @@ class PythonOrgSearch(unittest.TestCase):
|
||||
self.driver = webdriver.Firefox()
|
||||
elif NAVIGATEUR == "chrome":
|
||||
self.driver = webdriver.Chrome()
|
||||
self.url = BASE_URL + NOM_DPT + "/Scolarite"
|
||||
self.url = SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT + NOM_DPT + "/Scolarite"
|
||||
self.wait = WebDriverWait(self.driver, 10)
|
||||
self.driver.get(
|
||||
"https://"
|
||||
SCHEMA
|
||||
+ "://"
|
||||
+ SCODOC_ADMIN_ID
|
||||
+ ":"
|
||||
+ SCODOC_ADMIN_PASS
|
||||
+ "@"
|
||||
+ BASE_NOT_SECURED_URL
|
||||
+ BASE_SSH_URL
|
||||
+ "force_admin_authentication"
|
||||
)
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
@ -6,10 +6,12 @@ import HtmlTestRunner
|
||||
from setting import (
|
||||
SCODOC_ADMIN_ID,
|
||||
SCODOC_ADMIN_PASS,
|
||||
BASE_URL,
|
||||
SCHEMA,
|
||||
SCODOC_SERVER,
|
||||
SCODOC_PORT,
|
||||
NOM_DPT,
|
||||
LINK_SCODOC_SERVER,
|
||||
BASE_NOT_SECURED_URL,
|
||||
BASE_SSH_URL,
|
||||
NAVIGATEUR,
|
||||
)
|
||||
from selenium import webdriver
|
||||
@ -20,26 +22,26 @@ from selenium.webdriver.common.keys import Keys
|
||||
from selenium.webdriver.support.ui import Select
|
||||
from selenium.webdriver.support.select import Select
|
||||
|
||||
URL = BASE_URL + NOM_DPT + "/Scolarite"
|
||||
URL_ROOT = SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT
|
||||
URL_AUTH = "/".join((URL_ROOT, "auth", "login"))
|
||||
URL_SCODOC8 = "/".join((URL_ROOT, "index"))
|
||||
URL_HOME = "/".join((URL_ROOT, "ScoDoc", "index"))
|
||||
URL_DEPT = "/".join((URL_ROOT, "ScoDoc", NOM_DPT, "Scolarite", "index_html"))
|
||||
URL_ADMIN = "/".join((URL_ROOT, "ScoDoc", "admin"))
|
||||
|
||||
ACRONYME_FORMATION = "FormationTEST"
|
||||
|
||||
|
||||
def main():
|
||||
next_page = URL_HOME
|
||||
if NAVIGATEUR == "firefox":
|
||||
driver = webdriver.Firefox()
|
||||
else:
|
||||
driver = webdriver.Chrome()
|
||||
driver.get(
|
||||
"https://"
|
||||
+ SCODOC_ADMIN_ID
|
||||
+ ":"
|
||||
+ SCODOC_ADMIN_PASS
|
||||
+ "@"
|
||||
+ BASE_NOT_SECURED_URL
|
||||
+ "force_admin_authentication"
|
||||
)
|
||||
driver.get(BASE_URL + "scodoc_admin")
|
||||
auth_page = URL_AUTH + ("?next=" + next_page).replace("/", "%2F")
|
||||
driver.get(auth_page)
|
||||
driver.find_element_by_id("user_name").send_keys(SCODOC_ADMIN_ID)
|
||||
driver.find_element_by_id("password").send_keys(SCODOC_ADMIN_PASS)
|
||||
driver.find_element_by_id("submit").click()
|
||||
time.sleep(2)
|
||||
try:
|
||||
select = Select(driver.find_element_by_id("create-dept"))
|
||||
|
8
importFormationXml.py
Normal file
8
importFormationXml.py
Normal file
@ -0,0 +1,8 @@
|
||||
import subprocess
|
||||
from setting import LINK_SCODOC_SERVER, NOM_DPT
|
||||
|
||||
|
||||
def main():
|
||||
cmdProcess = ["./scriptImportFormation.sh", LINK_SCODOC_SERVER, NOM_DPT]
|
||||
process = subprocess.Popen(cmdProcess)
|
||||
process.wait()
|
18
readme.md
18
readme.md
@ -20,7 +20,18 @@ ou alternativement avec
|
||||
Un modèle de .env est fourni dans ce projet, pour que les tests soient fonctionnel vous devez le remplir et le renommer en .env. Ce dernier servira à remplir différentes informations spécifiques concernant votre environnement Scodoc. Nous allons le voir ici en détail
|
||||
#### .env
|
||||
|
||||
>BASE_URL = "https://scodoc-dev-iutinfo.univ-lille.fr/ScoDoc/"
|
||||
SCHEMA="http"
|
||||
BASE_URL = "scodoc_server:5000"
|
||||
NOM_DPT = "TEST01"
|
||||
SCODOC_ADMIN_ID = "admin_id"
|
||||
SCODOC_ADMIN_PASS = "admin_password"
|
||||
SCODOC_ENS_ID = "enseignant_id"
|
||||
SCODOC_ENS_PASS = "enseignant_password@10"
|
||||
SCODOC_CHEF_ID = "chef_id"
|
||||
SCODOC_CHEF_PASS = "p@ssword42@"
|
||||
LINK_SCODOC_SERVER = "scodoc_server"
|
||||
BASE_SSH_URL = "scodoc_server:5000/"
|
||||
NAVIGATEUR = "firefox"
|
||||
|
||||
Ici sera le lien vers la page d'accueil de votre Scodoc
|
||||
|
||||
@ -56,7 +67,7 @@ Le mot de passe de l'utilisateur précédent, si l'utilisateur précédent n'exi
|
||||
|
||||
Le lien vers votre serveur Scodoc, ce dernier servira à lancer des scripts de mise en place sur le serveur. Veillez donc à avoir une connexion avec les droits root sur votre serveur, de préférences avec échange de clef ssh.
|
||||
|
||||
>BASE_NOT_SECURED_URL = "scodoc-dev-iutinfo.univ-lille.fr/"
|
||||
>BASE_SSH_URL = "scodoc-dev-iutinfo.univ-lille.fr/"
|
||||
|
||||
Le lien vers la page de choix de département, avec le format précisé.
|
||||
|
||||
@ -98,5 +109,4 @@ Vous y retrouverez les liens menant au détails de chaque rapport ainsi qu'un r
|
||||
|
||||
* pip install HtmlTestRunner-Python3
|
||||
|
||||
* Créer un utilisateur Nom:BACH Prenom:Test User:Bach
|
||||
|
||||
* Créer un utilisateur Nom:BACH Prenom:Test User:Bach TODO: utiliser enseignant_id à la place
|
||||
|
@ -6,6 +6,7 @@ then
|
||||
exit 2
|
||||
fi
|
||||
ssh $1 /bin/bash<< EOF
|
||||
cd /opt/scodoc/Products/ScoDoc/config
|
||||
./create_dept.sh -n ${2}
|
||||
cd /opt/scodoc
|
||||
. venv/bin/activate
|
||||
flask create-dept $2
|
||||
EOF
|
12
scriptCreationUtilisateurs.sh
Executable file
12
scriptCreationUtilisateurs.sh
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
#Ce script se charge de se connecter au serveur scodoc et créer les enseignants requis pour le département donné en paramètre
|
||||
if [ "$#" -ne 2 ];
|
||||
then
|
||||
echo "Pas assez d'arguments"
|
||||
exit 2
|
||||
fi
|
||||
ssh $1 /bin/bash<< EOF
|
||||
cd /opt/scodoc
|
||||
source venv/bin/activate
|
||||
flask user-create -n BACH -p Jean-Sebastien Bach Ens $2
|
||||
EOF
|
@ -6,7 +6,8 @@ then
|
||||
exit 2
|
||||
fi
|
||||
ssh $1 /bin/bash<< EOF
|
||||
cd /opt/scodoc/Products/ScoDoc/config
|
||||
./delete_dept.sh -n ${2}
|
||||
cd /opt/scodoc
|
||||
. venv/bin/activate
|
||||
flask delete-dept ${2}
|
||||
y
|
||||
EOF
|
||||
ssh $1 'systemctl restart scodoc'
|
||||
|
@ -6,7 +6,7 @@ then
|
||||
exit 2
|
||||
fi
|
||||
ssh $1 /bin/bash<< EOF
|
||||
cd /opt/scodoc/Products/ScoDoc/
|
||||
cd /opt/scodoc/
|
||||
scotests/scointeractive.sh -r ${2} scotests/${3}
|
||||
EOF
|
||||
ssh $1 'systemctl restart scodoc'
|
||||
# ssh $1 'systemctl restart scodoc'
|
||||
|
12
scriptImportFormation.sh
Executable file
12
scriptImportFormation.sh
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
#Ce script se charge de se connecter au serveur scodoc et créer les enseignants requis pour le département donné en paramètre
|
||||
if [ "$#" -ne 2 ];
|
||||
then
|
||||
echo "Pas assez d'arguments"
|
||||
exit 2
|
||||
fi
|
||||
ssh scodoc@$1 /bin/bash<< EOF
|
||||
cd /opt/scodoc
|
||||
source venv/bin/activate
|
||||
flask import-xml tests/scenario/export_formation1.xml $2
|
||||
EOF
|
@ -5,7 +5,9 @@ from dotenv import load_dotenv
|
||||
dotenv_path = join(dirname(__file__), ".env")
|
||||
load_dotenv(dotenv_path)
|
||||
|
||||
BASE_URL = os.environ.get("BASE_URL")
|
||||
SCHEMA = os.environ.get("SCHEMA")
|
||||
SCODOC_SERVER = os.environ.get("SCODOC_SERVER")
|
||||
SCODOC_PORT = os.environ.get("SCODOC_PORT")
|
||||
NOM_DPT = os.environ.get("NOM_DPT")
|
||||
SCODOC_ADMIN_ID = os.environ.get("SCODOC_ADMIN_ID")
|
||||
SCODOC_ADMIN_PASS = os.environ.get("SCODOC_ADMIN_PASS")
|
||||
@ -14,5 +16,5 @@ SCODOC_ENS_PASS = os.environ.get("SCODOC_ENS_PASS")
|
||||
SCODOC_CHEF_ID = os.environ.get("SCODOC_CHEF_ID")
|
||||
SCODOC_CHEF_PASS = os.environ.get("SCODOC_CHEF_PASS")
|
||||
LINK_SCODOC_SERVER = os.environ.get("LINK_SCODOC_SERVER")
|
||||
BASE_NOT_SECURED_URL = os.environ.get("BASE_NOT_SECURED_URL")
|
||||
BASE_SSH_URL = os.environ.get("BASE_SSH_URL")
|
||||
NAVIGATEUR = os.environ.get("NAVIGATEUR")
|
@ -1,26 +1,18 @@
|
||||
# coding: utf8
|
||||
import unittest
|
||||
import time
|
||||
import subprocess
|
||||
import HtmlTestRunner
|
||||
from setting import (
|
||||
SCODOC_ADMIN_ID,
|
||||
SCODOC_ADMIN_PASS,
|
||||
BASE_URL,
|
||||
SCHEMA,
|
||||
SCODOC_SERVER,
|
||||
SCODOC_PORT,
|
||||
NOM_DPT,
|
||||
LINK_SCODOC_SERVER,
|
||||
BASE_NOT_SECURED_URL,
|
||||
BASE_SSH_URL,
|
||||
NAVIGATEUR,
|
||||
)
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.support import expected_conditions as EC
|
||||
from selenium.webdriver.support.ui import Select, WebDriverWait
|
||||
from selenium.common.exceptions import NoSuchElementException
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
from selenium.webdriver.support.ui import Select
|
||||
from selenium.webdriver.support.select import Select
|
||||
|
||||
URL = BASE_URL + NOM_DPT + "/Scolarite"
|
||||
URL = SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT + NOM_DPT + "/Scolarite"
|
||||
|
||||
ACRONYME_FORMATION = "FormationTEST"
|
||||
|
||||
@ -30,21 +22,17 @@ def main():
|
||||
driver = webdriver.Firefox()
|
||||
else:
|
||||
driver = webdriver.Chrome()
|
||||
driver.get(
|
||||
"https://"
|
||||
+ SCODOC_ADMIN_ID
|
||||
+ ":"
|
||||
+ SCODOC_ADMIN_PASS
|
||||
+ "@"
|
||||
+ BASE_NOT_SECURED_URL
|
||||
+ "force_admin_authentication"
|
||||
)
|
||||
driver.get(BASE_URL + "scodoc_admin")
|
||||
time.sleep(2)
|
||||
try:
|
||||
select = Select(driver.find_element_by_id("delete-dept"))
|
||||
select.select_by_visible_text(NOM_DPT)
|
||||
driver.find_element_by_id("delete-dept").submit()
|
||||
driver.close()
|
||||
except NoSuchElementException:
|
||||
auth_page = URL_AUTH + ("?next=" + URL_HOME).replace("/", "%2F")
|
||||
driver.get(auth_page)
|
||||
driver.find_element_by_id("user_name").send_keys(SCODOC_ADMIN_ID)
|
||||
driver.find_element_by_id("password").send_keys(SCODOC_ADMIN_PASS)
|
||||
driver.find_element_by_id("submit").click()
|
||||
# driver.get(SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT + "scodoc_admin")
|
||||
# time.sleep(2)
|
||||
# try:
|
||||
# select = Select(driver.find_element_by_id("delete-dept"))
|
||||
# select.select_by_visible_text(NOM_DPT)
|
||||
# driver.find_element_by_id("delete-dept").submit()
|
||||
# driver.close()
|
||||
# except NoSuchElementException:
|
||||
driver.close()
|
Loading…
Reference in New Issue
Block a user