Add basic tests

This commit is contained in:
Jake Howard 2016-09-13 21:30:41 +01:00
parent 40f71ba5f1
commit 570ffa2c48
Signed by: jake
GPG key ID: 57AFB45680EDD477
2 changed files with 22 additions and 1 deletions

View file

@ -1,3 +1,23 @@
from django.test import TestCase
from model_mommy import mommy
from .models import SharedFile
from django.core.files.uploadedfile import SimpleUploadedFile
# Create your tests here.
class SharedFileTestCase(TestCase):
def setUp(self):
asset = SimpleUploadedFile(
name='902598_test_file.txt',
content='',
content_type='text/plain'
)
self.file = mommy.make(SharedFile, file=asset)
def test_str(self):
self.assertEqual(str(self.file), self.file.get_original_filename())
def test_get_original_filename(self):
self.assertIn('test_file', self.file.get_original_filename())
def test_absolute_url(self):
self.assertEqual(self.file.get_absolute_url(), '/files/{0}/'.format(self.file.short_id))

View file

@ -6,6 +6,7 @@ django-material==0.8.0
django-shortuuidfield==0.1.3
django==1.8.13
flake8==2.5.4
model-mommy==1.3.0
opbeat==3.3.4
psycopg2==2.6.1
waitress==0.9.0