Commit 28e2090d authored by Lorenz Steinert's avatar Lorenz Steinert
parents cd23496d 8cf0cc59
test:
before_script:
- pacman -Sy --noconfirm python3 python-ldap3
script: python3 bin/module/test.py
syntax:
before_script:
- pacman -Sy --noconfirm flake8
script: flake8 --exclude .git,__pycache__,bin/module/test.py
......@@ -9,7 +9,7 @@ Created on Fri Nov 24 15:35:04 2017
import os
import codecs
import argparse
from module.esme import FsrLdap, get_config, get_share, get_ldap_server, get_ldap_base
from module.esme import FsrLdap, get_config, get_share, get_ldap_server, get_ldap_base # noqa: E501
if __name__ == "__main__":
RUNDIR = os.path.dirname(os.path.realpath(__file__))
......@@ -29,10 +29,11 @@ if __name__ == "__main__":
LDAP_SERVER = get_ldap_server(CONFIG, OPT.Server)
LDAP_SERVER_BASE = get_ldap_base(CONFIG, OPT.base)
ESME = FsrLdap(LDAP_SERVER, LDAP_SERVER_BASE, debug=True, timeout=30)
ESME = FsrLdap(LDAP_SERVER, LDAP_SERVER_BASE,
SHARE_DIR, CONFIG, debug=True, timeout=30)
FSR = ESME.get_fsr_ldap(gen_fallback=True)
FSR_EXTERN = ESME.get_fsr_extern_ldap(gen_fallback=True)
FSR = ESME._get_fsr_ldap()
FSR_EXTERN = ESME._get_fsr_extern_ldap()
fsr_out = ""
fsr_extern_out = ""
......
......@@ -26,7 +26,7 @@ if __name__ == "__main__":
for j in CONFIG[i]:
tmp = input('Bitte gib [' + j
+ '] ein [' + CONFIG[i][j] + ']: ')
if tmp!="":
if tmp:
CONFIG[i][j] = tmp
if OPT.config:
......
This diff is collapsed.
......@@ -50,7 +50,6 @@ class FsrLdapTest(unittest.TestCase):
logging.info = self.logging_info
logging.warning = self.logging_warning
@staticmethod
def ldap_search_fail(*arg, attributes=None):
"""mok th conn.search funktion for server timeout"""
......@@ -249,8 +248,12 @@ class GetFuncTest(unittest.TestCase):
self.assertEqual(esme.get_config("/tmp/python3-esme-testing/etc"), self.config1)
self.assertEqual(esme.get_config("/tmp/python3-esme-testing/etc", default=True),
self.config1)
os.remove("/tmp/python3-esme-testing/etc/proto.ini.default")
self.assertEqual(esme.get_config("/tmp/python3-esme-testing/etc"),
esme.Error.NO_DEFAULT_FILE)
self.assertEqual(self.info, [])
self.assertEqual(self.warning, ['No non default ini file found using default file.'])
self.assertEqual(self.warning, ['No non default ini file found using default file.',
'No ini file found. Using hardcoded defaults.'])
def test_get_share(self):
"""test the get_share function"""
......
......@@ -12,7 +12,7 @@ import sys
import shutil
import codecs
import argparse
from module.esme import FsrLdap, get_date, get_sprecher, get_config, get_share, get_path, get_ldap_server, get_ldap_base, get_server_timeout
from module.esme import FsrLdap, get_date, get_sprecher, get_config, get_share, get_path, get_ldap_server, get_ldap_base, get_server_timeout, Error # noqa: E501
def build_parser():
......@@ -35,7 +35,7 @@ def build_parser():
def gen_head(share_dir, reg, sprecher, protokollant, date):
"""generate the head of the protokoll"""
#look for the name.tex and if not found ignore it
# look for the name.tex and if not found ignore it
if os.path.isfile(os.path.join(share_dir, 'name.tex')):
with codecs.open(os.path.join(share_dir, 'name.tex'),
'r', 'utf-8') as fobj_name:
......@@ -45,8 +45,8 @@ def gen_head(share_dir, reg, sprecher, protokollant, date):
+ " not found. Ignoring")
f_name = ""
#look for the acroname.tex and the acro.tex if one is not found
#ignore both
# look for the acroname.tex and the acro.tex if one is not found
# ignore both
if (os.path.isfile(os.path.join(share_dir, 'acroname.tex'))
and os.path.isfile(os.path.join(share_dir, 'acro.tex'))):
......@@ -65,7 +65,7 @@ def gen_head(share_dir, reg, sprecher, protokollant, date):
f_acroname = ""
f_acro = ""
#look for teh head.tex and abort if it is not found
# look for teh head.tex and abort if it is not found
if os.path.isfile(os.path.join(share_dir, 'head.tex')):
with codecs.open(os.path.join(share_dir, 'head.tex'),
'r', 'utf-8') as fobj_head:
......@@ -75,7 +75,7 @@ def gen_head(share_dir, reg, sprecher, protokollant, date):
+ " not found. Aborting!")
sys.exit(1)
#Replace the paceholder strings with the files
# Replace the paceholder strings with the files
f_head = reg['FSRN'].sub(f_name, f_head)
f_head = reg['ACRON'].sub(f_acroname, f_head)
f_head = reg['ACRO'].sub(f_acro, f_head)
......@@ -125,7 +125,7 @@ def gen_attendance_tab(fsr, num_cols=5, ext=False):
def gen_foot(share_dir, vollversamlung, reg, sprecher, protokollant, date):
"""generate the foot of the protokoll"""
#look for the foot*.tex skripts
# look for the foot*.tex skripts
# if not found abort
if vollversamlung:
if os.path.isfile(os.path.join(share_dir, 'foot_VV.tex')):
......@@ -146,7 +146,7 @@ def gen_foot(share_dir, vollversamlung, reg, sprecher, protokollant, date):
+ " not found. Aborting")
sys.exit(1)
#replace the placeholder strings in f_foot
# replace the placeholder strings in f_foot
f_foot = reg['SPR'].sub(sprecher, f_foot)
f_foot = reg['PRO'].sub(protokollant, f_foot)
f_foot = reg['DATE'].sub(date[0], f_foot)
......@@ -159,8 +159,20 @@ if __name__ == "__main__":
RUNDIR = os.path.dirname(os.path.realpath(__file__))
OPT = build_parser()
CONFIG = get_config(RUNDIR, OPT.config)
if CONFIG is Error.NO_FILE:
print("No config-file found. Stoping.")
sys.exit(CONFIG)
elif CONFIG is Error.NO_DEFAULT_FILE:
print("No default config-file found. Stopping.")
sys.exit(CONFIG)
SHARE_DIR = get_share(RUNDIR, CONFIG, OPT.sharedir)
if SHARE_DIR is Error.NO_DIR:
print("No sharedir found. Stopping.")
sys.exit(SHARE_DIR)
elif SHARE_DIR is Error.NO_DEFAULT_DIR:
print("No default sharedir found. Stopping.")
sys.exit(SHARE_DIR)
LDAP_SERVER = get_ldap_server(CONFIG, OPT.Server)
LDAP_SERVER_BASE = get_ldap_base(CONFIG, OPT.base)
SERVER_TIMEOUT = get_server_timeout(CONFIG, OPT.test)
......@@ -190,22 +202,23 @@ if __name__ == "__main__":
DATE = get_date(OPT.test)
#Fetch the FSR from the Server
#and if not able to connect fall back to the textfiles
# Fetch the FSR from the Server
# and if not able to connect fall back to the textfiles
FSR = [ESME.get_fsr(), ESME.get_fsr_extern()]
#Generate the Path for the Protokoll in depandance of OPT.VV
#and make the directory
# Generate the Path for the Protokoll in depandance of OPT.VV
# and make the directory
if OPT.Vollversamlung:
OUTDIR = os.path.join(get_path(RUNDIR, CONFIG, OPT.path), DATE[1],
"fsr_physik_vollversamlung_" + '-'.join(DATE[1:]))
"fsr_physik_vollversamlung_"
+ '-'.join(DATE[1:]))
else:
OUTDIR = os.path.join(get_path(RUNDIR, CONFIG, OPT.path), DATE[1],
"fsr_physik_sitzung_" + '-'.join(DATE[1:]))
if not os.path.exists(OUTDIR):
os.makedirs(OUTDIR)
#Generate the path of the .tex file
# Generate the path of the .tex file
OUTFILE = os.path.join(OUTDIR, "fsr_physik_protokoll_"
+ '-'.join(DATE[1:]) + ".tex")
......
......@@ -2,7 +2,6 @@ Tamara Azevedo
Aaron Eric Gebert
Tatjana Grün
Maximilian Kiefer
Pascale Klaeger
Agnes Koerfer
Christopher Mink
Daniel Muschol
......
......@@ -8,8 +8,16 @@
\\newcommand{\\jbohm}{Julius Bohm\\xspace}
\\newcommand{\\ellen}{Ellen Bold\\xspace}
\\newcommand{\\ebold}{Ellen Bold\\xspace}
\\newcommand{\\lbolz}{Lukas Bolz\\xspace}
\\newcommand{\\lukasb}{Lukas Bolz\\xspace}
\\newcommand{\\sgalimberto}{Stefano Galimberto\\xspace}
\\newcommand{\\stefano}{Stefano Galimberto\\xspace}
\\newcommand{\\tatjana}{Tatjana Grün\\xspace}
\\newcommand{\\tgruen}{Tatjana Grün\\xspace}
\\newcommand{\\lhaag}{Luca Haag\\xspace}
\\newcommand{\\luca}{Luca Haag\\xspace}
\\newcommand{\\luka}{Luca Haag\\xspace}
\\newcommand{\\haag}{Luca Haag\\xspace}
\\newcommand{\\kai}{Kai Hawerkamp\\xspace}
\\newcommand{\\hawerkamp}{Kai Hawerkamp\\xspace}
\\newcommand{\\silvia}{Silvia Hiebel\\xspace}
......@@ -35,6 +43,9 @@
\\newcommand{\\kmours}{Kevin Mours\\xspace}
\\newcommand{\\tarek}{Tarek Moussa\\xspace}
\\newcommand{\\tmoussa}{Tarek Moussa\\xspace}
\\newcommand{\\linda}{Linda Müller\\xspace}
\\newcommand{\\lmueller}{Linda Müller\\xspace}
\\newcommand{\\lmuller}{Linda Müller\\xspace}
\\newcommand{\\muschol}{Daniel Muschol\\xspace}
\\newcommand{\\barti}{Daniel Muschol\\xspace}
\\newcommand{\\berti}{Daniel Muschol\\xspace}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment