factory.django.FileField

Here are the examples of the python api factory.django.FileField taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3 Examples 7

3 Source : test_models.py
with BSD 3-Clause "New" or "Revised" License
from GhostManager

    def test_file_extension_validator(self):
        evidence = EvidenceFactory(
            document=factory.django.FileField(
                filename="evidence.PnG", data=b"lorem ipsum"
            )
        )
        self.assertEqual(evidence.filename, "evidence.PnG")

    def test_prop_filename(self):

3 Source : test_models.py
with BSD 3-Clause "New" or "Revised" License
from GhostManager

    def test_delete_old_evidence_on_update_signal(self):
        evidence = EvidenceFactory(
            document=factory.django.FileField(
                filename="evidence.txt", data=b"lorem ipsum"
            )
        )
        evidence.document = SimpleUploadedFile("new_evidence.txt", b"lorem ipsum")
        evidence.save()

        self.assertTrue(evidence._current_evidence.path not in evidence.document.path)
        self.assertFalse(os.path.exists(evidence._current_evidence.path))
        self.assertTrue(os.path.exists(evidence.document.path))


class FindingNoteModelTests(TestCase):

0 Source : misc.py
with MIT License
from nickgashkov

def build_filefield(field_cls):
    return factory.django.FileField()


def build_filepathfield(field_cls):