ajout role de connexion
This commit is contained in:
parent
92f7bda362
commit
43a1d4b327
@ -27,6 +27,9 @@ URL_MATIERE = ""
|
|||||||
URL_SEMESTRE = ""
|
URL_SEMESTRE = ""
|
||||||
URL = BASE_URL + NOM_DPT + "/Scolarite"
|
URL = BASE_URL + NOM_DPT + "/Scolarite"
|
||||||
PRENOM_ENS = "Ens"
|
PRENOM_ENS = "Ens"
|
||||||
|
isAdmin = True
|
||||||
|
isChef = False
|
||||||
|
isEns = False
|
||||||
# Prérequis
|
# Prérequis
|
||||||
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
|
||||||
@ -36,16 +39,26 @@ 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)
|
||||||
self.driver.get(
|
if isAdmin:
|
||||||
"https://"
|
self.driver.get(
|
||||||
+ SCODOC_ADMIN_ID
|
"https://"
|
||||||
+ ":"
|
+ SCODOC_ADMIN_ID
|
||||||
+ SCODOC_ADMIN_PASS
|
+ ":"
|
||||||
+ "@"
|
+ SCODOC_ADMIN_PASS
|
||||||
+ BASE_NOT_SECURED_URL
|
+ "@"
|
||||||
+ "force_admin_authentication"
|
+ BASE_NOT_SECURED_URL
|
||||||
)
|
+ "force_admin_authentication"
|
||||||
self.wait = WebDriverWait(self.driver, 10)
|
)
|
||||||
|
else:
|
||||||
|
self.driver.get(BASE_URL + NOM_DPT + "/Scolarite")
|
||||||
|
if isChef:
|
||||||
|
driver.find_element_by_name("__ac_name").send_keys(SCODOC_CHEF_ID)
|
||||||
|
driver.find_element_by_naùe("__ac_password").send_keys(SCODOC_CHEF_PASS)
|
||||||
|
driver.find_element_by_id("submit").click()
|
||||||
|
elif isEns:
|
||||||
|
driver.find_element_by_name("__ac_name").send_keys(SCODOC_ENS_ID)
|
||||||
|
driver.find_element_by_naùe("__ac_password").send_keys(SCODOC_ENS_PASS)
|
||||||
|
driver.find_element_by_id("submit").click()
|
||||||
# self.driver.get(self.url)
|
# self.driver.get(self.url)
|
||||||
# self.driver.find_element_by_id("name").send_keys(SCODOC_ENS_ID)
|
# self.driver.find_element_by_id("name").send_keys(SCODOC_ENS_ID)
|
||||||
# self.driver.find_element_by_id("password").send_keys(SCODOC_ENS_PASS)
|
# self.driver.find_element_by_id("password").send_keys(SCODOC_ENS_PASS)
|
||||||
@ -104,14 +117,11 @@ class PythonOrgSearch(unittest.TestCase):
|
|||||||
+ SCODOC_ENS_ID.lower()
|
+ SCODOC_ENS_ID.lower()
|
||||||
+ ")"
|
+ ")"
|
||||||
)
|
)
|
||||||
print(constructIDEns)
|
|
||||||
driver.find_element_by_id("ens_id").send_keys(constructIDEns)
|
driver.find_element_by_id("ens_id").send_keys(constructIDEns)
|
||||||
time.sleep(5)
|
|
||||||
|
|
||||||
driver.find_element_by_id("tf_submit").click()
|
driver.find_element_by_id("tf_submit").click()
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
driver.get(URL_MATIERE)
|
driver.get(URL_MATIERE)
|
||||||
self.assertTrue("Enseignants du" in driver.page_source)
|
# self.assertTrue("Enseignants du" in driver.page_source)
|
||||||
self.assertTrue(SCODOC_ENS_ID in driver.page_source)
|
self.assertTrue(SCODOC_ENS_ID in driver.page_source)
|
||||||
|
|
||||||
# Test : Création d'une interrogation en tant que chef des études
|
# Test : Création d'une interrogation en tant que chef des études
|
||||||
@ -142,6 +152,10 @@ class PythonOrgSearch(unittest.TestCase):
|
|||||||
driver.find_element_by_id("tf_coefficient").send_keys("2")
|
driver.find_element_by_id("tf_coefficient").send_keys("2")
|
||||||
driver.find_element_by_id("tf_submit").click()
|
driver.find_element_by_id("tf_submit").click()
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
global isAdmin
|
||||||
|
isAdmin = False
|
||||||
|
global isEns
|
||||||
|
isEns = True
|
||||||
self.assertTrue(descriptionInterrogation in driver.page_source)
|
self.assertTrue(descriptionInterrogation in driver.page_source)
|
||||||
|
|
||||||
# Test Vérifie si une interrogation existe sur un module
|
# Test Vérifie si une interrogation existe sur un module
|
||||||
@ -161,8 +175,6 @@ class PythonOrgSearch(unittest.TestCase):
|
|||||||
driver = self.driver
|
driver = self.driver
|
||||||
global URL_MATIERE
|
global URL_MATIERE
|
||||||
driver.get(URL_MATIERE)
|
driver.get(URL_MATIERE)
|
||||||
print(URL_MATIERE)
|
|
||||||
time.sleep(10)
|
|
||||||
driver.find_element_by_class_name("notes_img").click()
|
driver.find_element_by_class_name("notes_img").click()
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
element = driver.find_element_by_class_name("note")
|
element = driver.find_element_by_class_name("note")
|
||||||
@ -186,14 +198,10 @@ class PythonOrgSearch(unittest.TestCase):
|
|||||||
if element.get_attribute("value") == "":
|
if element.get_attribute("value") == "":
|
||||||
element.send_keys(15)
|
element.send_keys(15)
|
||||||
driver.find_element_by_id("formnotes_submit").click()
|
driver.find_element_by_id("formnotes_submit").click()
|
||||||
driver.get(
|
driver.find_element_by_id("in-expnom").sendKeys("SEMESTRE47")
|
||||||
"https://scodoc-dev-iutinfo.univ-lille.fr/ScoDoc/AurelienUS/Scolarite/search_etud_in_dept"
|
|
||||||
)
|
|
||||||
element = driver.find_element_by_name("expnom")
|
|
||||||
element.send_keys("UneEtudianteEnS4")
|
|
||||||
element.submit()
|
element.submit()
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
self.assertTrue("12" in driver.find_element_by_class_name("ue").text)
|
self.assertTrue("12" in driver.find_element_by_id("rcp_moy").text)
|
||||||
|
|
||||||
# Test : Suppresion des notes pour tout les étudiants concernés dans une interrogation
|
# Test : Suppresion des notes pour tout les étudiants concernés dans une interrogation
|
||||||
# @expected : La moyenne ne s'affiche plus, "afficher" disparait de la page d'information de l'interrogation
|
# @expected : La moyenne ne s'affiche plus, "afficher" disparait de la page d'information de l'interrogation
|
||||||
@ -219,15 +227,9 @@ class PythonOrgSearch(unittest.TestCase):
|
|||||||
# Test : SUppression d'une interrogation par le chef des études
|
# Test : SUppression d'une interrogation par le chef des études
|
||||||
# @expected : L'interrogation n'apparait plus sur le module, les notes sont supprimées également
|
# @expected : L'interrogation n'apparait plus sur le module, les notes sont supprimées également
|
||||||
def test_090_suppresion_interrogation(self):
|
def test_090_suppresion_interrogation(self):
|
||||||
|
global URL_MATIERE
|
||||||
descriptionInterrogation = "Interrogation à supprimer"
|
descriptionInterrogation = "Interrogation à supprimer"
|
||||||
driver = self.driver
|
driver = self.driver
|
||||||
driver.get(BASE_URL)
|
|
||||||
driver.find_element_by_link_text("déconnecter").click()
|
|
||||||
driver.get(BASE_URL)
|
|
||||||
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()
|
|
||||||
global URL_MATIERE
|
|
||||||
driver.get(URL_MATIERE)
|
driver.get(URL_MATIERE)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
driver.find_element_by_link_text("Créer nouvelle évaluation").click()
|
driver.find_element_by_link_text("Créer nouvelle évaluation").click()
|
||||||
@ -240,19 +242,16 @@ class PythonOrgSearch(unittest.TestCase):
|
|||||||
driver.find_element_by_class_name("delete_img").click()
|
driver.find_element_by_class_name("delete_img").click()
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
driver.find_element_by_id("tf_submit").click()
|
driver.find_element_by_id("tf_submit").click()
|
||||||
|
global isAdmin
|
||||||
|
isAdmin = True
|
||||||
|
global isEns
|
||||||
|
isEns = False
|
||||||
self.assertFalse(descriptionInterrogation in driver.page_source)
|
self.assertFalse(descriptionInterrogation in driver.page_source)
|
||||||
|
|
||||||
# Test : Suppression d'un enseignant responsable d'un module
|
# Test : Suppression d'un enseignant responsable d'un module
|
||||||
# @expected : L'enseignant n'apparait plus comme responsable dans ce module
|
# @expected : L'enseignant n'apparait plus comme responsable dans ce module
|
||||||
def test_200_suppression_enseignant_sur_module(self):
|
def test_200_suppression_enseignant_sur_module(self):
|
||||||
driver = self.driver
|
driver = self.driver
|
||||||
self.driver.get(
|
|
||||||
"https://"
|
|
||||||
+ SCODOC_ADMIN_ID
|
|
||||||
+ ":"
|
|
||||||
+ SCODOC_ADMIN_PASS
|
|
||||||
+ "@scodoc-dev-iutinfo.univ-lille.fr/force_admin_authentication"
|
|
||||||
)
|
|
||||||
driver.get(URL_MATIERE)
|
driver.get(URL_MATIERE)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
driver.find_element_by_partial_link_text("modifier les enseignants").click()
|
driver.find_element_by_partial_link_text("modifier les enseignants").click()
|
||||||
@ -262,20 +261,13 @@ class PythonOrgSearch(unittest.TestCase):
|
|||||||
element.click()
|
element.click()
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
driver.get(URL_MATIERE)
|
||||||
self.assertTrue(SCODOC_ENS_ID not in driver.page_source)
|
self.assertTrue(SCODOC_ENS_ID not in driver.page_source)
|
||||||
|
|
||||||
# Test : Suppresion du reste des interrogations sans notes
|
# Test : Suppresion du reste des interrogations sans notes
|
||||||
# @expected Tout les interrogation sans notes sont supprimées
|
# @expected Tout les interrogation sans notes sont supprimées
|
||||||
def test_910_suppresion_interrogation_restante(self):
|
def test_910_suppresion_interrogation_restante(self):
|
||||||
driver = self.driver
|
driver = self.driver
|
||||||
self.driver.get(
|
|
||||||
"https://"
|
|
||||||
+ SCODOC_ADMIN_ID
|
|
||||||
+ ":"
|
|
||||||
+ SCODOC_ADMIN_PASS
|
|
||||||
+ "@scodoc-dev-iutinfo.univ-lille.fr/force_admin_authentication"
|
|
||||||
)
|
|
||||||
|
|
||||||
driver.get(URL_MATIERE)
|
driver.get(URL_MATIERE)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
elements = driver.find_elements_by_class_name("delete_img")
|
elements = driver.find_elements_by_class_name("delete_img")
|
||||||
|
Loading…
Reference in New Issue
Block a user