From 8d8ef627aacc5d3bd8f433a8054f35dbe7f11537 Mon Sep 17 00:00:00 2001 From: Justin Kwan Date: Tue, 2 Jul 2019 22:15:37 -0400 Subject: [PATCH] refactoring --- server/src/DatabaseAccessor.py | 19 +- server/src/InputHandler.py | 66 +++--- server/src/User.py | 19 +- .../DatabaseAccessor.cpython-36.pyc | Bin 2132 -> 2258 bytes .../__pycache__/InputHandler.cpython-36.pyc | Bin 2449 -> 2858 bytes server/src/__pycache__/User.cpython-36.pyc | Bin 1843 -> 2126 bytes server/src/__pycache__/index.cpython-36.pyc | Bin 2589 -> 2602 bytes server/src/controllers/LoginController.py | 27 ++- server/src/controllers/SignUpController.py | 28 +-- .../LoginController.cpython-36.pyc | Bin 823 -> 1329 bytes .../SignUpController.cpython-36.pyc | Bin 1599 -> 1600 bytes server/src/todo.txt | 1 - ...est_DatabaseAccessor.cpython-36-PYTEST.pyc | Bin 10103 -> 9333 bytes .../test_InputHandler.cpython-36-PYTEST.pyc | Bin 16327 -> 20272 bytes ...est_SignUpController.cpython-36-PYTEST.pyc | Bin 11269 -> 12384 bytes .../test_User.cpython-36-PYTEST.pyc | Bin 8571 -> 11240 bytes server/test/test_DatabaseAccessor.py | 159 ++++++++------ server/test/test_InputHandler.py | 200 ++++++++++++++---- server/test/test_SignUpController.py | 14 +- server/test/test_User.py | 42 ++-- 20 files changed, 385 insertions(+), 190 deletions(-) diff --git a/server/src/DatabaseAccessor.py b/server/src/DatabaseAccessor.py index 4bdc48c..221babc 100644 --- a/server/src/DatabaseAccessor.py +++ b/server/src/DatabaseAccessor.py @@ -11,27 +11,30 @@ class DatabaseAccessor(): - def selectUsername(self, username): + def selectUsername(self, user): + username = user.getUsername() cursor.execute("SELECT Username from Users WHERE Username = %s", (username,)) selectedUsername = cursor.fetchone() return self.handleQueryReturn(selectedUsername) - # selects user's hashed password based on username - def selectHashedPassword(self, username): + def selectHashedPassword(self, user): + username = user.getUsername() cursor.execute("SELECT HashedPass from Users WHERE Username = %s", (username,)) selectedHashedPassword = cursor.fetchone() return self.handleQueryReturn(selectedHashedPassword) - def selectUserId(self, userId): - cursor.execute("SELECT UserId from Users WHERE UserId = %s", (userId,)) + def selectUserId(self, user): + username = user.getUsername() + cursor.execute("SELECT UserId from Users WHERE Username = %s", (username,)) selectedUserId = cursor.fetchone() return self.handleQueryReturn(selectedUserId) - def insertUserInfo(self, username, hashedPassword, userId): + def insertUserInfo(self, user): + username = user.getUsername() + hashedPassword = user.getHashedPassword() + userId = user.getUserId() cursor.execute("INSERT INTO Users(Username, HashedPass, UserId) VALUES(%s, %s, %s)", (username, hashedPassword, userId)) connection.commit() - username = '' - hashedPassword = '' def clearDatabase(self): cursor.execute('DELETE FROM Users') diff --git a/server/src/InputHandler.py b/server/src/InputHandler.py index a3675ae..62015cd 100644 --- a/server/src/InputHandler.py +++ b/server/src/InputHandler.py @@ -5,27 +5,27 @@ import bcrypt from DatabaseAccessor import DatabaseAccessor -from ResultCodes import ResultCodes +from ResultCodes import ResultCodes DBA = DatabaseAccessor() resultCodes = ResultCodes() class InputHandler(): - # def handleEmptyFields(self, username, password): - # isUsernameEmpty = self.checkTextEmpty(username) - # isPasswordEmpty = self.checkTextEmpty(password) - # - # if(isUsernameEmpty and isPasswordEmpty): - # return resultCodes.ERROR_EMPTY_FIELDS - # elif(isUsernameEmpty): - # return resultCodes.ERROR_EMPTY_USERNAME - # elif(isPasswordEmpty): - # return resultCodes.ERROR_EMPTY_PASSWORD - # else: - # return resultCodes.SUCCESS_FIELDS_FILLED - - def handleEmptyFields(self, username, password): + def checkInputNull(self, username, password): + if(username == None and password == None): + return resultCodes.ERROR_EMPTY_FIELDS + elif(username == None and password != None): + return resultCodes.ERROR_EMPTY_USERNAME + elif(password == None and username != None): + return resultCodes.ERROR_EMPTY_PASSWORD + return resultCodes.SUCCESS_FIELDS_FILLED + + def handleEmptyFields(self, user): + + username = user.getUsername() + password = user.getTextPassword() + isUsernameEmpty = self.checkTextEmpty(username) isPasswordEmpty = self.checkTextEmpty(password) @@ -38,7 +38,16 @@ def handleEmptyFields(self, username, password): else: return resultCodes.SUCCESS_FIELDS_FILLED - def handleInputLengthChecks(self, username, password): + def checkTextEmpty(self, text): + if(len(text) == 0): + return True + return False + + def handleInputLengthChecks(self, user): + + username = user.getUsername() + password = user.getTextPassword() + isUsernameLengthOk = self.checkInputLength('USERNAME', username) isPasswordLengthOk = self.checkInputLength('PASSWORD', password) @@ -51,27 +60,28 @@ def handleInputLengthChecks(self, username, password): else: return resultCodes.ERROR_USERNAME_LENGTH_INVALID - def checkTextEmpty(self, text): - return text == '' - def checkInputLength(self, inputType, input): if(inputType == 'USERNAME'): return len(input) >= 6 and len(input) <= 35 elif(inputType == 'PASSWORD'): return len(input) >= 8 and len(input) <= 65 - def checkForInvalidUsernameChars(self, username): + def checkForInvalidUsernameChars(self, user): + username = user.getUsername() + for currentChar in username: if(currentChar.isalpha() == False and currentChar.isdigit() == False): return False return True - def checkForExistingUsername(self, username): - selectedUsername = DBA.selectUsername(username) - return selectedUsername == username + def checkForExistingUsername(self, user): + selectedUsername = DBA.selectUsername(user) + return selectedUsername == user.getUsername() + + def verifyPassword(self, user): + password = user.getTextPassword().encode('utf-8') + selectedHashedPassword = DBA.selectHashedPassword(user).encode('utf-8') - '''test!''' - def verifyPassword(self, username, password): - selectedHashedPassword = DBA.selectHashedPassword(username) - isPasswordCorrect = bcrypt.check_password_hash(selectedHashedPassword, password) - return isPasswordCorrect + if(bcrypt.checkpw(password, selectedHashedPassword) == False): + return False + return True diff --git a/server/src/User.py b/server/src/User.py index 1e7805d..d523244 100644 --- a/server/src/User.py +++ b/server/src/User.py @@ -8,9 +8,9 @@ class User(): def __init__(self, username, textPassword): self.username = username self.textPassword = textPassword - self.hashedPassword = '' - self.userId = str(uuid.uuid4()) - self.securityToken = '' + self.hashedPassword = None + self.userId = None + self.securityToken = None def getUsername(self): return self.username @@ -27,15 +27,16 @@ def getUserId(self): def getSecurityToken(self): return self.securityToken - # update User Id! - - + def updateUserId(self, userId): + self.userId = userId def encryptAndUpdatePassword(self, password): - hashedPassword = bcrypt.hashpw(password.encode('utf8'), bcrypt.gensalt()) - self.hashedPassword = str(hashedPassword) + hashedPassword = bcrypt.hashpw(password.encode('utf-8'), bcrypt.gensalt()) + # generated password is encoded so must decode before storing in db + self.hashedPassword = hashedPassword.decode() - # generate and update user id! + def generateAndUpdateUserId(self): + self.userId = str(uuid.uuid4()) def generateAndUpdateSecurityToken(self): username = self.getUsername() diff --git a/server/src/__pycache__/DatabaseAccessor.cpython-36.pyc b/server/src/__pycache__/DatabaseAccessor.cpython-36.pyc index d2886f214e438435e9c214d595b5d44414e02ce3..3aa12dd6eedbb9b812564b360d01d8f30c47e219 100644 GIT binary patch delta 964 zcmbVKON-P%5bjqxne04ve2k*7E3Bfyl@VlR^dQJ8I2TEkiM2s8>-TA+j#R6oR>x>K$^7x@DvWEzfyeuvvt zRx%}qeQA>FuXr6d^lvO&4^)IbeUG#cSnngbddHD2q>(0>tQg@Nu>vAsvTFWKSy=;7 zwxA6WZ8f zW_{MCnPPXTJ%ge;aZj8lz@lc8yw1+tC15a*Gd-5U%b?5{gfF(70h91$IZc>hw4ep+ zQ_HH8@G-(DMh1ocz;3$mRlqh?bV0;gN}#ces<iGmNMD&|E55uyIU^KL^Ek~`SFB9to@ z;y2h2AwDShRf^2XSUE32nuP-Z8VgvorIX-^?Cg{L!r5sn=^;f3ClAzE_v% zZB7V5*#S{)P&paUgch_%$Bg2MjmaS^$bc72N3=s7{h4m8a^om5>=}Pw37JMCVVZCj zaW0Y<6U!GO1I?IlJxEJ*$~Ml4cFgVr+70LOX2|6Q$RX!InJZJECz09{$+JkQ51CA4 zfF4#g^eetFfj#1Px6Va!OrMjGJw3RkfAOViH)%g;uc*-0@pw{)@sM>lF~PJHx&G}u z`e;b#$O=SBAC#%ZS(?HS`dMncI2(=nIo!`$w;Sx8ZrLS_JkdAI5%g0aliQ-xUbX-> zg~r#^M)!Q#UxkKRX0Y{&Yi`}W=pUS0(+*#Z^P67)>!dOQ@7oQ5y!Bkx@Yqm3I6 zGXTZ-|AaQI$Igu2nr>D4>zF@e7HhXAMZPc7ZZ1Y=D9IYQt?RFq*IpBLa$Yz5)+QQH lIF=6wZ8#%*XbMd}^F7~%-_tMs&Z1>#38U9P;rg4u{1=^#v=jgU diff --git a/server/src/__pycache__/InputHandler.cpython-36.pyc b/server/src/__pycache__/InputHandler.cpython-36.pyc index defb075a5ffb376282405ccef5efbde49c4b8f21..90063aac5d0002d977fcd33a6855ef1cad9d5665 100644 GIT binary patch literal 2858 zcmZ`*TTdHD6yCcRV~nA>wM`@@01>B`wz@S4STX4WAf z=ZXB8{-t@XREfXPr+#PFyI@0Bnloq4TztNB^)E|H#eWNT-xwuL`$xOp$Td~)0oYiPa1R149{UkTdNgL|0-7T zCA~;ggSab1wbvc6I26^f2zfOcjK)dzI7)ie{qZ13qTxVPM^nB+pY-fK@bWt2h8$%X~fDUG#0p=-& z*Z~POz|%Z~pnlRklbOuIY^7j4n-!RgwZj%z5p#hpvJz&OEwM7@1-8s8n2T%$fLCQ{ zn=oxDlsq7V(nmA>>IR0`0-4}94-I~6Vx)7T_4RfpeW0W!e*h`WI6bqj?wEWXQnRgr zTKGl1RkP(Hzd$Nin|pgN_Wb7a-Oiu>=5}+Z(UvzZ%U-pcd#(EO=B#wL-fq8svDc6{ z+pjh@n(g-VE~cHGW}{|GON8;hbjfq%4e4fX_*>&k!1Uj z7@Q5x=9}OgnBVLd+Q^aA1+H8?2oplDEVGP7C;X7?PUCb6h(yh!QF6j<=)p-dULfKU zSpcayyogC!WMsZbV&tgiEk`1ITs=U7?D6zPa)9yzCqv1VG|$xDW)#Lu+<{o!0?`at zca5T6#O&x+I*il%Gse7fJ+~*>GPmaqED~7s3>5<5T%oLI2+o?-;yU&^o5({m4hJ=3 z3M_#QQazQ%q%2yP@*b|c%KyOnKEP0xE z%Dg!AAj={ulg;@_-cF-J1xk8mgYr~7#Os$rtE88VOL=OXes@i1U3ujCTG_zUsCyJ#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h~ZpneA4A8zv)zSxOp0sPl256ts z8o#468J`A3Y$yNjMVtOHf2GAarbfL?JS>TUL#=V-d96BgM7D4KoIGYsM)e*nh;Rn; zO}WIAii;_~R#ub*c%}KXGF={lP|QWUcM!LNCHCWf{j_$me%Wx@)t-A^>wCgd3%JBr z)iRE8Po27ngOBh{LX-le0mFbSpa|%lSwtq}NCeo-gMN)@swVw>s-_6lmRSZWH9!H7 Q2S8)jG1l`n`Mfs%4a7`n0ssI2 diff --git a/server/src/__pycache__/index.cpython-36.pyc b/server/src/__pycache__/index.cpython-36.pyc index 23b001045697c86fed68fd83d8b534384d8e4163..e33a6aa6cfffe8446ab9ab5476d25e36a89c6ed9 100644 GIT binary patch delta 137 zcmbO$vPy)@n3tEUeYsSuJm*F(env*Q%~Fi1Y~m~o3=GadT&x2mN*J;jQy83_kL)H~EI=6sW;Vtmxy^YuG7@pZL=u)60(9&o%se0g|2Te@8k!6V(q|L6?#6$_Q16|ne;>=*FS;Ap^ z@Z@C^|AWV#{2gBB?*H(eC7|gh@5ju%@AE#h&-^lOO!H~6XfA%-`S41=F*S_ure$1P zdD=C4uX(zQ8ipu$qp=@aQOIc&1cVM%wEl7sG%yQ{eFGPx3F0`$6D2_jhD=FtqAXRe zPPAB^=m`REz?rhtVvXk}`Kd}@#F~qsVrN~E;HAETrFpBth;!5uI==irPp>JHcy+b`|iYP zrQh-MPdTA65{yKCzJbcmHk35ECu$?fKf8$~$2%EMQSl30LtRHgf4l<-uyJyVP91flT)jBpk(3Yfw5?;pgLC15+LL z8yek*Ko6v=OLr*U(bnCQnS4eM!I;EFF!$@htrz!L>S(|ndksCkRvtaM4~1FZe^?o6 c257+P4p;`5SMrDHZ{^wEzp3lWw5A^a1tssx`v3p{ delta 239 zcmdnUwVjR2n3tDpdZ1M7VaAPIER2jIlld7%S%MifStc7WO8KxbFfcF!u`>`CD*%ZS zh7`sWre>yE<{IWK#%2aah7u+qi@BMRks*ZvsE^q%inX*jwaD-mM?qq7ae01GiY7}D zD^Tm?^-SgpEVo#SQ*+X8ae&n1CFZ6Uu>+-Uv4FTM8H)HOdoUMrumOb_n7EiGpJ!HP r_5(VloJCbb04P?(hf45+xFFS>KwQiOBsiERpJp);Kvy@JpH&F}Rk$vy diff --git a/server/src/controllers/__pycache__/SignUpController.cpython-36.pyc b/server/src/controllers/__pycache__/SignUpController.cpython-36.pyc index fb60988f8d0a4334e8e6db25cb89cbb23d7bed28..1d12d5c1b947c647f942cb69976153280e48a0a1 100644 GIT binary patch delta 656 zcmZWnO=}cE5bclo+?|as7+p85l zLWl(sL8y-anxxcF!wPoD4c9E?Q!cxP$Hb7-(zco}#tI5m7C2mE74*x)zWxZjHg>j4Hj8e9L_ebAqX zEK%iWcG9feco;>!I1c^tE$?1@cHtF@*ek-$kA+%fy8OcXt5rLh35AXG(VpnNo+$m5 z$Sbh8-%sCv+AQx|n;YwJBRrrDYOxM);CY4~bs)D8%MaGQqw7$r$-jle@?ou%7@o3% z;0bT0gOE!bDyxpj$MRsVALPk!o{Y43G*W7RCX?#Yj>v@s=1jsNx02A39dOFa2wj8~ z1e_RP74RyiO@P}F$^#%Ua)Wy1wjJHN2G?3WwbZ^-n*(YKLg63sn73Abx9_gI=vhX< O?hY{fkL}bOX;EnjJGDirH~X9Z-lcjNFGX=PDq9_3?0dEMiw-s36nH2G6Xb1BMT;3Y9;oF^0s6F0!QILhanAcIN<0@ zBX?~5b!2#9N;AU45#e*NxVh+UL`z!y3eJmgUP@kUt}W;5U&4Bd5$M|i^2za$Us+k_ zaoQ6xUr~|rl`)>qpm&Fp??2M+U=oehlTWi;3@GTBYFr3Eo^y@%~*_21BMc%4Q za_5I-P`U$g5l8>Du&_>kj#gIC>vRr-z_-;2ZKx$Zs)prg8VkK&-+VY9iu5<)P4z&< z>wWmDh}38WJD9Cm#5Oi*5i?*z{bX%iQ#Y*c!E^AjPq+b*P(8AG%V)d_1Fvb+H5wYt z4R&>B0p3Fi6M$fmqrMoOk9#oW+7o}C%tPAiK?(f>*u>sdx5mL6M`tP;u7)-}ORHDr FyFZVNgK7W( diff --git a/server/src/todo.txt b/server/src/todo.txt index 6287f4a..24cf1a5 100644 --- a/server/src/todo.txt +++ b/server/src/todo.txt @@ -3,7 +3,6 @@ #Server Refactoring - double password confirmation? - - start working on login controller (eventually use json tokens) - change button color? - Need Google Captcha diff --git a/server/test/__pycache__/test_DatabaseAccessor.cpython-36-PYTEST.pyc b/server/test/__pycache__/test_DatabaseAccessor.cpython-36-PYTEST.pyc index a8e2b6bb54c7a19eba040459846cd839909988e4..96856ede166860d0a54a322ddfe5c6328796f8bb 100644 GIT binary patch literal 9333 zcmd@aOKcn0asOPcNa|otd3Czo+?B%J}V{551on6NG;X9e)zw*Wl|u1;7L*I)W+ERa%u-6;mZ#Gc~#< z%!Hj-)mI0Yv?+=>Uv`YLVH$)h&R}`a93)(IlI5hC6b0MZ6wH)82r$hwmUt|fLriA_ za2;j_8-(i!OR^MPM_HN;!F7xcvk|!NW8!y&>}U%(6P7kE&A#W_+?`#myI!gCV9lz` zUauDGWxL|Jvv=)#i?y0dQx@yq$}CKMX!BW@7qg;2eBJV_dzNc27K^s)Ryoj;H!HQe zcf+bM$HsdFS1-!=EcjF4i}=^!>&^i1goe-%H>IZBkXJ>(KzzWY1}UN;1Ebws0PvhC}&XpV-oo6J}6`fGvf zu;jDbUqpJ(cD-2yh3yJBS6lZJ_iYau8AKWJA%bYohZ}$wk$``AqrsO{F`7VCtcsh0 zD0mVRnZ)ExxrsEnA)rzKQxI#4fT@H@fN6xuOl&F*v7tPWnrZ`V>w(T2Okt{%DC;$g0ENv<*<)v2Bo5BOl z{SAx{;S1uQ0yd0TMS^j}6<96(u{16;b#{`CH1v`P_<%P8qoa+1O_=**c%C9O)uzG( z;8g-%<%riOB0t?1x1$laPek`Ates@95WlBzJ>qwN#4pVF0A>uKA;J19#3$gu^M1lR zdCu<2vkW}To%)3}|K1nR<1x>YdxLmBO+3Gf>k-cfVxA>;lz5hbXNeysJ^=@w4|MT- zW;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zq@FF2eaemX$2sX>6H<}gFpc#hy=^hp@2Vs<{b7dMA=MS5DL+#vY^)!DjxF*i^jpkc z7I5~`rf0-VkqT_CaTgw@0nZj6%^57?-+2p;=Z1OY)HES|wK}$Xw;5VX6 znaA=8L+zQEsb0jpzQmccr`}0a`4nbIyHLPgV;+o-kZ>|zq}=YFWoMUG3#YGLtzO0! zF!i91vDBQSTe>_R;3m!%4dO^B2ezAMQ3K3vv=(hBs&~0HcDpw8c+LLWqH^cqr>q3Q zv+zyW$)|z-0LnDQ9*R649JkHR~AW>dpdwmA&GHM2Z8-l z39JOk$+7^R4yRBIb5Dm}CA1Re4tQTcdIW8b^bZh=VhkMcdU+fi=}6ya0(dfb$!TzJ z^KwrHpV9@X-DRku>1ZcZ+&FBS)CcRR57kj0uA?5Pqdvl^VOK2Hv_=iK$PaCCA2YZ? zMfwfYGDyyF@0jXV=bF$9uwT-k7wGSIq<_&aJr^j$$yAtv(WwajsxYvQsWC++@W+(0Wzp-G*n zw$+92Cc6N?fs_j=KP@hRYvb*de=VEKWi$Cy;10A|MuEjwDxmewqt*3P09%sZovGqx ziIg}xI+hBJj*sepS5o3iQBFzN?%12vc_c8!&>CFP4g0rZsyKCXQjIKveOsSOQhQIpPjQ&aYc#9KYQVgu`t^H!@0IG)+$dF%t)rhOydbJCQ!2>?LP5T{ zD6H*VyqDLZ}^37G!OZg&M&B-@#NzHJV7q*GymfT_d Q7kqA?Ao-*oI6{)|-|rB$S^xk5 diff --git a/server/test/__pycache__/test_SignUpController.cpython-36-PYTEST.pyc b/server/test/__pycache__/test_SignUpController.cpython-36-PYTEST.pyc index 2787e00eaff37c5d5341d5efe5fd6fb383eb4cd3..aa27d522218e2c6105f7b78294d44d9a54441319 100644 GIT binary patch literal 12384 zcmeI2O>7&-6@d4Tc`Wl6E**otCFcEUEHY3@oQO_A)( z%C=dVPFzap&jJk}TUf#pClz|vAaxExFdc}@+ibIFhzgfOgl z6z@YW8Bu(S3~`&{R{{`66@HeB2dnT@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rVf0J3FwuuwQ(`e!*4-3;`*%m=O*5ptS7#r(Zoa(pY|W9kG>cme44~GjSq?szBZ{ocz-j?!txQCpgY;$oH=vuoqK=h z{LcMj;_r*Cy@5dG<8K;oeyB*&Z_=KhEbKw?H#Z-&ZhF|Lq=g?myi8w(Y6>m#*Nj!r z53aWr%e`V6oL+QyM|~n#W85!pJOaCl%k-YRJ?Ie+mb#kZxomFMq;>GiDiDiqMRV`L9X1trf zmNCuMC9d;YMA!?igC+Qqcs-y2&83xo&Y2PDT%%es{PLX;b;S- z0jEmvoUp9u4jp?J6DU&BMUOlU&3}rxyreT-z9+vgtxNN;7=tC#-Bc61MFVwdT9zy8 ze#v|1RXw!so?&`;U0!$1$oJg3pZdaa`mr`e-z$E4QrkkGM7;E?u%ngHGQu0cg67&s z`BOQ0o@5757G;C9 z71#WhioS#Hu-!pF#oK)Y2td?!C$YqEu=LCa@g@Yx&w}u~UW`m+^=(`2j2Gz~M%e2D z1fAo~?Z!dZ8*oh?5fyewkI}~+F?y1SY@DEFSg!fiyrt;I^pb8^$~&2b6~h$0$I1zZ;(3U37VD1bQ*Oe*~LVRr%YKBy8D z>(g+$U9<|#Ok{Hjn7x|Gk$Fw#yGkhP=b!kdt`uJ@@arAh}|q?;JXcYhJtSu z1yA=o60DED>zD{Hi(y*CQg5$h7xLMh$r~xs*~{wb)y}p#dnfIf80q9^07C#BFbBZ+ qJqJ138@Eq$_1xl;zOrBpAipMdsY-rHWh(QFOO;hcTwZYnRPVpje9ia( diff --git a/server/test/test_DatabaseAccessor.py b/server/test/test_DatabaseAccessor.py index 21122dd..f166972 100644 --- a/server/test/test_DatabaseAccessor.py +++ b/server/test/test_DatabaseAccessor.py @@ -2,129 +2,152 @@ import sys sys.path.append('/Users/justinkwan/Documents/WebApps/UserAuth/server/src') from DatabaseAccessor import DatabaseAccessor -from InputHandler import InputHandler +from InputHandler import InputHandler +from User import User DBA = DatabaseAccessor() inputHandler = InputHandler() +def getUser(username, password, userId): + user = User(username, password) + user.encryptAndUpdatePassword(password) + user.updateUserId(userId) + return user + # test username, password and user id inserting function def test_insertUserInfo(): DBA.clearDatabase() - DBA.insertUserInfo('testUsername1', 'testPassword1', 'testId1') - selectedUsername = DBA.selectUsername('testUsername1') - selectedHashedPassword = DBA.selectHashedPassword('testUsername1') - selectedUserId = DBA.selectUserId('testId1') + user = getUser('testUsername1', 'testPassword1', 'testId1') + DBA.insertUserInfo(user) + selectedUsername = DBA.selectUsername(user) + selectedHashedPassword = DBA.selectHashedPassword(user) + selectedUserId = DBA.selectUserId(user) assert selectedUsername == 'testUsername1' - assert selectedHashedPassword == 'testPassword1' + assert selectedHashedPassword != None assert selectedUserId == 'testId1' + del user DBA.clearDatabase() - DBA.insertUserInfo('09812', '*7%-', 'testId2') - selectedUsername = DBA.selectUsername('09812') - selectedHashedPassword = DBA.selectHashedPassword('09812') - selectedUserId = DBA.selectUserId('testId2') + user = getUser('09812', '*7%-', 'testId2') + DBA.insertUserInfo(user) + selectedUsername = DBA.selectUsername(user) + selectedHashedPassword = DBA.selectHashedPassword(user) + selectedUserId = DBA.selectUserId(user) assert selectedUsername == '09812' - assert selectedHashedPassword == '*7%-' + assert selectedHashedPassword != None assert selectedUserId == 'testId2' + del user DBA.clearDatabase() - DBA.insertUserInfo('-l-&$', '=testpassw0rd', 'testId3') - selectedUsername = DBA.selectUsername('-l-&$') - selectedHashedPassword = DBA.selectHashedPassword('-l-&$') - selectedUserId = DBA.selectUserId('testId3') + user = getUser('-l-&$', '=testpassw0rd', 'testId3') + DBA.insertUserInfo(user) + selectedUsername = DBA.selectUsername(user) + selectedHashedPassword = DBA.selectHashedPassword(user) + selectedUserId = DBA.selectUserId(user) assert selectedUsername == '-l-&$' - assert selectedHashedPassword == '=testpassw0rd' + assert selectedHashedPassword != None assert selectedUserId == 'testId3' - DBA.clearDatabase() - - DBA.insertUserInfo('-l-&$', '=testpassw0rd', 'testId3') - selectedUsername = DBA.selectUsername('-l--&$') - selectedHashedPassword = DBA.selectHashedPassword('-l--&$') - selectedUserId = DBA.selectUserId('testId30') - assert selectedUsername == None - assert selectedHashedPassword == None - assert selectedUserId == None - + del user DBA.clearDatabase() # test username selecting function def test_selectUsername(): DBA.clearDatabase() - DBA.insertUserInfo('testUsername1', 'testPassword1', 'testId') - DBA.insertUserInfo('testUsername2', 'testPassword2', 'testId') - DBA.insertUserInfo('testUsername3', 'testPassword3', 'testId') - selectedUsername = DBA.selectUsername('testUsername2') + user1 = getUser('testUsername1', 'testPassword1', 'testId') + user2 = getUser('testUsername2', 'testPassword2', 'testId') + user3 = getUser('testUsername3', 'testPassword3', 'testId') + DBA.insertUserInfo(user1) + DBA.insertUserInfo(user2) + DBA.insertUserInfo(user3) + selectedUsername = DBA.selectUsername(user2) assert selectedUsername == 'testUsername2' + del user1 + del user2 + del user3 DBA.clearDatabase() - DBA.insertUserInfo('fakename', 'teddddstPassword1', 'testId') - DBA.insertUserInfo('testdwdadUsername2', 'testPawddassword2', 'testId') - DBA.insertUserInfo('w90', 'test', 'testId') - selectedUsername = DBA.selectUsername('w90') + user1 = getUser('fakename', 'teddddstPassword1', 'testId') + user2 = getUser('testdwdadUsername2', 'testPawddassword2', 'testId') + user3 = getUser('w90', 'test', 'testId') + DBA.insertUserInfo(user1) + DBA.insertUserInfo(user2) + DBA.insertUserInfo(user3) + selectedUsername = DBA.selectUsername(user3) assert selectedUsername == 'w90' - DBA.clearDatabase() - - DBA.insertUserInfo('fakename3', 'teddddstPassword1', 'testId') - DBA.insertUserInfo('testdwdadUsername3', 'testPawddassword2', 'testId') - DBA.insertUserInfo('3', 'test', 'testId') - selectedUsername = DBA.selectUsername('35') - assert selectedUsername == None - + del user1 + del user2 + del user3 DBA.clearDatabase() # test password selecting function def test_selectHashedPassword(): DBA.clearDatabase() - DBA.insertUserInfo('rando', 'testPassword1', 'testId') - DBA.insertUserInfo('rando2', 'testPassword2', 'testId') - DBA.insertUserInfo('rando3', 'testPassword3', 'testId') - selectedHashedPassword = DBA.selectHashedPassword('rando2') - assert selectedHashedPassword == 'testPassword2' + user1 = getUser('rando', 'testPassword1', 'testId') + user2 = getUser('rando2', 'testPassword2', 'testId') + user3 = getUser('rando3', 'testPassword3', 'testId') + DBA.insertUserInfo(user1) + DBA.insertUserInfo(user2) + DBA.insertUserInfo(user3) + selectedHashedPassword = DBA.selectHashedPassword(user2) + assert selectedHashedPassword != None + del user1 + del user2 + del user3 DBA.clearDatabase() - DBA.insertUserInfo('name1', 'teddddstPassword1', 'testId') - DBA.insertUserInfo('name2', 'testPawddassword2', 'testId') - DBA.insertUserInfo('name3', 'test', 'testId') - selectedHashedPassword = DBA.selectHashedPassword('name4') - assert selectedHashedPassword == None + user1 = getUser('name1', 'teddddstPassword1', 'testId') + user2 = getUser('name2', 'testPawddassword2', 'testId') + user3 = getUser('name3', 'test', 'testId') + DBA.insertUserInfo(user1) + DBA.insertUserInfo(user2) + DBA.insertUserInfo(user3) + selectedHashedPassword = DBA.selectHashedPassword(user3) + assert selectedHashedPassword != None + del user1 + del user2 + del user3 DBA.clearDatabase() # test user id selecting function def test_selectUserId(): DBA.clearDatabase() - DBA.insertUserInfo('name1', 'teddddstPassword1', 'testId1') - DBA.insertUserInfo('name2', 'teddddstPassword2', 'testId2') - DBA.insertUserInfo('name3', 'teddddstPassword3', 'testId3') - selectedUserId = DBA.selectUserId('testId3') + user1 = getUser('name1', 'teddddstPassword1', 'testId1') + user2 = getUser('name2', 'teddddstPassword2', 'testId2') + user3 = getUser('name3', 'teddddstPassword3', 'testId3') + DBA.insertUserInfo(user1) + DBA.insertUserInfo(user2) + DBA.insertUserInfo(user3) + selectedUserId = DBA.selectUserId(user3) assert selectedUserId == 'testId3' + del user1 + del user2 + del user3 DBA.clearDatabase() - DBA.insertUserInfo('name1', 'teddddstPassword1', 'testId0') - DBA.insertUserInfo('name2', 'teddddstPassword2', 'testId4') - DBA.insertUserInfo('name3', 'teddddstPassword3', 'testId9') - selectedUserId = DBA.selectUserId('testId4') + user1 = getUser('name1', 'teddddstPassword1', 'testId0') + user2 = getUser('name2', 'teddddstPassword2', 'testId4') + user3 = getUser('name3', 'teddddstPassword3', 'testId9') + DBA.insertUserInfo(user1) + DBA.insertUserInfo(user2) + DBA.insertUserInfo(user3) + selectedUserId = DBA.selectUserId(user2) assert selectedUserId == 'testId4' - DBA.clearDatabase() - - DBA.insertUserInfo('name1', 'teddddstPassword1', 'testId0') - DBA.insertUserInfo('name2', 'teddddstPassword2', 'testId4') - DBA.insertUserInfo('name3', 'teddddstPassword3', 'testId9') - selectedUserId = DBA.selectUserId('testId5') - assert selectedUserId == None - + del user1 + del user2 + del user3 DBA.clearDatabase() def test_handleQueryReturn(): diff --git a/server/test/test_InputHandler.py b/server/test/test_InputHandler.py index 59c6fdb..7af1099 100644 --- a/server/test/test_InputHandler.py +++ b/server/test/test_InputHandler.py @@ -3,15 +3,23 @@ sys.path.append('/Users/justinkwan/Documents/WebApps/UserAuth/server/src') from InputHandler import InputHandler from DatabaseAccessor import DatabaseAccessor +from User import User -inputHandler = InputHandler() +inputHandler = InputHandler() DBA = DatabaseAccessor() -def getUser(self, username, password): +def getUser(username, password): user = User(username, password) user.encryptAndUpdatePassword(password) + user.generateAndUpdateUserId() return user +def test_checkInputNull(): + assert inputHandler.checkInputNull(None, None) == 'EMPTY_FIELDS' + assert inputHandler.checkInputNull(None, 'password123') == 'EMPTY_USERNAME' + assert inputHandler.checkInputNull('username123', None) == 'EMPTY_PASSWORD' + assert inputHandler.checkInputNull('username123', 'password123') == 'ALL_FIELDS_FILLED' + def test_checkTextEmpty(): assert inputHandler.checkTextEmpty('Not Empty') == False assert inputHandler.checkTextEmpty('') == True @@ -38,58 +46,176 @@ def test_checkInputLength(): assert inputHandler.checkInputLength('PASSWORD', 'testusernametestusernametestusernametestusernametestusernametestusername') == False def test_handleEmptyFields(): - assert inputHandler.handleEmptyFields('', '') == 'EMPTY_FIELDS' - assert inputHandler.handleEmptyFields('', 'password') == 'EMPTY_USERNAME' - assert inputHandler.handleEmptyFields('username', '') == 'EMPTY_PASSWORD' - assert inputHandler.handleEmptyFields('username', 'password') == 'ALL_FIELDS_FILLED' + user = getUser('', '') + assert inputHandler.handleEmptyFields(user) == 'EMPTY_FIELDS' + del user + + user = getUser('', 'password') + assert inputHandler.handleEmptyFields(user) == 'EMPTY_USERNAME' + del user + + user = getUser('username', '') + assert inputHandler.handleEmptyFields(user) == 'EMPTY_PASSWORD' + del user + + user = getUser('username', 'password') + assert inputHandler.handleEmptyFields(user) == 'ALL_FIELDS_FILLED' + del user def test_handleInputLengthChecks(): - assert inputHandler.handleInputLengthChecks('NewUser123', 'testusername') == 'GOOD_USERNAME_&_PASSWORD_LENGTH' - assert inputHandler.handleInputLengthChecks('usrnmm', 'testusernametestusernametestusernam') == 'GOOD_USERNAME_&_PASSWORD_LENGTH' - assert inputHandler.handleInputLengthChecks('testusernametestusernametestusername', 'testusernametestusernametestusernametestusernametestusernametestu;') == 'INVALID_USERNAME_LENGTH' - assert inputHandler.handleInputLengthChecks('', 'usrnmdd') == 'INVALID_USERNAME_LENGTH' - assert inputHandler.handleInputLengthChecks('User', '') == 'INVALID_USERNAME_LENGTH' - assert inputHandler.handleInputLengthChecks(',', 'testusernametestusernametestusernametestusernametestusernametestusername') == 'INVALID_USERNAME_LENGTH' - assert inputHandler.handleInputLengthChecks('usrnmm', 'testusernametestusernametestusernametestusernametestusernametestu') == 'GOOD_USERNAME_&_PASSWORD_LENGTH' - assert inputHandler.handleInputLengthChecks('usrnmm', 'testusernametestusernametestusernametestusernametestusernametestus') == 'INVALID_PASSWORD_LENGTH' - assert inputHandler.handleInputLengthChecks('usrnmm', 'passwor') == 'INVALID_PASSWORD_LENGTH' + user = getUser('NewUser123', 'testusername') + assert inputHandler.handleInputLengthChecks(user) == 'GOOD_USERNAME_&_PASSWORD_LENGTH' + del user + + user = getUser('usrnmm', 'testusernametestusernametestusernam') + assert inputHandler.handleInputLengthChecks(user) == 'GOOD_USERNAME_&_PASSWORD_LENGTH' + del user + + user = getUser('testusernametestusernametestusername', 'testusernametestusernametestusernametestusernametestusernametestu;') + assert inputHandler.handleInputLengthChecks(user) == 'INVALID_USERNAME_LENGTH' + del user + + user = getUser('', 'usrnmdd') + assert inputHandler.handleInputLengthChecks(user) == 'INVALID_USERNAME_LENGTH' + del user + + user = getUser('User', '') + assert inputHandler.handleInputLengthChecks(user) == 'INVALID_USERNAME_LENGTH' + del user + + user = getUser(',', 'testusernametestusernametestusernametestusernametestusernametestusername') + assert inputHandler.handleInputLengthChecks(user) == 'INVALID_USERNAME_LENGTH' + del user + + user = getUser('usrnmm', 'testusernametestusernametestusernametestusernametestusernametestu') + assert inputHandler.handleInputLengthChecks(user) == 'GOOD_USERNAME_&_PASSWORD_LENGTH' + del user + + user = getUser('usrnmm', 'testusernametestusernametestusernametestusernametestusernametestus') + assert inputHandler.handleInputLengthChecks(user) == 'INVALID_PASSWORD_LENGTH' + del user + + user = getUser('usrnmm', 'passwor') + assert inputHandler.handleInputLengthChecks(user) == 'INVALID_PASSWORD_LENGTH' + del user def test_checkForInvalidUsernameChars(): - assert inputHandler.checkForInvalidUsernameChars("string2") == True - assert inputHandler.checkForInvalidUsernameChars("fake$username)") == False - assert inputHandler.checkForInvalidUsernameChars(")(*&^)") == False - assert inputHandler.checkForInvalidUsernameChars(")(*&^)textTest*&^%moretestis*fun';:") == False + user = getUser('string2', 'password123') + assert inputHandler.checkForInvalidUsernameChars(user) == True + del user + + user = getUser('fake$username)', 'password123') + assert inputHandler.checkForInvalidUsernameChars(user) == False + del user + + user = getUser(')(*&^)', 'password123') + assert inputHandler.checkForInvalidUsernameChars(user) == False + del user + + user = getUser(')(*&^)textTest*&^%moretestis*fun;:', 'password123') + assert inputHandler.checkForInvalidUsernameChars(user) == False + del user def test_checkForExistingUsername(): DBA.clearDatabase() - DBA.insertUserInfo('randomename1', 'teddddstPassword1', 'testId') - DBA.insertUserInfo('anotherrand0mName', 'testPawddassword2', 'testId') - DBA.insertUserInfo('09876543', 'test', 'testId') - DBA.insertUserInfo('johnnotrealperson', 'password123', 'testId') - doesUsernameExist = inputHandler.checkForExistingUsername('09876543') + user1 = getUser('randomename1', 'teddddstPassword1') + user2 = getUser('anotherrand0mName', 'testPawddassword2') + user3 = getUser('09876543', 'test') + user4 = getUser('09876543', 'test') + DBA.insertUserInfo(user1) + DBA.insertUserInfo(user2) + DBA.insertUserInfo(user3) + doesUsernameExist = inputHandler.checkForExistingUsername(user4) assert doesUsernameExist == True + del user1 + del user2 + del user3 + del user4 DBA.clearDatabase() - DBA.insertUserInfo('robertH', 'teddddstPassword1', 'testId') - DBA.insertUserInfo('william', 'testPawddassword2', 'testId') - DBA.insertUserInfo('Johnathan', 'test', 'testId') - DBA.insertUserInfo('randomguy', 'password123', 'testId') - doesUsernameExist = inputHandler.checkForExistingUsername('johnathan') - assert doesUsernameExist == False + user1 = getUser('robertH', 'teddddstPassword1') + user2 = getUser('william', 'testPawddassword2') + user3 = getUser('Johnathan', 'test') + user4 = getUser('robertH', 'test') + DBA.insertUserInfo(user1) + DBA.insertUserInfo(user2) + DBA.insertUserInfo(user3) + doesUsernameExist = inputHandler.checkForExistingUsername(user4) + assert doesUsernameExist == True + del user1 + del user2 + del user3 + del user4 DBA.clearDatabase() - DBA.insertUserInfo('001', 'teddddstPassword1', 'testId') - DBA.insertUserInfo('02000000009', 'testPawddassword2', 'testId') - DBA.insertUserInfo('joe', 'test', 'testId') - DBA.insertUserInfo('testname', 'password123', 'testId') - doesUsernameExist = inputHandler.checkForExistingUsername('02000000009') - assert doesUsernameExist == True + user1 = getUser('001', 'teddddstPassword1') + user2 = getUser('02000000009', 'testPawddassword2') + user3 = getUser('joe', 'test') + user4 = getUser('uniqueName', 'password123') + DBA.insertUserInfo(user1) + DBA.insertUserInfo(user2) + DBA.insertUserInfo(user3) + doesUsernameExist = inputHandler.checkForExistingUsername(user4) + assert doesUsernameExist == False + del user1 + del user2 + del user3 + del user4 DBA.clearDatabase() # def test_verifyPassword(): -# user = getUser('username1', 'password1') +# user1 = getUser('username1', 'password1') +# DBA.insertUserInfo(user1) +# user2 = getUser('username1', 'password1') +# isPasswordCorrect = inputHandler.verifyPassword(user2) +# assert isPasswordCorrect == True +# +# del user1 +# del user2 +# DBA.clearDatabase() # +# user1 = getUser('username2', 'password2') +# DBA.insertUserInfo(user1) +# user2 = getUser('username2', 'password2') +# isPasswordCorrect = inputHandler.verifyPassword(user2) +# assert isPasswordCorrect == True +# +# del user1 +# del user2 +# DBA.clearDatabase() + + +def test_verifyPassword2(): + user1 = getUser('username1', 'password1') + DBA.insertUserInfo(user1) + user2 = getUser('username1', 'password1') + isPasswordCorrect = inputHandler.verifyPassword(user2) + assert isPasswordCorrect == True + + del user1 + del user2 + DBA.clearDatabase() + + user1 = getUser('username2', 'password2') + DBA.insertUserInfo(user1) + user2 = getUser('username2', 'password1') + isPasswordCorrect = inputHandler.verifyPassword(user2) + assert isPasswordCorrect == False + + del user1 + del user2 + DBA.clearDatabase() + + user1 = getUser('username3', '^&*()()') + DBA.insertUserInfo(user1) + user2 = getUser('username3', '^&*()()') + isPasswordCorrect = inputHandler.verifyPassword(user2) + assert isPasswordCorrect == True + + del user1 + del user2 + DBA.clearDatabase() diff --git a/server/test/test_SignUpController.py b/server/test/test_SignUpController.py index 0c19fd8..b792e1c 100644 --- a/server/test/test_SignUpController.py +++ b/server/test/test_SignUpController.py @@ -7,11 +7,22 @@ signUpController = SignUpController() DBA = DatabaseAccessor() +def getUser(username, password): + user = User(username, password) + user.encryptAndUpdatePassword(password) + user.generateAndUpdateUserId() + return user + def test_handleUserSignUp(): + DBA.clearDatabase() + # empty field(s) tests assert signUpController.handleUserSignUp('', '') == 'EMPTY_FIELDS' + assert signUpController.handleUserSignUp(None, None) == 'EMPTY_FIELDS' assert signUpController.handleUserSignUp('', 'password') == 'EMPTY_USERNAME' + assert signUpController.handleUserSignUp(None, 'password') == 'EMPTY_USERNAME' assert signUpController.handleUserSignUp('username', '') == 'EMPTY_PASSWORD' + assert signUpController.handleUserSignUp('username', None) == 'EMPTY_PASSWORD' # success tests assert signUpController.handleUserSignUp('username1', 'password') == 'SUCCESS' @@ -27,7 +38,7 @@ def test_handleUserSignUp(): assert signUpController.handleUserSignUp('{}{}{}{}{}', 'password') == 'INVALID_USERNAME_CHARS' # duplicate username tests - DBA.insertUserInfo('username', 'password1', 'testId') + signUpController.handleUserSignUp('username', 'password1') assert signUpController.handleUserSignUp('username', 'password1') == 'DUPLICATE_USERNAME' DBA.clearDatabase() signUpController.handleUserSignUp('Username', 'password') @@ -64,3 +75,4 @@ def test_getUser(): assert len(user.getUserId()) == 36 del user + DBA.clearDatabase() diff --git a/server/test/test_User.py b/server/test/test_User.py index 7484985..7acdb5f 100644 --- a/server/test/test_User.py +++ b/server/test/test_User.py @@ -4,34 +4,52 @@ from User import User import jwt +def getUser(username, password): + user = User(username, password) + user.encryptAndUpdatePassword(password) + user.generateAndUpdateUserId() + return user + def test_getUsername(): - user = User('username1', 'password1') + user = getUser('username1', 'password1') assert user.getUsername() == 'username1' - del user def test_getTextPassword(): - user = User('username2', 'password2') + user = getUser('username2', 'password2') assert user.getTextPassword() == 'password2' - del user def test_getHashedPassword(): - user = User('username3', 'password3') - user.encryptAndUpdatePassword('password3') + user = getUser('username3', 'password3') assert user.getHashedPassword() != None - del user def test_getUserId(): - user = User('username4', 'password4') + user = getUser('username4', 'password4') assert user.getUserId() != None assert len(user.getUserId()) == 36 + del user +def test_updateUserId(): + user = getUser('username8', 'password8') + user.updateUserId('#123') + assert user.getUserId() == '#123' del user + user = getUser('username9', 'password9') + user.updateUserId(123) + assert user.getUserId() == 123 + del user + +def test_generateAndUpdateUserId(): + user = getUser('username10', 'password10') + user.generateAndUpdateUserId() + assert user.getUserId() != None + assert len(user.getUserId()) == 36 + def test_getSecurityToken(): - user = User('username5', 'password5') + user = getUser('username5', 'password5') user.generateAndUpdateSecurityToken() securityToken = user.getSecurityToken() @@ -44,14 +62,12 @@ def test_getSecurityToken(): assert 'user id' in userData def test_encryptAndUpdatePassword(): - user = User('username6', 'password6') - user.encryptAndUpdatePassword('password6') + user = getUser('username6', 'password6') assert user.getHashedPassword() != None - del user def test_generateAndUpdateSecurityToken(): - user = User('username7', 'password7') + user = getUser('username7', 'password7') user.generateAndUpdateSecurityToken() securityToken = user.getSecurityToken()