File tree 6 files changed +13
-22
lines changed
6 files changed +13
-22
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
from test_plus .test import TestCase
2
2
from app_code_share .models import CodeShare
3
- import random
3
+ from django .utils .crypto import get_random_string
4
+
4
5
5
6
6
7
class TestCodeShare (TestCase ):
7
8
8
9
def setUp (self ):
9
10
self .code_share = 'testcode'
10
- self .a = random . randrange ( 0 , 6 )
11
- self .hash_value = str ( hash ( self .code_share ))[ self . a : self . a + 8 ]
11
+ self .chars = 'abcdefghijklmnopqrstuvwxyz0123456789'
12
+ self .hash_value = get_random_string ( 8 , self .chars )
12
13
self .file_name = 'testfilename'
13
14
14
15
CodeShare .objects .create (
Original file line number Diff line number Diff line change 1
1
from django .core .urlresolvers import reverse , resolve
2
2
from test_plus .test import TestCase
3
3
from app_code_share .models import CodeShare
4
- import random
4
+ from django . utils . crypto import get_random_string
5
5
6
6
7
- class TestUserURLs ( TestCase ):
8
- """TEST URL PATTER FOR BLOG APP"""
7
+
8
+ class TestCodeShare ( TestCase ):
9
9
10
10
def setUp (self ):
11
11
self .code_share = 'testcode'
12
- self .a = random . randrange ( 0 , 6 )
13
- self .hash_value = str ( hash ( self .code_share ))[ self . a : self . a + 8 ]
12
+ self .chars = 'abcdefghijklmnopqrstuvwxyz0123456789'
13
+ self .hash_value = get_random_string ( 8 , self .chars )
14
14
self .file_name = 'testfilename'
15
15
16
16
CodeShare .objects .create (
Original file line number Diff line number Diff line change 1
1
from test_plus .test import TestCase
2
2
from app_code_share .models import CodeShare
3
- import random
3
+ from django . utils . crypto import get_random_string
4
4
5
5
6
- class CodeShareTests (TestCase ):
6
+ class TestCodeShare (TestCase ):
7
7
8
8
def setUp (self ):
9
9
self .code_share = 'testcode'
10
- self .a = random . randrange ( 0 , 6 )
11
- self .hash_value = str ( hash ( self .code_share ))[ self . a : self . a + 8 ]
10
+ self .chars = 'abcdefghijklmnopqrstuvwxyz0123456789'
11
+ self .hash_value = get_random_string ( 8 , self .chars )
12
12
self .file_name = 'testfilename'
13
13
14
14
CodeShare .objects .create (
Original file line number Diff line number Diff line change 3
3
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
4
4
BASE_DIR = os .path .dirname (os .path .dirname (os .path .abspath (__file__ )))
5
5
6
- from decouple import config
7
-
8
6
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO' , 'https' )
9
7
10
8
# Quick-start development settings - unsuitable for production
Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ flake8==3.4.1
7
7
gunicorn == 19.7.1
8
8
mccabe == 0.6.1
9
9
packaging == 16.8
10
- pkg-resources == 0.0.0
11
10
psycopg2 == 2.7.1
12
11
py == 1.4.34
13
12
pycodestyle == 2.3.1
You can’t perform that action at this time.
0 commit comments