File tree Expand file tree Collapse file tree 7 files changed +87
-0
lines changed Expand file tree Collapse file tree 7 files changed +87
-0
lines changed Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python
2
+ import os
3
+
4
+ from django .core .management import call_command
5
+
6
+ os .environ ['DJANGO_SETTINGS_MODULE' ] = 'testing.settings'
7
+
8
+ if __name__ == "__main__" :
9
+ call_command ('test' , 'validatedfile' )
Original file line number Diff line number Diff line change
1
+ import os
2
+
3
+ DEBUG = True
4
+
5
+ AUTHNET_LOGIN_ID = ''
6
+ AUTHNET_TRANSACTION_KEY = ''
7
+
8
+ DATABASES = {
9
+ 'default' : {
10
+ 'ENGINE' : 'django.db.backends.sqlite3'
11
+ },
12
+ }
13
+
14
+ SECRET_KEY = 'm+qa*7_8t-=17zt_)9gi)4g%6w*v$xxkh6rwrys*bn9su+5%du'
15
+
16
+ INSTALLED_APPS = [
17
+ 'django.contrib.admin' ,
18
+ 'django.contrib.admindocs' ,
19
+ 'django.contrib.auth' ,
20
+ 'django.contrib.contenttypes' ,
21
+ 'django.contrib.messages' ,
22
+ 'django.contrib.sessions' ,
23
+ 'django.contrib.sites' ,
24
+ 'django.contrib.staticfiles' ,
25
+
26
+ 'validatedfile' ,
27
+ 'validatedfile.tests' ,
28
+ ]
29
+
30
+ LANGUAGE_CODE = 'en'
31
+
32
+ LOGIN_URL = '/accounts/login/'
33
+
34
+ MANAGERS = []
35
+
36
+ MIDDLEWARE_CLASSES = [
37
+ 'django.contrib.sessions.middleware.SessionMiddleware' ,
38
+ 'django.contrib.auth.middleware.AuthenticationMiddleware' ,
39
+ 'django.contrib.messages.middleware.MessageMiddleware' ,
40
+ 'django.middleware.common.CommonMiddleware' ,
41
+ ]
42
+
43
+ ROOT_URLCONF = 'testing.urls'
44
+
45
+ SITE_ID = 1
46
+
47
+ TEMPLATE_DIRS = [os .path .join (os .path .dirname (__file__ ), 'templates' )]
48
+
49
+ USE_I18N = True
50
+
Original file line number Diff line number Diff line change
1
+ # -*- coding:utf-8 -*-
2
+ from django .conf .urls .defaults import patterns , url , include
3
+
4
+ urlpatterns = patterns ('' ,
5
+ )
6
+
Original file line number Diff line number Diff line change
1
+ from django .db import models
2
+
3
+ class ValidatedFileField (models .FileField ):
4
+ pass
5
+
Original file line number Diff line number Diff line change
1
+ from django .test import TestCase
2
+
3
+ from models import TestModel
4
+
5
+ class ValidatedFileFieldTest (TestCase ):
6
+
7
+ def test_create_instance (self ):
8
+ instance = TestModel ()
9
+ instance .save ()
10
+
Original file line number Diff line number Diff line change
1
+ from django .db import models
2
+ from validatedfile .models import ValidatedFileField
3
+ from ..models import *
4
+
5
+ class TestModel (models .Model ):
6
+ the_file = ValidatedFileField (upload_to = 'testfile' )
7
+
You can’t perform that action at this time.
0 commit comments