update authentification for ScoDoc8

This commit is contained in:
Jean-Marie Place 2021-08-07 09:34:14 +02:00
parent d865041ec5
commit d3d6b01931
4 changed files with 25 additions and 37 deletions

View File

@ -38,10 +38,10 @@ class PythonOrgSearch(unittest.TestCase):
else: else:
self.driver = webdriver.Chrome() self.driver = webdriver.Chrome()
auth_page = SCHEMA + "://" + BASE_SSH_URL + "auth/login?next=%2F" + next_page auth_page = SCHEMA + "://" + BASE_SSH_URL + "auth/login?next=%2F" + next_page
driver.get(auth_page) self.driver.get(auth_page)
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)
driver.find_element_by_id("password").send_keys(SCODOC_ADMIN_PASS) self.driver.find_element_by_id("password").send_keys(SCODOC_ADMIN_PASS)
driver.find_element_by_id("submit").click() self.driver.find_element_by_id("submit").click()
self.driver.get(SCHEMA + "://" + BASE_URL) self.driver.get(SCHEMA + "://" + BASE_URL)
# Test Creer une formation # Test Creer une formation

View File

@ -42,10 +42,10 @@ class PythonOrgSearch(unittest.TestCase):
else: else:
self.driver = webdriver.Chrome() self.driver = webdriver.Chrome()
auth_page = SCHEMA + "://" + BASE_SSH_URL + "auth/login?next=%2F" + next_page auth_page = SCHEMA + "://" + BASE_SSH_URL + "auth/login?next=%2F" + next_page
driver.get(auth_page) self.driver.get(auth_page)
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)
driver.find_element_by_id("password").send_keys(SCODOC_ADMIN_PASS) self.driver.find_element_by_id("password").send_keys(SCODOC_ADMIN_PASS)
driver.find_element_by_id("submit").click() self.driver.find_element_by_id("submit").click()
self.driver.get(SCHEMA + "://" + BASE_URL) self.driver.get(SCHEMA + "://" + BASE_URL)
# Test : creer un etudiant et verifie si sa fiche etudiante est creee # Test : creer un etudiant et verifie si sa fiche etudiante est creee

View File

@ -39,10 +39,10 @@ class PythonOrgSearch(unittest.TestCase):
else: else:
self.driver = webdriver.Chrome() self.driver = webdriver.Chrome()
auth_page = SCHEMA + "://" + BASE_SSH_URL + "auth/login?next=%2F" + next_page auth_page = SCHEMA + "://" + BASE_SSH_URL + "auth/login?next=%2F" + next_page
driver.get(auth_page) self.driver.get(auth_page)
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)
driver.find_element_by_id("password").send_keys(SCODOC_ADMIN_PASS) self.driver.find_element_by_id("password").send_keys(SCODOC_ADMIN_PASS)
driver.find_element_by_id("submit").click() self.driver.find_element_by_id("submit").click()
self.driver.get(SCHEMA + "://" + BASE_URL) self.driver.get(SCHEMA + "://" + BASE_URL)
def test_010_trouver_etudiant(self): def test_010_trouver_etudiant(self):

View File

@ -40,37 +40,25 @@ isEns = False
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):
next_page = ""
if NAVIGATEUR == "firefox": if NAVIGATEUR == "firefox":
self.driver = webdriver.Firefox() self.driver = webdriver.Firefox()
else: else:
self.driver = webdriver.Chrome() self.driver = webdriver.Chrome()
self.wait = WebDriverWait(self.driver, 10) 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: if isAdmin:
self.driver.get( self.driver.find_element_by_id("user_name").send_keys(SCODOC_ADMIN_ID)
SCHEMA self.driver.find_element_by_id("password").send_keys(SCODOC_ADMIN_PASS)
+ "://" elif isChef:
+ SCODOC_ADMIN_ID 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)
+ SCODOC_ADMIN_PASS
+ "@"
+ BASE_SSH_URL
+ "force_admin_authentication"
)
else:
self.driver.get(SCHEMA + "://" + 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()
elif isEns: elif isEns:
self.driver.find_element_by_name("__ac_name").send_keys(SCODOC_ENS_ID) self.driver.find_element_by_id("user_name").send_keys(SCODOC_ENS_ID)
self.driver.find_element_by_name("__ac_password").send_keys( self.driver.find_element_by_id("password").send_keys(SCODOC_ENS_PASS)
SCODOC_ENS_PASS self.driver.find_element_by_id("submit").click()
) self.driver.get(SCHEMA + "://" + BASE_URL)
self.driver.find_element_by_name("submit").click()
# Test : Vérifie s'il y a un semestre en cours # Test : Vérifie s'il y a un semestre en cours
# @expected : La class listesems n'est pas vide et contient "Session en cours" # @expected : La class listesems n'est pas vide et contient "Session en cours"