From f0a3b49cdea7de5a0afe8d946c03ca21b62c33e9 Mon Sep 17 00:00:00 2001 From: misarb Date: Thu, 25 Aug 2022 20:35:47 +0100 Subject: [PATCH] checking creadentials with unit test --- .../check_credentials.cpython-310.pyc | Bin 0 -> 937 bytes ...k_credetianls.cpython-310-pytest-7.1.2.pyc | Bin 0 -> 2502 bytes .../checking credentials/check_credentials.py | 40 ++++++++++++++++++ .../test_check_credetianls.py | 21 +++++++++ 4 files changed, 61 insertions(+) create mode 100644 programs/checking credentials/__pycache__/check_credentials.cpython-310.pyc create mode 100644 programs/checking credentials/__pycache__/test_check_credetianls.cpython-310-pytest-7.1.2.pyc create mode 100644 programs/checking credentials/check_credentials.py create mode 100644 programs/checking credentials/test_check_credetianls.py diff --git a/programs/checking credentials/__pycache__/check_credentials.cpython-310.pyc b/programs/checking credentials/__pycache__/check_credentials.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3acc0252425abf1da068bdf7cc83d49c1bd36f22 GIT binary patch literal 937 zcmZ8g+fvg&7~W0NCOzrkVVL2n<8V_s6af`x7zH_bKomjLLS>fSrHxIKu$xkd$&54j zAbRPuc;)ThdWDbRm48ye>hA3Kf8T%FY?Ad#r94W;ca#1w5c-*lKG1;A!;&`u7-HB# zHN-Tge?~RT@FuDlXAnW_G|9XeB_PlZEy9w&02q!nro}qbV}luShGlk*I2)U>73TsJ z;Zq#vSvD?2d1kf@K_k3`>bK%zRE)GEB!;6bvj$O|1+9Y~jm%V=pbgN|k(Fu-bO!WX zluLE)a44y4WkfxxNG)Wh7BW(sjm$w5LH8&JE8o&YJ-{q?iZNpOO$5A<@*;5Uiyjps z^i>lc_)C2`S1xiYSJ&0h!lT8d<(1XPPo6$od%phS<;JVct=HRc-oC4;A+k>yKWH@V z4=tzddj6r1LFcG@d=iHG@cf?2Pu!WDn!bDQ{>*H}5Ex$Ge-Pe&zeC2tiLu%G$j^f|SOLz_gXEVCPSAQh$x%bF&^u$q~4SWC7MyuptZw!a~99nSHaSDRj& zSKGEEqPoOoEAag4svR^t`-`3%h|Yc|usv5+DQxE*P>=DdFT92zZSXZYZP{+4Oa*7$ z4d5BhoqK(rasNaOq^bShOBDR28ng#aXsePL6#dHG~^`U?Ah~18nrnNk_VlVKgKTl~##Vg-{Y{j!rS7gho_w3es0YGb%bo>C@11EXZr& zNHpSDr*4D$%x@-v7Yf_B(7k$8i8`~(wa5!Xx9KfKejVLPBaX0jrn1y< zrZba8=jN`(`xDLGUHt5NYC3zRGW>?Eb}S)wcGlMG^&|h{%IB%l=``?LE}sH8MQD$p zi9Z1nvQ56*>%m_4XhOTBOJ68Gg(*F?t8~>i>1ka}e48kzDpR}KK4lul_mwk^>4|o# zpOI%oEI{5!=o#fp;1$qoQl>LwFk%ZwbP0@jh$GO05r*_(w6sd!s%MlHe$i)0PiH18 zcJ+XQZzLv+Dt3)C`hxxltk6i0LQ|k=J@rUo1S)4e;Rbxw?m11BK-jdib#I|{vTh6O zhrUyOP)2Xr77J)=wpf&bRa@9ruN(;3+q6Ymkj4IbJEeiGrz*VT0MyW1MOa7JycqW+ zMdWKWm^Rg5(6Vi%I&wg8q&d5UWQpOzONp}kzb7h;qmIW zFP9aF`Ab6QsQ&^p+$6{-&ETL9XgU z9P}~3f2xl=f`a$zB>)H=Tpu8IWFU6xkl1~b&{G9u4#iF%h@FwBr}~7qyOYT*sRv6E|7n^S-uiTxuIQ*R*X= z;!`dqk;g~mS;FDb8rxseTg0kU{u=wLh6(d7lovm?Z9 z2xp)B33~St77>;ZDhTBPNM24|@$zat@)#`Rz#4!(nVOe6FHcB1>t;7YCDUaP$_n?N z^B@70AB56EKgRKVrK%?qj^CIn+~+DfMm7uApp&f{H-g_oKuMG*LvDy%M{en5%*yqf epGPrkhyFtfA%TZ@o|LFbp(!RcRZ}yylKL;j{eEQt literal 0 HcmV?d00001 diff --git a/programs/checking credentials/check_credentials.py b/programs/checking credentials/check_credentials.py new file mode 100644 index 0000000..2cdb819 --- /dev/null +++ b/programs/checking credentials/check_credentials.py @@ -0,0 +1,40 @@ +import re +def check_credentials(email,pswd): + capitalAlpha="ABCDEFGHIJKLMNOPQRSTUVWXYZ" + smallAlpha="abcdefghijklmnopqrstuvwxyz" + specialchar="$@_" + digits="0123456789" + c,s ,sc,d=0,0,0,0 + pswdLen = len(pswd) + regex = '^[a-z0-9]+[\._]?[a-z0-9]+[@]\w+[.]\w{2,3}$' + ## password check + if(pswdLen>7): + for i in pswd : + if(i in capitalAlpha): + c = c +1 ## to count capital alphabatic in the input + if(i in smallAlpha): + s =s+1 ## to count the smalalphabitic + if(i in specialchar): + sc =sc +1 ## to count the specilachar + if( i in digits): + d=d+1 ## to count the digits + if(c>=1 and s>=1 and sc>=1 and d >=1 and c+s+sc+d==pswdLen): + print("password accepted") + return True + + else: + print("password not valid") + return False + + ## email check + if(re.search(regex,email)): + print("Email Valid") + return True + else: + print("Email not valide ") + return False + + +# email =input("enter an Email :") +# pswd = input("Enter a password :") +# check_credentials(email,pswd) \ No newline at end of file diff --git a/programs/checking credentials/test_check_credetianls.py b/programs/checking credentials/test_check_credetianls.py new file mode 100644 index 0000000..16c5d8f --- /dev/null +++ b/programs/checking credentials/test_check_credetianls.py @@ -0,0 +1,21 @@ +from ast import Assert +from re import T +import pytest +from check_credentials import check_credentials as checkID + +mails = ['a@m.m', '01mail_na-me@mail.com.com', '01mailna-me@mail.com', '01mail""na-me@mail.com', '01mail"!,:"na-me@mail.com', '01mail.na-me@mail.com'] +pswd = ['ssSS45@@qe','ssSS45@@qr'] +def test_valide_email(): + for i in mails: + assert checkID(i,"ssSS45@@qr") is True + +def test_pswd_valide(): + for i in pswd: + assert checkID('x@gmailcom',i) is True + + + + + + +