Skip to content
Snippets Groups Projects

Resolve "Tests are not created when importing via frontend"

+ 3
18
@@ -29,24 +29,11 @@ PASSWORDS = '.importer_passwords'
@@ -29,24 +29,11 @@ PASSWORDS = '.importer_passwords'
YES = 'Y/n'
YES = 'Y/n'
NO = 'y/N'
NO = 'y/N'
RUSTY_HEKTOR_MIN_VER = ">=4.0.0"
RUSTY_HEKTOR_MIN_VER = ">=5.0.0"
RUSTY_HEKTOR_MAX_VER = "<5.0.0"
RUSTY_HEKTOR_MAX_VER = "<6.0.0"
valid = {"yes": True, "y": True, "ye": True, "no": False, "n": False}
valid = {"yes": True, "y": True, "ye": True, "no": False, "n": False}
ORIGIN_ORDER = {
Feedback.WAS_EMPTY,
Feedback.DID_NOT_COMPILE,
}
TEST_ORDER = (
'EmptyTest',
'CompileTest',
)
FEEDBACK_MAPPER = dict(zip(TEST_ORDER, ORIGIN_ORDER))
user_factory = GradyUserFactory()
user_factory = GradyUserFactory()
@@ -177,8 +164,7 @@ def add_tests(submission_obj, tests):
@@ -177,8 +164,7 @@ def add_tests(submission_obj, tests):
defaults={'is_active': False}
defaults={'is_active': False}
)
)
for name in (name for name in TEST_ORDER if name in tests):
for test_data in tests:
test_data = tests[name]
test_obj, created = Test.objects.update_or_create(
test_obj, created = Test.objects.update_or_create(
name=test_data['name'],
name=test_data['name'],
submission=submission_obj,
submission=submission_obj,
@@ -199,7 +185,6 @@ def add_feedback_if_test_recommends_it(test_obj):
@@ -199,7 +185,6 @@ def add_feedback_if_test_recommends_it(test_obj):
of_submission=test_obj.submission,
of_submission=test_obj.submission,
defaults={
defaults={
'score': 0,
'score': 0,
'origin': FEEDBACK_MAPPER[test_obj.name],
'is_final': True,
'is_final': True,
}
}
)
)
Loading