summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorankitjavalkar2020-10-07 13:47:13 +0530
committerGitHub2020-10-07 13:47:13 +0530
commit0352fb8753745c1ba33bb51602bee4b756c6c206 (patch)
treee67592c00ceca90f6bd4090c77cedd5072e50f6a
parent0e04d98e66b53763926af8027cbd275d890bfab4 (diff)
parent08571d9a80f2c327ee42bd19a625e04a5a7a4630 (diff)
downloadonline_test-0352fb8753745c1ba33bb51602bee4b756c6c206.tar.gz
online_test-0352fb8753745c1ba33bb51602bee4b756c6c206.tar.bz2
online_test-0352fb8753745c1ba33bb51602bee4b756c6c206.zip
Merge pull request #775 from ankitjavalkar/def-false-prereq
Set prereqs to False by default
-rw-r--r--yaksh/models.py4
-rw-r--r--yaksh/test_models.py12
-rw-r--r--yaksh/test_views.py5
3 files changed, 11 insertions, 10 deletions
diff --git a/yaksh/models.py b/yaksh/models.py
index 3fa4a04..b172e79 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -637,7 +637,7 @@ class LearningUnit(models.Model):
on_delete=models.CASCADE)
quiz = models.ForeignKey(Quiz, null=True, blank=True,
on_delete=models.CASCADE)
- check_prerequisite = models.BooleanField(default=True)
+ check_prerequisite = models.BooleanField(default=False)
def get_lesson_or_quiz(self):
unit = None
@@ -716,7 +716,7 @@ class LearningModule(models.Model):
order = models.IntegerField(default=0)
creator = models.ForeignKey(User, related_name="module_creator",
on_delete=models.CASCADE)
- check_prerequisite = models.BooleanField(default=True)
+ check_prerequisite = models.BooleanField(default=False)
check_prerequisite_passes = models.BooleanField(default=False)
html_data = models.TextField(null=True, blank=True)
active = models.BooleanField(default=True)
diff --git a/yaksh/test_models.py b/yaksh/test_models.py
index 11ab6cd..cd8776b 100644
--- a/yaksh/test_models.py
+++ b/yaksh/test_models.py
@@ -336,7 +336,7 @@ class LearningModuleTestCases(unittest.TestCase):
def test_learning_module(self):
self.assertEqual(self.learning_module.description, 'module one')
self.assertEqual(self.learning_module.creator, self.creator)
- self.assertTrue(self.learning_module.check_prerequisite)
+ self.assertFalse(self.learning_module.check_prerequisite)
self.assertEqual(self.learning_module.order, 0)
def test_prerequisite_passes(self):
@@ -371,16 +371,16 @@ class LearningModuleTestCases(unittest.TestCase):
self.assertEqual(module_quiz_lesson, quiz_lessons)
def test_toggle_check_prerequisite(self):
- self.assertTrue(self.learning_module.check_prerequisite)
+ self.assertFalse(self.learning_module.check_prerequisite)
# When
self.learning_module.toggle_check_prerequisite()
# Then
- self.assertFalse(self.learning_module.check_prerequisite)
+ self.assertTrue(self.learning_module.check_prerequisite)
# When
self.learning_module.toggle_check_prerequisite()
# Then
- self.assertTrue(self.learning_module.check_prerequisite)
+ self.assertFalse(self.learning_module.check_prerequisite)
def test_get_next_unit(self):
# Given
@@ -466,8 +466,8 @@ class LearningUnitTestCases(unittest.TestCase):
)
self.assertIsNone(self.learning_unit_one.quiz)
self.assertIsNone(self.learning_unit_two.lesson)
- self.assertTrue(self.learning_unit_one.check_prerequisite)
- self.assertTrue(self.learning_unit_two.check_prerequisite)
+ self.assertFalse(self.learning_unit_one.check_prerequisite)
+ self.assertFalse(self.learning_unit_two.check_prerequisite)
class ProfileTestCases(unittest.TestCase):
diff --git a/yaksh/test_views.py b/yaksh/test_views.py
index d80a01e..9cb454e 100644
--- a/yaksh/test_views.py
+++ b/yaksh/test_views.py
@@ -3966,6 +3966,7 @@ class TestSelfEnroll(TestCase):
self.assertRedirects(response, '/exam/manage/')
+
class TestGrader(SimpleTestCase):
allow_database_queries = True
@@ -6217,7 +6218,7 @@ class TestLearningModule(TestCase):
learning_module = LearningModule.objects.get(name="test module1")
self.assertEqual(learning_module.description, "my test1")
self.assertEqual(learning_module.creator, self.user)
- self.assertTrue(learning_module.check_prerequisite)
+ self.assertFalse(learning_module.check_prerequisite)
self.assertEqual(learning_module.html_data,
Markdown().convert("my test1"))
@@ -6310,7 +6311,7 @@ class TestLearningModule(TestCase):
updated_learning_unit = LearningUnit.objects.get(id=learning_unit.id)
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, 'yaksh/add_module.html')
- self.assertFalse(updated_learning_unit.check_prerequisite)
+ self.assertTrue(updated_learning_unit.check_prerequisite)
# Test to remove learning unit from learning module
response = self.client.post(