-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Starts load test for login, fixes Issue #39 partially, needs fixes
- Loading branch information
1 parent
d2766f4
commit 13967c4
Showing
2 changed files
with
50 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import os,binascii | ||
from flask import Flask, request, session, g, redirect, url_for, abort, \ | ||
render_template, flash | ||
from flaskext.mysql import MySQL | ||
from config import config, ADMINS, MAIL_SERVER, MAIL_PORT, MAIL_USERNAME, MAIL_PASSWORD | ||
|
||
app = Flask(__name__) | ||
|
||
for key in config: | ||
app.config[key] = config[key] | ||
|
||
mysql = MySQL() | ||
|
||
def get_cursor(): | ||
return mysql.connect().cursor() | ||
|
||
def logintest(): | ||
db = get_cursor() | ||
for i in range(1,100): | ||
EmpID=i | ||
UserName = ''.join([random.choice(string.ascii_letters + string.digits) for n in xrange(10)]) | ||
Password = binascii.b2a_hex(os.urandom(15)) | ||
Occupation = i%5 | ||
sql = 'insert into Login values ("%s","%s",MD5("%s"),"%s")' | ||
db.execute(sql%(EmpID,UserName,Password,Occupation)) | ||
db.execute("Commit") | ||
|
||
logintest() |
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,22 @@ | ||
# Database Config | ||
|
||
config = { | ||
'MYSQL_DATABASE_USER' : '', #Username for mysql | ||
'MYSQL_DATABASE_DB' : 'Dispensary', | ||
'MYSQL_DATABASE_PASSWORD' : '', # Password to connect to mysql | ||
'MYSQL_DATABASE_HOST' : 'localhost', | ||
'USERNAME' : '', | ||
'USERID' :'', | ||
} | ||
|
||
# To run the mail server run | ||
# sudo python -m smtpd -n -c DebuggingServer localhost:25 | ||
# mail server settings | ||
|
||
MAIL_SERVER = 'localhost' | ||
MAIL_PORT = 25 | ||
MAIL_USERNAME = None | ||
MAIL_PASSWORD = None | ||
|
||
# Administrator list | ||
ADMINS = ['[email protected]'] |