def test_liberate(self): with override_settings(SENDFILE_ROOT=self.tmp_dir): form = LiberationForm(self.user, data={ "storage_type": 0, "compression_type": 0 }) self.assertTrue(form.is_valid()) form.save()
def test_liberate(self): """Run through all combinations of compressions and mailbox formats""" with override_settings(LIBERATION_PATH=self.tmp_dir): for storage, compression in itertools.product(LiberationForm.STORAGE_TYPES, LiberationForm.COMPRESSION_TYPES): form_data = {"storage_type": str(storage[0]), "compression_type": str(compression[0])} form = LiberationForm(self.user, data=form_data) self.assertTrue(form.is_valid()) form.save() # delete liberation now we're done with it and refetch user models.Liberation.objects.all().delete() self.user = get_user_model().objects.get(id=self.user.id)
def test_liberate(self): """Run through all combinations of compressions and mailbox formats""" with override_settings(SENDFILE_ROOT=self.tmp_dir): for storage, compression in itertools.product( LiberationForm.STORAGE_TYPES, LiberationForm.COMPRESSION_TYPES): form_data = { "storage_type": str(storage[0]), "compression_type": str(compression[0]) } form = LiberationForm(self.user, data=form_data) self.assertTrue(form.is_valid()) form.save() # delete liberation now we're done with it and refetch user models.Liberation.objects.all().delete() self.user = get_user_model().objects.get(id=self.user.id)
def test_form_good_data(self): params = {"storage_type": 1, "compression_type": 1} form = LiberationForm(user=self.user, data=params) self.assertTrue(form.is_valid())
def test_form_bad_data(self): params = {"storage_type": 180, "compression_type": 180} form = LiberationForm(user=self.user, data=params) self.assertFalse(form.is_valid())
def test_liberate(self): with override_settings(LIBERATION_PATH=self.tmp_dir): form = LiberationForm(self.user, data={"storage_type": 0, "compression_type": 0}) self.assertTrue(form.is_valid()) form.save()