add http schema to settings

This commit is contained in:
Jean-Marie Place 2021-07-24 08:41:26 +02:00
parent 23def285c5
commit 53fb0159ce
14 changed files with 87 additions and 60 deletions

View File

@ -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"

View File

@ -10,10 +10,11 @@ import suppressionSiteDepartement
from setting import (
SCODOC_ADMIN_ID,
SCODOC_ADMIN_PASS,
SCHEMA,
BASE_URL,
NOM_DPT,
LINK_SCODOC_SERVER,
BASE_NOT_SECURED_URL,
BASE_SSH_URL,
NAVIGATEUR,
)
from selenium import webdriver
@ -30,15 +31,15 @@ class PythonOrgSearch(unittest.TestCase):
else:
self.driver = webdriver.Chrome()
self.driver.get(
"https://"
SCHEMA + "://"
+ SCODOC_ADMIN_ID
+ ":"
+ SCODOC_ADMIN_PASS
+ "@"
+ BASE_NOT_SECURED_URL
+ BASE_SSH_URL
+ "force_admin_authentication"
)
self.driver.get(BASE_URL)
self.driver.get(SCHEMA + "://" + BASE_URL)
# Test : Verification de la connexion admin effective
# @expected : "Bonjour admin" est présent sur la page d'accueil
@ -50,25 +51,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 + "://" + BASE_URL + "/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(SCHEMA + "://" + BASE_URL)
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 + "://" + BASE_URL + "/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 + "://" + BASE_URL)
self.assertTrue(NOM_DPT not in driver.page_source)
# ferme la fenetre à chaque fin de test

View File

@ -9,10 +9,11 @@ import deleteDepartement
from setting import (
SCODOC_ADMIN_ID,
SCODOC_ADMIN_PASS,
SCHEMA,
BASE_URL,
NOM_DPT,
LINK_SCODOC_SERVER,
BASE_NOT_SECURED_URL,
BASE_SSH_URL,
NAVIGATEUR,
)
from selenium import webdriver
@ -23,7 +24,7 @@ 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 + "://" + BASE_URL + NOM_DPT + "/Scolarite"
ACRONYME_FORMATION = "formationtest"
@ -37,15 +38,16 @@ class PythonOrgSearch(unittest.TestCase):
self.driver = webdriver.Chrome()
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"
)
self.driver.get(BASE_URL + "/ScoDoc")
self.driver.get(SCHEMA + "://" + BASE_URL + "/ScoDoc")
# Test Creer une formation
# @expected : La formation se trouve dans le tableau de la liste des formations

View File

@ -8,10 +8,11 @@ import deleteDepartement
from setting import (
SCODOC_ADMIN_ID,
SCODOC_ADMIN_PASS,
SCHEMA,
BASE_URL,
NOM_DPT,
LINK_SCODOC_SERVER,
BASE_NOT_SECURED_URL,
BASE_SSH_URL,
NAVIGATEUR,
)
import urllib.parse as urlparse
@ -23,7 +24,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 + "://" + BASE_URL + NOM_DPT + "/Scolarite"
nomEtu = "Semestre11"
prenomEtu = "Etudiant1"
nip = "11122234"
@ -41,12 +42,13 @@ class PythonOrgSearch(unittest.TestCase):
self.driver = webdriver.Chrome()
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"
)
global URL
@ -146,7 +148,10 @@ class PythonOrgSearch(unittest.TestCase):
def test_05_suppresion_etudiant(self):
driver = self.driver
urlRecherche = (
"https://scodoc-dev-iutinfo.univ-lille.fr/ScoDoc/"
SCHEMA
+ "://"
+ BASE_URL
+ "/ScoDoc/"
+ NOM_DPT
+ "/Scolarite/search_etud_in_dept"
)
@ -157,7 +162,10 @@ class PythonOrgSearch(unittest.TestCase):
time.sleep(1)
etudid = driver.find_element_by_id("euid")
url = (
"https://scodoc-dev-iutinfo.univ-lille.fr/ScoDoc/"
SCHEMA
+ "://"
+ BASE_URL
+ "/ScoDoc/"
+ NOM_DPT
+ "/Scolarite/etudident_delete?etudid="
+ etudid.text

View File

@ -9,10 +9,11 @@ import deleteDepartement
from setting import (
SCODOC_ADMIN_ID,
SCODOC_ADMIN_PASS,
SCHEMA,
BASE_URL,
NOM_DPT,
LINK_SCODOC_SERVER,
BASE_NOT_SECURED_URL,
BASE_SSH_URL,
NAVIGATEUR,
)
from urllib.parse import parse_qs
@ -22,7 +23,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 + "://" + BASE_URL + NOM_DPT + "/Scolarite"
NOM_ETU = "Semestre11"
PRENOM_ETU = "EtudiantNumero1"
dateDebutAbsenceNonJustifiee = "31/05/2021"
@ -38,12 +39,12 @@ class PythonOrgSearch(unittest.TestCase):
self.driver = webdriver.Chrome()
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"
)
global URL
@ -52,7 +53,7 @@ class PythonOrgSearch(unittest.TestCase):
def test_010_trouver_etudiant(self):
driver = self.driver
global URL
self.driver.get(BASE_URL + NOM_DPT + "/Scolarite")
self.driver.get(SCHEMA + "://" + BASE_URL + NOM_DPT + "/Scolarite")
element = self.driver.find_element_by_id("in-expnom")
element.send_keys(NOM_ETU)
element.submit()

View File

@ -9,6 +9,7 @@ import deleteDepartement
from setting import (
SCODOC_ADMIN_ID,
SCODOC_ADMIN_PASS,
SCHEMA,
BASE_URL,
NOM_DPT,
SCODOC_ENS_ID,
@ -17,7 +18,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 +30,7 @@ from selenium.webdriver.support.select import Select
URL_MATIERE = ""
URL_SEMESTRE = ""
URL = BASE_URL + NOM_DPT + "/Scolarite"
URL = SCHEMA + "://" + BASE_URL + NOM_DPT + "/Scolarite"
PRENOM_ENS = "Ens"
PRENOM_CHEF = "Chef"
isAdmin = True
@ -46,16 +47,17 @@ class PythonOrgSearch(unittest.TestCase):
self.wait = WebDriverWait(self.driver, 10)
if isAdmin:
self.driver.get(
"https://"
SCHEMA
+ "://"
+ SCODOC_ADMIN_ID
+ ":"
+ SCODOC_ADMIN_PASS
+ "@"
+ BASE_NOT_SECURED_URL
+ BASE_SSH_URL
+ "force_admin_authentication"
)
else:
self.driver.get(BASE_URL + NOM_DPT + "/Scolarite")
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(
@ -167,15 +169,16 @@ class PythonOrgSearch(unittest.TestCase):
driver = self.driver
global URL_MATIERE
driver.get(
"https://"
SCHEMA
+ "://"
+ SCODOC_ADMIN_ID
+ ":"
+ SCODOC_ADMIN_PASS
+ "@scodoc-dev-iutinfo.univ-lille.fr/force_admin_authentication"
)
# driver.get(BASE_URL)
# driver.get(SCHEMA + "://" + BASE_URL)
# driver.find_element_by_link_text("déconnecter").click()
# driver.get(BASE_URL)
# driver.get(SCHEMA + "://" + 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()
@ -354,15 +357,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 + "://" + BASE_URL + NOM_DPT + "/Scolarite")
driver.find_element_by_id("link-view-users").click()
time.sleep(5)
noms = driver.find_elements_by_class_name("nom_fmt")

View File

@ -9,8 +9,9 @@ import deleteDepartement
from setting import (
SCODOC_ADMIN_ID,
SCODOC_ADMIN_PASS,
SCHEMA,
BASE_URL,
BASE_NOT_SECURED_URL,
BASE_SSH_URL,
LINK_SCODOC_SERVER,
NOM_DPT,
SCODOC_ENS_ID,
@ -43,15 +44,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 + "://" + BASE_URL + 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"
)

View File

@ -9,8 +9,9 @@ import deleteDepartement
from setting import (
SCODOC_ADMIN_ID,
SCODOC_ADMIN_PASS,
SCHEMA,
BASE_URL,
BASE_NOT_SECURED_URL,
BASE_SSH_URL,
LINK_SCODOC_SERVER,
NOM_DPT,
SCODOC_ENS_ID,
@ -39,15 +40,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 + "://" + BASE_URL + 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"
)

View File

@ -6,10 +6,11 @@ import HtmlTestRunner
from setting import (
SCODOC_ADMIN_ID,
SCODOC_ADMIN_PASS,
SCHEMA,
BASE_URL,
NOM_DPT,
LINK_SCODOC_SERVER,
BASE_NOT_SECURED_URL,
BASE_SSH_URL,
NAVIGATEUR,
)
from selenium import webdriver
@ -20,7 +21,7 @@ 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 + "://" + BASE_URL + NOM_DPT + "/Scolarite"
ACRONYME_FORMATION = "FormationTEST"
@ -31,15 +32,16 @@ def main():
else:
driver = webdriver.Chrome()
driver.get(
"https://"
SCHEMA
+ "://"
+ SCODOC_ADMIN_ID
+ ":"
+ SCODOC_ADMIN_PASS
+ "@"
+ BASE_NOT_SECURED_URL
+ BASE_SSH_URL
+ "force_admin_authentication"
)
driver.get(BASE_URL + "scodoc_admin")
driver.get(SCHEMA + "://" + BASE_URL + "scodoc_admin")
time.sleep(2)
try:
select = Select(driver.find_element_by_id("create-dept"))

View File

@ -20,7 +20,8 @@ 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 = "https"
>BASE_URL = "scodoc-dev-iutinfo.univ-lille.fr/ScoDoc/"
Ici sera le lien vers la page d'accueil de votre Scodoc
@ -56,7 +57,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é.

View File

@ -9,4 +9,4 @@ ssh $1 /bin/bash<< EOF
cd /opt/scodoc/Products/ScoDoc/config
./delete_dept.sh -n ${2}
EOF
ssh $1 'systemctl restart ScoDoc.service'
# ssh $1 'systemctl restart ScoDoc.service'

View File

@ -9,4 +9,4 @@ ssh $1 /bin/bash<< EOF
cd /opt/scodoc/Products/ScoDoc/
scotests/scointeractive.sh -r ${2} scotests/${3}
EOF
ssh $1 'systemctl restart ScoDoc.service'
# ssh $1 'systemctl restart ScoDoc.service'

View File

@ -5,6 +5,7 @@ from dotenv import load_dotenv
dotenv_path = join(dirname(__file__), ".env")
load_dotenv(dotenv_path)
SCHEMA = os.environ.get("SCHEMA")
BASE_URL = os.environ.get("BASE_URL")
NOM_DPT = os.environ.get("NOM_DPT")
SCODOC_ADMIN_ID = os.environ.get("SCODOC_ADMIN_ID")
@ -14,5 +15,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")

View File

@ -6,10 +6,11 @@ import HtmlTestRunner
from setting import (
SCODOC_ADMIN_ID,
SCODOC_ADMIN_PASS,
SCHEMA,
BASE_URL,
NOM_DPT,
LINK_SCODOC_SERVER,
BASE_NOT_SECURED_URL,
BASE_SSH_URL,
NAVIGATEUR,
)
from selenium import webdriver
@ -20,7 +21,7 @@ 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 + "://" + BASE_URL + NOM_DPT + "/Scolarite"
ACRONYME_FORMATION = "FormationTEST"
@ -31,15 +32,16 @@ def main():
else:
driver = webdriver.Chrome()
driver.get(
"https://"
SCHEMA
+ "://"
+ SCODOC_ADMIN_ID
+ ":"
+ SCODOC_ADMIN_PASS
+ "@"
+ BASE_NOT_SECURED_URL
+ BASE_SSH_URL
+ "force_admin_authentication"
)
driver.get(BASE_URL + "scodoc_admin")
driver.get(SCHEMA + "://" + BASE_URL + "scodoc_admin")
time.sleep(2)
try:
select = Select(driver.find_element_by_id("delete-dept"))