File tree Expand file tree Collapse file tree 6 files changed +13
-22
lines changed
Expand file tree Collapse file tree 6 files changed +13
-22
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11from test_plus .test import TestCase
22from app_code_share .models import CodeShare
3- import random
3+ from django .utils .crypto import get_random_string
4+
45
56
67class TestCodeShare (TestCase ):
78
89 def setUp (self ):
910 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 )
1213 self .file_name = 'testfilename'
1314
1415 CodeShare .objects .create (
Original file line number Diff line number Diff line change 11from django .core .urlresolvers import reverse , resolve
22from test_plus .test import TestCase
33from app_code_share .models import CodeShare
4- import random
4+ from django . utils . crypto import get_random_string
55
66
7- class TestUserURLs ( TestCase ):
8- """TEST URL PATTER FOR BLOG APP"""
7+
8+ class TestCodeShare ( TestCase ):
99
1010 def setUp (self ):
1111 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 )
1414 self .file_name = 'testfilename'
1515
1616 CodeShare .objects .create (
Original file line number Diff line number Diff line change 11from test_plus .test import TestCase
22from app_code_share .models import CodeShare
3- import random
3+ from django . utils . crypto import get_random_string
44
55
6- class CodeShareTests (TestCase ):
6+ class TestCodeShare (TestCase ):
77
88 def setUp (self ):
99 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 )
1212 self .file_name = 'testfilename'
1313
1414 CodeShare .objects .create (
Original file line number Diff line number Diff line change 33# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
44BASE_DIR = os .path .dirname (os .path .dirname (os .path .abspath (__file__ )))
55
6- from decouple import config
7-
86SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO' , 'https' )
97
108# 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
77gunicorn == 19.7.1
88mccabe == 0.6.1
99packaging == 16.8
10- pkg-resources == 0.0.0
1110psycopg2 == 2.7.1
1211py == 1.4.34
1312pycodestyle == 2.3.1
You can’t perform that action at this time.
0 commit comments