From 5678a3389bae92130f21a140324dbd25442553bd Mon Sep 17 00:00:00 2001 From: duckduckgrayduck <102841251+duckduckgrayduck@users.noreply.github.com> Date: Tue, 10 Dec 2024 20:47:36 -0600 Subject: [PATCH] Add tests to workflow --- .github/workflows/main.yml | 25 ++++++++- .../__pycache__/__init__.cpython-310.pyc | Bin 0 -> 436 bytes .../__pycache__/exceptions.cpython-310.pyc | Bin 0 -> 1720 bytes .../__pycache__/squarelet.cpython-310.pyc | Bin 0 -> 5140 bytes .../__pycache__/squarelet.cpython-311.pyc | Bin 8866 -> 8866 bytes .../tests.cpython-310-pytest-7.4.2.pyc | Bin 0 -> 3220 bytes .../tests.cpython-310-pytest-8.3.4.pyc | Bin 0 -> 3220 bytes .../tests.cpython-311-pytest-8.3.4.pyc | Bin 0 -> 6243 bytes src/squarelet/tests.py | 51 ++++++++++++++++++ tox.ini | 12 +++++ 10 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 src/squarelet/__pycache__/__init__.cpython-310.pyc create mode 100644 src/squarelet/__pycache__/exceptions.cpython-310.pyc create mode 100644 src/squarelet/__pycache__/squarelet.cpython-310.pyc create mode 100644 src/squarelet/__pycache__/tests.cpython-310-pytest-7.4.2.pyc create mode 100644 src/squarelet/__pycache__/tests.cpython-310-pytest-8.3.4.pyc create mode 100644 src/squarelet/__pycache__/tests.cpython-311-pytest-8.3.4.pyc create mode 100644 src/squarelet/tests.py create mode 100644 tox.ini diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 172830e..6fede02 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,7 +11,6 @@ on: jobs: lint-and-format: runs-on: ubuntu-latest - steps: - name: Check out repository uses: actions/checkout@v3 @@ -33,3 +32,27 @@ jobs: - name: Run Black on squarelet.py run: | black src/squarelet/squarelet.py + + run-tests: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] + env: + SQ_USER: ${{ secrets.SQ_USER }} + SQ_PASSWORD: ${{ secrets.SQ_PASSWORD }} + steps: + - name: Check out code + uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install python-squarelet pytest + - name: Run tests + run: | + pytest src/squarelet/tests.py diff --git a/src/squarelet/__pycache__/__init__.cpython-310.pyc b/src/squarelet/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..de05e363e56227f86d22d4c2afcd4bd1d8da4ef3 GIT binary patch literal 436 zcmYk2%Sr<=6oxaM`_wBG*CK9aVQ1$`#Ic>?U~jZD2-ys!2{tg9)MP5{Bl$|%x+?et zu1u;{59H(g{|`CIVTXqSQ1x-~^n7Um@UF%GYAA81j?h2=86}_wGz@?m$SfPwgeJA1 zMQvy+41!Maa`iMQxaU&TV;dLlwLee z6V4fzXC01_O317fy%{Mn`u0z|42vPFlQj|b&I)ZA+~@trqMr`ZOuAV*NJe=kgGrnv zKW1~+kCRC{>dKRD(u?zcR>XPsP~?+z7&fIZeqY4(pJi*W+ju?4%bKuCa7#tp)^Idj z4Nt?@(5vK4g*U*Dbg%Jw9W5Bek%$m}jh35w!K$nM<&og?=uZ^|sYqQE?d3*#HB`hd**%o-t*Y?^)7+yuk9bkH6!Ft z6c;ZTBM+eY2^d9&Ci2J z>#ZwYD9@pz$&dndqUbPvMMglb(wF&=y&{YZJK%}68&A)^wdb65C!c>Mz2-$F{oJF* z(aW6|^nz#fi_v-qT8!2#`3+-5eotmZ&>1;^enZ_S*gL?nH1-(u*o^vZQ0z6t6`tv9 z@@qP#KT(q@f-9qCq4R>(YrxzoOe80nLg-{m_iZCcyfC4kbh zppQb^iQ8yz_#i{$MPZe0JHDy4YjYt=QwAY+(w2E$janw%*tgl?b9|oCc2$TN4zD!~M_n~$2hDhnC(cl!sr2=h|9|3sEvEB<_<4VQ-7 zILAxRrBW~+ESJ17<+Dcfs`PQR$9%;A1}zu5%9_V3aBjL2U*6A$fD42Jc2!h zjVYjq*?p;aWyi3fIRECr-2z9K5`PF2AK~N&Xi!~Co9}-A&7AMft~us5Otj;%uz4Y? zsx)JaGAz2nExNq3bc^a*w>KYI?FTmO9YKyR$t+;-#siAoKO;#jNAb9KLW_akTlD^CNyA S51z*|XQbEZ^?D5NP4*9<0hH|k literal 0 HcmV?d00001 diff --git a/src/squarelet/__pycache__/squarelet.cpython-310.pyc b/src/squarelet/__pycache__/squarelet.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b9cbb6b75944229498d224f5c0cb2c7ef1c7ed81 GIT binary patch literal 5140 zcmZ`-&u`qu73ObpxvQ0|*p3|+F_XY?HceLf)g*O(G)gSnLL9}F<)qjKWhf3Mam8J3 zX1JD3tcoJ`)dh;Qy*L4+qL&G8+Ypi+8=p19lRjoB$z8?&378`m0dGXmW;z^bi!A8_)St5dHSZpNy zB8{UW&HDjH1D<>~Ohh4qA`de=koY_JYn>*C=(Z=G)q`De&l?fh^4$(xRHvY z8mjGo>AjO!=H5{<;z_}6auH@^wo*y-^)_CpgetP3_y`@Ch$98 zc)*pL(gMmYs&f~ zZKuAg>DtKQuNRH(RM9M^nSKYWb!TqTIx{1epDP+WM`&bMjWF#hBDrcUW2t3GJC3qU zNN14nG-s_@=?xJe{iv5nZx9Kwm2)P&)kq}akf(Cy{KAF#YnNBT`D-he!fVTm(xV@& z=G-FfCHb(B-X!j%do>XP(I{Op?lb^4x}kEGoZ`tEPsGOfvL1@0sQNDSb zX+JH(@HCbYPr^99qdU4kZjSEhmf0{Y-PyD3S>5`^a?2BkLaaSmBqkzG4(i)zDv(Na z0JFxM2n#^n)pqqyD6mv;^-p2MI)=(KE(f?JFbIcXf!Gg-}9k+2s>gAw>`%XpTZuQJ}&a>H}hka(XErcY`(X zoynfE<7*>*4xAxcDDM*)UO>!%xuD z?nV-^gd?_x0|ty+Iw$`tKr8b!U7mt@8%+c-4uG)q=3c|J08DewF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4i zH<@o>Vq(kWpd?OB;X-kNeU43lw%($bE72F&-y9QKKsrjU@ zO3$ZIM&>=#kTC#(yRfyTBIkaDM9Y?Tkrz=WEv}pnb?Q@v(p-(=&3tVwT#MoYJKLFY z*?|>e>^?+6o8n${LsctSx^#&i*tC}3geL&zIDQR(l#E4&oFeTWZE6t&RCQ7Xq&|)R zoNoAp42h?-)iy=CQMKnjgpSJ8f5Cl%Zf?{dTKj*_cfQ*IN|s(eeV8F*K@bntSP!v; zw&4nmK02jK8b*2SV^!2!TA_E1u6grSUE7A|%O|LK>Eb^eP_@SkN0lbk#xIR6eT%jX&n{Cvr?9G=9&DwwcMd9H3sg>k;32Hj-y)ch z)|CE}&MzUEsOp3~FMU+ENyQ>Lvs{Vc!epp=NR>CV_g1weCw-Vm6fG)EEOFTR^n$;l zsd~mhKADBPo2p?u@GIlHGI+@Ghf36zzS6SzH7vqEBJ(lKQme^-inH{?u$Qx82Cm9R z7~=m5S;buGh9OiJ!|uxB2MZrwTj6KvY1*q)H5!##N(ngWC|@C?GO}{Yfz+y=N|RH# zg`O8w<9QmAqH_>S{x{xf@2EH9AMu{@P8#)U#{aHyoYQly<9r<_=~9t^>>+Dw!#?Pe zXQI+1(r`rriE^X*pHq7r(V}9*ERubeuD;wJ7HQU2L0@r&3PuG-1q?wXYfz-isvhBQ z(6#^Wwaf2U`+iPomp@L1w$%I)GW3o2fw%vorT1p#;I|PznxLmF%|mhEnWS$G{ix|1 NmfG{7Brs;J{{fbCChPzJ literal 0 HcmV?d00001 diff --git a/src/squarelet/__pycache__/squarelet.cpython-311.pyc b/src/squarelet/__pycache__/squarelet.cpython-311.pyc index bab853b7bd19d774ce7b1c5afa33cc9ff0099a3e..205e60495f011534a8a7af78fb2992859b8e89c7 100644 GIT binary patch delta 19 ZcmZ4Fy2zDlIWI340}xD|ypd~$5&$*<1wjA+ delta 19 ZcmZ4Fy2zDlIWI340}zx&Z{(Vx1OPNI1nK|) diff --git a/src/squarelet/__pycache__/tests.cpython-310-pytest-7.4.2.pyc b/src/squarelet/__pycache__/tests.cpython-310-pytest-7.4.2.pyc new file mode 100644 index 0000000000000000000000000000000000000000..33b63c6ab2453b77f5fd5c42eb29e12656074d2a GIT binary patch literal 3220 zcmb_eOOqTq5iZrcA2VaGjj_Ri@Zt@Mg>H{$#t&k>tiul?I1I3}#6n*x$}Nq%daA41 zl6uC|R7VilCnA6g$365M_sY-Fl?(6_9Kj<~>K^wDm=oPmsZ^>|N~OO1Qq|g8(}Ca4 z-+%f1a^yIF!OrT>gU%=LNCkp9J%sw-C)ssj{-qJ389?dHRdJC!gvTC_j6+xA*x^KYcv?V4&1k z{;=E4#(C%H=%~Z0{$zwM7S)7xD)Aggy0G2&StfZp5xI^hl8Z7MaUG8{DUT|_5?{NO z)DbTab5WJrd(M^cVK0fRBl#l58M+0^a>AF6*nr_TTiro5;$7Kg{IGjI)?F$3-P6c- z6&^}we5@~=+S0y>X9GjG4x;U~iM#lR{}30!)F&X8zYr8aosIQX7^$71Gb4=5+?v$x zgv`9!lRr`zf4BDb0a0k*cTargD{tL5Z{})df z0dzH{T}%Ri)&Vc6faA>hVOG$?Jfq9=r&-D9@wIW)kV2k)Y|jbdlI4oKrdnYZpH5{-9Znfw1^ z8Nv4jmxFh#lQeaE)e+tN1n>u2PBX~iw4W74D)?CRtI-%zU$ z2~8Yy3s<#U-(2l%uXeU<$A0wAYUiHGGAk|s?)8S*A!MhGiu?)~B_`_c+&>V3>~khx zFn3~j3^#oQigM;e0k;3RK_GYL9&+!AOPtRg=J}5Ayz+pTft@xT`PCyrfUAk~D|pbB z_|p&RXW|&?Dx0VQa%VqNoF3(BK=-o)PWx{umFjk00^)LJ+2gc_fZGMa3GH#|P-MB} zQXr4&R{C~t2{AD|AA7Xi>w#2TzwM~0eWwFYmm*YSdy;5cV4 zQWHErJmD-bhuE6lq!!Oq4KhV5I7mS`mOe=#QK&f%MnxN20sn#iQ$+k_ zKQH&IBoLRtC2<-30{YlSaR4r@)!!DbfFv%YuL%Sgoobf#r9!`q{e=z}$(1Gzl z$4dvGxV>FpT*V33P<#yqqDfpw@eLH;MDZ;UNy7s478<^d;(ZXSnZ2{xxwqQ6YYEBb z{N}AQz1!y@f5kxF<_U67YMs3St4Tz0+g*3B|MSnD_!v58aE_y=1#=FamCK36xy!s0 z7cq>*5mC(iYk(NQDgg`!bs&GDf_VrS4i*?Dh+(inQ3NDLDxNnCmbbvxG+4f8Mi*EH zth#{J&|oz*SdCN*-e}j+0;?^=DB!aNB-5U5o9mlJ=Miv9R#Hp!VB+-g;)3%CFF2H! zY+U7~q5`jA2D8%!);HOOYl*<^iw+1t?R$t?z{V0=TTrXkaL7drZKBvZQ>L((A;0b> zYXUF5qJ;v}LhOLh{!mus3RVm_&H?5vR$_}4Tv11(V@rz0)s$r_TgAq$)y{3(u|U}t z-@)ba>a|i7uGz9@tMZu(AR>Q(kT!|QZ(Q+Xuq2msl&0`vn!>ekQ4$T*^|jQpa>phV z6gJ4wBathv8>c2rBV)6hH?hG)(~Z-Mondp6bLJYUqkVhTwL!o-WjNUY*7&rtC$l?K i?c$F{6`K_NW2|HHG6>(f;l|`L@%<)=TX7gi?fBmUpK1gE literal 0 HcmV?d00001 diff --git a/src/squarelet/__pycache__/tests.cpython-310-pytest-8.3.4.pyc b/src/squarelet/__pycache__/tests.cpython-310-pytest-8.3.4.pyc new file mode 100644 index 0000000000000000000000000000000000000000..33b63c6ab2453b77f5fd5c42eb29e12656074d2a GIT binary patch literal 3220 zcmb_eOOqTq5iZrcA2VaGjj_Ri@Zt@Mg>H{$#t&k>tiul?I1I3}#6n*x$}Nq%daA41 zl6uC|R7VilCnA6g$365M_sY-Fl?(6_9Kj<~>K^wDm=oPmsZ^>|N~OO1Qq|g8(}Ca4 z-+%f1a^yIF!OrT>gU%=LNCkp9J%sw-C)ssj{-qJ389?dHRdJC!gvTC_j6+xA*x^KYcv?V4&1k z{;=E4#(C%H=%~Z0{$zwM7S)7xD)Aggy0G2&StfZp5xI^hl8Z7MaUG8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R$_}4Tv11(V@rz0)s$r_TgAq$)y{3(u|U}t z-@)ba>a|i7uGz9@tMZu(AR>Q(kT!|QZ(Q+Xuq2msl&0`vn!>ekQ4$T*^|jQpa>phV z6gJ4wBathv8>c2rBV)6hH?hG)(~Z-Mondp6bLJYUqkVhTwL!o-WjNUY*7&rtC$l?K i?c$F{6`K_NW2|HHG6>(f;l|`L@%<)=TX7gi?fBmUpK1gE literal 0 HcmV?d00001 diff --git a/src/squarelet/__pycache__/tests.cpython-311-pytest-8.3.4.pyc b/src/squarelet/__pycache__/tests.cpython-311-pytest-8.3.4.pyc new file mode 100644 index 0000000000000000000000000000000000000000..66823abb569123e1f3d3ac82013cd337f7a1e380 GIT binary patch literal 6243 zcmeHL>u(!b6~8kc+vAMmyt;kR2h(o1t+&)p+N3X$6;<1<01;rburwcbH1$jxySB%@ zcic3=mLgQ46{-ZRDvHn|MIe0$r7n0XHt^LNzbHtjyj{lJ5kNl`eyoS+Kg7q&SWKGtCjwsa!a{I?t$`9N zmApk}2CNj&K`RY($Wnn0TkABlMuCFAE$JRuJP57YuU1;_DJ{7$GeNQvEz*+ypxlGLJ;46)1mlxj zJo^z?U)?@eEP$J2oM&bjI7_rCqkg~da2 zuG?T|i$$|hF3iu*7c8gLtl`j9ou*ZA=vB-q!Z52>OlBKRTK3c?vuWL|*`C@k8Jl;g zl~+93VP4v<-zZb3?j^3;F2w=O%U+sYH?V}K0TUEpIF7ph;zV)Iso6zVwCo$j-Z?HZ zS}KM!UUYFW6dDWOV5l=nd>-jA)RuvVeFMl6`B#bz4Bf8$wEmO&FE6j<4tH{gmo9xa zyzS1LcMBgDmiMj=7dyknrEh+weQAB@%=*yI^`Si*X(gL_LV!F&vO$z&>M7JlO5wDE zfD^+Pi462EX^{$=@YI$psV%ppmfV!uiB^LB-VLXVkV?34EV-4Kh0TJNv+_L!rWGEM zEG0Vil~5nwI5!B}7ONXanx__tFC`kcOKoLWm!RcnZ@ZQ~OM45eo+WH0KT0e@9c{%* zS?Q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zQh%uG%dg!}uc@OQb#zr7-AFCSV!@4FNzx5we8lgHxeylcH-hDU5s+qwSB2$D-oONLZn0 zA87OsxuRabvY?OAQc?St@_x9OO#D$fC#648B%rZy5gwTT2~+t6Z&kJq9C9ywKb0?maWpC%7lQDQ@2zsFj z#Za?+Dbxv*h{CU#R~qtyfkL8+uqUFLu(BR|5c%mPKjNhg0|v`5;G)t$ee((Qb{PWN z7eqLPGc-i#d0KXDFB7UTh;p4+1AK{KnDsK@RU+{&f zC+cIuyT&K=h5FT+V>PSxTlD*23A0DoUw{C(m!x%aV3izrjFE1OUuKE_)=B>o|82;U zbOccQD-e~)>aBenvMRyVCXgoyA`b?N?Fs4R1_?=4k?>3sp}C|qu|YyIn3BG-K{gZq G!T$z;z>ePl literal 0 HcmV?d00001 diff --git a/src/squarelet/tests.py b/src/squarelet/tests.py new file mode 100644 index 0000000..ef46615 --- /dev/null +++ b/src/squarelet/tests.py @@ -0,0 +1,51 @@ +""" Tests for python-squarelet """ + +import os +import pytest +from squarelet import (CredentialsFailedError, DoesNotExistError, + SquareletClient) + +#pylint:disable=redefined-outer-name +@pytest.fixture +def squarelet_client(): + """Fixture to mock a SquareletClient instance.""" + sq_user = os.environ.get("SQ_USER") + sq_password = os.environ.get("SQ_PASSWORD") + return SquareletClient( + base_uri="https://api.www.documentcloud.org/api/", + username=sq_user, + password=sq_password, + ) + + +def test_get_tokens(squarelet_client): + """Test token retrieval via username and password.""" + assert squarelet_client.access_token is not None + assert squarelet_client.refresh_token is not None + + +def test_get_tokens_invalid_credentials(squarelet_client): + """ Try to authenticate with fake credentials """ + # pylint:disable = protected-access + with pytest.raises(CredentialsFailedError): + squarelet_client._get_tokens("invalid_user", "invalid_pass") + + +def test_raises_for_status(squarelet_client): + """ Assert that other errors are raised """ + with pytest.raises(DoesNotExistError) as excinfo: + # This should raise the DoesNotExistError since the status code will be 404 + squarelet_client.request("get", "blank") + assert excinfo.value.response.status_code == 404 + + +def test_access_documentcloud(squarelet_client): + """ Test that we can access the DocumentCloud endpoint """ + sq_user = os.environ.get("SQ_USER") + my_user = squarelet_client.request("get", "users/me/") + user_data = my_user.json() + # We assert here that the username returned by DocumentCloud is our current username + assert user_data["username"] == sq_user + +## TO DO def test_access_muckrock(): +## TO DO def test_rate_limit(squarelet_client): diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..f60e7ee --- /dev/null +++ b/tox.ini @@ -0,0 +1,12 @@ +[tox] +envlist = py37,py38,py39,py310,py311,py312 + +[testenv] +deps = + pytest + requests-mock + ratelimit +commands = + pytest src/squarelet/tests.py --maxfail=5 + +passenv = SQ_USER, SQ_PASSWORD \ No newline at end of file