From 24774543f58b488b34ae39eaefac7ce1a5afcf50 Mon Sep 17 00:00:00 2001 From: Dominik Seeger <dominik.seeger@gmx.net> Date: Sat, 12 Oct 2019 16:58:17 +0200 Subject: [PATCH] tests are now created when importing via the frontend, added editorconfig --- .editorconfig | 7 +++++++ .../migrations/0022_remove_feedback_origin.py | 17 ++++++++++++++++ core/models/feedback.py | 20 ------------------- core/tests/test_import_views.py | 6 +++--- util/importer.py | 16 +++++---------- 5 files changed, 32 insertions(+), 34 deletions(-) create mode 100644 core/migrations/0022_remove_feedback_origin.py diff --git a/.editorconfig b/.editorconfig index b588bb9b..73622a70 100644 --- a/.editorconfig +++ b/.editorconfig @@ -28,3 +28,10 @@ indent_style = tab [{package.json,.travis.yml}] indent_style = space indent_size = 2 + +# Frontend +[*.{js,jsx,ts,tsx,vue}] +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true +insert_final_newline = true diff --git a/core/migrations/0022_remove_feedback_origin.py b/core/migrations/0022_remove_feedback_origin.py new file mode 100644 index 00000000..798dccf9 --- /dev/null +++ b/core/migrations/0022_remove_feedback_origin.py @@ -0,0 +1,17 @@ +# Generated by Django 2.1.13 on 2019-10-12 15:11 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0021_merge_20190902_1246'), + ] + + operations = [ + migrations.RemoveField( + model_name='feedback', + name='origin', + ), + ] diff --git a/core/models/feedback.py b/core/models/feedback.py index 742f9428..ec36f63b 100644 --- a/core/models/feedback.py +++ b/core/models/feedback.py @@ -41,26 +41,6 @@ class Feedback(models.Model): # the denominators that are allowed for the decimal score interpreted as a fraction ALLOWED_DENOMINATORS = [1, 2] - # how was this feedback created - ( - WAS_EMPTY, - FAILED_UNIT_TESTS, - DID_NOT_COMPILE, - COULD_NOT_LINK, - MANUAL, - ) = range(5) - ORIGIN = ( - (WAS_EMPTY, 'was empty'), - (FAILED_UNIT_TESTS, 'passed unittests'), - (DID_NOT_COMPILE, 'did not compile'), - (COULD_NOT_LINK, 'could not link'), - (MANUAL, 'created by a human. yak!'), - ) - origin = models.IntegerField( - choices=ORIGIN, - default=MANUAL, - ) - class Meta: verbose_name = "Feedback" verbose_name_plural = "Feedback Set" diff --git a/core/tests/test_import_views.py b/core/tests/test_import_views.py index 3784b85f..3d08b113 100644 --- a/core/tests/test_import_views.py +++ b/core/tests/test_import_views.py @@ -6,7 +6,7 @@ from util.factories import GradyUserFactory test_data = { "meta": { - "version": "4.0.0" + "version": "5.0.0" }, "module": { "module_reference": "test", @@ -21,12 +21,12 @@ test_data = { "submissions": [ { "code": "some messy, perhaps incorrect stuff", - "tests": {}, + "tests": [], "type": "[a0] coding stuff" }, { "code": "i don't know man", - "tests": {}, + "tests": [], "type": "[a1] improvise" } ], diff --git a/util/importer.py b/util/importer.py index 21fa74e7..2f120a51 100644 --- a/util/importer.py +++ b/util/importer.py @@ -29,24 +29,19 @@ PASSWORDS = '.importer_passwords' YES = 'Y/n' NO = 'y/N' -RUSTY_HEKTOR_MIN_VER = ">=4.0.0" -RUSTY_HEKTOR_MAX_VER = "<5.0.0" +RUSTY_HEKTOR_MIN_VER = ">=5.0.0" +RUSTY_HEKTOR_MAX_VER = "<6.0.0" valid = {"yes": True, "y": True, "ye": True, "no": False, "n": False} - -ORIGIN_ORDER = { - Feedback.WAS_EMPTY, - Feedback.DID_NOT_COMPILE, -} - +# the camel-case entries are here for the import via frontend functionality. TEST_ORDER = ( 'EmptyTest', + '_empty_test', 'CompileTest', + '_compile_test', ) -FEEDBACK_MAPPER = dict(zip(TEST_ORDER, ORIGIN_ORDER)) - user_factory = GradyUserFactory() @@ -199,7 +194,6 @@ def add_feedback_if_test_recommends_it(test_obj): of_submission=test_obj.submission, defaults={ 'score': 0, - 'origin': FEEDBACK_MAPPER[test_obj.name], 'is_final': True, } ) -- GitLab