-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into backend_extras
- Loading branch information
Showing
90 changed files
with
15,860 additions
and
2,916 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import factory | ||
from factory.django import FileField | ||
from api.models.template import Template | ||
from api.tests.factories.gebruiker import UserFactory | ||
|
||
|
||
class TemplateFactory(factory.django.DjangoModelFactory): | ||
class Meta: | ||
model = Template | ||
|
||
user = factory.SubFactory(UserFactory) | ||
bestand = FileField(filename="template.txt", data=b"file content") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from django.test import TestCase | ||
from api.tests.factories.template import TemplateFactory | ||
from api.models.template import Template | ||
from api.models.template import upload_to | ||
|
||
|
||
class TemplateModelTest(TestCase): | ||
def setUp(self): | ||
self.template = TemplateFactory.create() | ||
|
||
def test_template_creation(self): | ||
self.assertIsInstance(self.template, Template) | ||
self.assertEqual(Template.objects.count(), 1) | ||
|
||
def test_template_str(self): | ||
self.assertEqual(str(self.template), self.template.bestand.name) | ||
|
||
def test_upload_to(self): | ||
filename = "test_template.txt" | ||
expected_path = f"data/templates/gebruiker_{self.template.user.id}/{filename}" | ||
self.assertEqual(upload_to(self.template, filename), expected_path) |
Oops, something went wrong.