def test_not_loaded(self):
     try:
         RandomizationListVerifier(randomizer_name=Randomizer.name)
     except RandomizationListError as e:
         self.assertIn("Randomization list has not been loaded", str(e))
     else:
         self.fail("RandomizationListError unexpectedly NOT raised")
Beispiel #2
0
 def test_invalid_sid(self):
     # change to a different starting SID
     RandomizationListImporter(name="ambition")
     obj = RandomizationList.objects.all().order_by("sid").first()
     obj.sid = 100
     obj.save()
     with self.assertRaises(RandomizationListError) as cm:
         RandomizationListVerifier(randomizer_name="ambition")
     self.assertIn("Randomization list has invalid SIDs", str(cm.exception))
    def test_invalid_sid(self):
        self.populate_list(randomizer_name="default")
        # change to a different starting SID
        obj = RandomizationList.objects.all().order_by("sid").first()
        obj.sid = 99999
        obj.save()

        with self.assertRaises(RandomizationListError) as cm:
            RandomizationListVerifier(randomizer_name=Randomizer.name)
        self.assertIn("Randomization list has invalid SIDs", str(cm.exception))
 def test_invalid_count(self):
     site = Site.objects.get_current()
     # change number of SIDs in DB
     self.populate_list(randomizer_name="default")
     RandomizationList.objects.create(sid=100,
                                      assignment=ACTIVE,
                                      site_name=site.name)
     self.assertEqual(RandomizationList.objects.all().count(), 51)
     with self.assertRaises(RandomizationListError) as cm:
         RandomizationListVerifier(randomizer_name=Randomizer.name)
     self.assertIn("Randomization list count is off", str(cm.exception))
Beispiel #5
0
 def test_invalid_count(self):
     Randomizer.model_cls().objects.all().delete()
     site = Site.objects.get_current()
     RandomizationListImporter(name="ambition")
     # change number of SIDs in DB
     self.assertEqual(Randomizer.model_cls().objects.all().count(), 50)
     Randomizer.model_cls().objects.create(sid=100,
                                           assignment="single_dose",
                                           site_name=site.name)
     self.assertEqual(Randomizer.model_cls().objects.all().count(), 51)
     self.assertRaises(
         RandomizationListError,
         RandomizationListVerifier,
         randomizer_name="ambition",
     )
     with self.assertRaises(RandomizationListError) as cm:
         RandomizationListVerifier(randomizer_name="ambition")
     self.assertIn("Randomization list count is off. Expected 51. Got 50",
                   str(cm.exception))
 def test_invalid_path(self):
     with self.assertRaises(RandomizationListError) as cm:
         RandomizationListVerifier(randomizer_name="ambition").message
     self.assertIn("Randomization list has not been loaded.",
                   str(cm.exception))