Skip to content

Commit

Permalink
Starts load test for login, fixes Issue #39 partially, needs fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sudheesh001 committed Aug 12, 2014
1 parent d2766f4 commit 13967c4
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/LoadTest.py
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()
22 changes: 22 additions & 0 deletions test/config.py
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]']

0 comments on commit 13967c4

Please sign in to comment.