Skip to content
Snippets Groups Projects

Backend tests

Merged Jan Maximilian Michal requested to merge backend-tests into master
1 file
+ 6
5
Compare changes
  • Side-by-side
  • Inline
+ 6
5
@@ -16,6 +16,7 @@ from core.models import Student, Submission
unused_variable = []
def parseme():
parser = argparse.ArgumentParser()
@@ -84,7 +85,7 @@ def parseme():
return parser.parse_args()
def handle_passwordlist(output=sys.stdout, instance=""):
def handle_passwordlist(output=sys.stdout, instance="", **kwargs):
with open('/usr/share/dict/words') as words:
choose_from = list({word.strip().lower()
for word in words if 5 < len(word) < 8})
@@ -102,7 +103,7 @@ def handle_passwordlist(output=sys.stdout, instance=""):
student.user.username, password, instance])
def handle_enableusers(switch, exclude, include):
def handle_enableusers(switch, exclude, include, **kwargs):
if include:
for user in User.objects.filter(username__in=include):
@@ -114,7 +115,7 @@ def handle_enableusers(switch, exclude, include):
user.save()
def handle_replaceusernames(matno2username_dict):
def handle_replaceusernames(matno2username_dict, **kwargs):
matno2username = json.JSONDecoder().decode(matno2username_dict.read())
for student in Student.objects.all():
if student.matrikel_no in matno2username:
@@ -123,12 +124,12 @@ def handle_replaceusernames(matno2username_dict):
student.user.save()
def handle_extractsubmissions():
def handle_extractsubmissions(output, **kwargs):
for submission in Submission.objects.filter(feedback__isnull=False).order_by('type'):
print(submission.feedback.score, repr(submission.text), file=open(str(submission.type).replace(' ', '_'), 'a'))
def handle_importer():
def handle_importer(**kwargs):
util.importer.start()
def main():
Loading