From d88f6aeee3acbf520bd5b4579428e7efa22ca036 Mon Sep 17 00:00:00 2001 From: Tobias Gruetzmacher Date: Fri, 13 Oct 2017 00:34:37 +0200 Subject: [PATCH] Replace online tests with mocks. We want to test our code, not the comic modules. --- dosagelib/plugins/x.py | 2 +- tests/httpmocks.py | 52 ++++++++++++++++++++++++++++++ tests/responses/bf-405.html.gz | Bin 0 -> 11010 bytes tests/responses/bf-home.html.gz | Bin 0 -> 10968 bytes tests/responses/empty.png | Bin 0 -> 67 bytes tests/responses/xkcd-1898.html.gz | Bin 0 -> 3042 bytes tests/responses/xkcd-1899.html.gz | Bin 0 -> 3078 bytes tests/responses/xkcd-302.html.gz | Bin 0 -> 3243 bytes tests/responses/xkcd-303.html.gz | Bin 0 -> 3247 bytes tests/test_dosage.py | 19 ++++++++--- tests/test_vote.py | 7 +++- 11 files changed, 74 insertions(+), 6 deletions(-) create mode 100644 tests/httpmocks.py create mode 100644 tests/responses/bf-405.html.gz create mode 100644 tests/responses/bf-home.html.gz create mode 100644 tests/responses/empty.png create mode 100644 tests/responses/xkcd-1898.html.gz create mode 100644 tests/responses/xkcd-1899.html.gz create mode 100644 tests/responses/xkcd-302.html.gz create mode 100644 tests/responses/xkcd-303.html.gz diff --git a/dosagelib/plugins/x.py b/dosagelib/plugins/x.py index 4e8faf22d..df46e30d5 100644 --- a/dosagelib/plugins/x.py +++ b/dosagelib/plugins/x.py @@ -11,7 +11,7 @@ from ..helpers import bounceStarter class Xkcd(_ParserScraper): name = 'xkcd' - url = 'http://xkcd.com/' + url = 'https://xkcd.com/' starter = bounceStarter stripUrl = url + '%s/' firstStripUrl = stripUrl % '1' diff --git a/tests/httpmocks.py b/tests/httpmocks.py new file mode 100644 index 000000000..e91c82a03 --- /dev/null +++ b/tests/httpmocks.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2017 Tobias Gruetzmacher + +from __future__ import absolute_import, division, print_function + +import gzip +import os.path +import re + +try: + from functools import lru_cache +except ImportError: + from backports.functools_lru_cache import lru_cache + +from responses import add, GET, POST + + +_basedir = os.path.dirname(__file__) + + +def _file(name): + return os.path.join(_basedir, 'responses', name) + + +@lru_cache() +def _content(name): + with gzip.open(_file(name + '.html.gz'), 'r') as f: + return f.read() + + +@lru_cache() +def _img(): + with open(_file('empty.png'), 'rb') as f: + return f.read() + + +def xkcd(): + add(GET, 'https://xkcd.com/', _content('xkcd-1899')) + for page in (302, 303, 1898, 1899): + add(GET, 'https://xkcd.com/%i/' % page, _content('xkcd-%i' % page)) + add(GET, re.compile(r'https://imgs\.xkcd\.com/.*\.png'), _img(), content_type='image/png') + + +def bloomingfaeries(): + add(GET, 'http://www.bloomingfaeries.com/', _content('bf-home')) + add(GET, 'http://www.bloomingfaeries.com/comic/public/bloomin-faeries-405/', _content('bf-405')) + + add(GET, re.compile(r'http://www\.bloomingfaeries\.com/.*\.jpg'), _img(), content_type='image/jpeg') + + +def vote(): + add(POST, 'http://gaecounter.appspot.com/count/', 'no') diff --git a/tests/responses/bf-405.html.gz b/tests/responses/bf-405.html.gz new file mode 100644 index 0000000000000000000000000000000000000000..b7e928b760b0f56365cada341bf938e6bb1bf2d6 GIT binary patch literal 11010 zcmV+dEB(|TiwFSLo!VIf1I#>YQ`^Y0pP_31!=Th+d!vUR5QxFfB|si$lRyF4J-0%N z8cQQ-K$f(UjPXhM@3(tKPd~ssa_UlhB57v&F+JTq-96*8yLNE2fA+t}hr~^WUVn8L zALM4}`EgHilO*gK#&|r|#~nS09HaI6^=sn>$0)?3zSC2fuYEmL`UD^uwfd_oyF->x zf}k4vXT-02%6{M{%ulqlNyrpp%CDZ1u$#m{R6E3UX%w@h_x0?Zwyh8Y(RkdyA`$a? zN}NnQ7Q2ik3UMQ5R~Q?3K``XLV^bD!7VBm(G{&KpQZW*j4OwhJD>uW4#j%zF7y_+s z#<4;Y;4EcGd=Ht$DG)Xz#{3z6LVzAn^J+Y*E^n1q0QI%Fss;OiLqDhXyo z-w-2r6P|di|5oB$f3e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G*KL^2lX&Rx&P z`>N@nuF#CA61xb$Pb>dnnWCVj4Y z)Sq%og(yw@cJM%*k5G9_yBnIv*2bnWGaC9<*PjYR?PFBCy@e@a(!Q!P{435C>E{9{ znA6s|llNxRcD3xiAS^IaK23)?`_|&@qYGtNX!G2}XVIxqCD8w3hjt`EWN*_4$Ff$X zD~0;nS)xHmmM;z@C#+{S;Ppv8gbkE?q||}p_&#}JSpM+AWXbfK9)m3p4!2?1mRwU- zzLc9c{Z=;L*9;%1ER7z4P!#NVW;@nSNLJQl;Jswq&0wU<=Gj`&##*bx7!jUAIcdh7 z=Bmd|WqU=#>*_``qwT6HY3o@rX{lYX(?)~HY9#!ec)X>suj{yMWgX$8SRx>_mOr(e z+gFyVCq5?GdppZ6Dc8A0=9&WhiOWr`>&541dU=0AW~#~^_~C=cn6wWx%)p4y{dE=c zIsLlP9%kxw+;nWo6hIBYw|$VO|2t9rzws_aAS_np(+fOM-U;A?Iojbn_$GOt+9r*5 zvC1@v=l-nW3i*nZJxR+K9B`9`iN}a#V^J_$sD||l{>KN zF7_ihHTi47k^+EFu}|bv>;RnSII$1AhZUY>f2!iJoq9fd9P=R9Uv_(@_kai|Wp{_) zq!{2&%CKgaWEW-9yO>YfiDH2)0-^xN^Xqtm0`@C|Ev z?b))_;TA=Ue`@?azl;M%+mlG~d-L~IQ2vf!atl&_Z_*zf>!KC9R!0w78=20?c1IH) zM9?0j&UiTTVcOuY7~yd>l;xnM3L?37ju=+a?EDl!zW?4~y&^#H zTXfu1$W{#LA2uPujKoFrxW{zxmDwjqcrdZUb|TEkRQVpY-HGey4Sy z+j|)E?QdPw^t2kiB`BNd?1O*tF&o95p8;b;8H)J)8J^EEZY($0f3&b42vcg8j z&yUf*&ni}cv)sEk`bms_<5U6-Jn>Me!{O2xFtfAQY3;!eY)3W}V&TkO@c#jDD`FQr G#Q*?`%r5!> literal 0 HcmV?d00001 diff --git a/tests/responses/empty.png b/tests/responses/empty.png new file mode 100644 index 0000000000000000000000000000000000000000..91a99b94e23a00cc8133f22e3fe2a0b48a015808 GIT binary patch literal 67 zcmeAS@N?(olHy`uVBq!ia0vp^j3CUx1|;Q0k8}blE>9Q7kcv6UAQ@H$MqV!6EkIEQ MPgg&ebxsLQ07X&@0{{R3 literal 0 HcmV?d00001 diff --git a/tests/responses/xkcd-1898.html.gz b/tests/responses/xkcd-1898.html.gz new file mode 100644 index 0000000000000000000000000000000000000000..a26acc5cd2081add65e5be16fc086ccd55ec700b GIT binary patch literal 3042 zcmV<83mx@Z<)=jc;GTlz5 zlL1MHghdiG0a{j@{`dV3NKu#glHGk>KZqo7@ZsQ`gLCugH!t5@y#Mv>D;AqHne3b{ zAA*N?=%A3fnd~sOJ1w)oNR{o%j_#;V)G0c=leYhmA6wrm6(!;<;CL||IK zjf)fcvG{FFKc7E0>)U@291V7F$JOKW=a0X&yLqYOU0y_GDl((ne|GF-GVcF96La>G z8?oCy;bYwm3W1MTi6FvV)$RZ=#dsu4J*dwY?|Jl^rvlR-d%vCVF4v1J829m}i(nj` zq}`ksAbqVu(UqANg*g{fRft_W77+hz@6Kfws(B|=f#s>ws^rn?v|?j&ee8Mj`Mew1 z`h>lFA6s3^@pckHM4V?3d0$l+!eQ_yc;|Ja&dqQ zmFC z|I1pQ7*S*p{*spGc_IT&hUsym(tq5iNh6&z46uH;*X%|VU8498Pz$X$K;KZdK`O!WRs3;iY`;kjVq^J zvO&5;&g2)2u*>PUPp|V69<41p$LG@vw81@ZR(Q_jng+gDQz^GJu-cUg_^QNV&*-tX zz_VxfAe2qfypvIE*2R@_ZAid0rgNUH3Co$B$~0<})boeK{XsX+B4{bWom%qC5*5MN zV?o$sXSC$JmCZsHE(S;!KeMJ4W2w?W)GBz&`WC_>l~>xjmV<>&aQ_cxqLn?hyLMqo7J%;?B{P-^hTkR3m4ZvoR-{v$fL)8+h?E@G zUe9fO7u$vLY^a_*b^6ECWDQxnxcuUdf{{yZ)Ke8-US9fe4sL>Y7#o=i*YITKy4xGShj`wp z1y9&zr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-pMpqkHfLxv?p@Ccdr(#zV_L1iASa1Xnvxfpcj z2LvR3ASUBY6+Y%!aZEjcG0wT>hOSGO>~0ThLd~roMO`8?m#sB|mYuVSZK^G4+5^-` zU=vY3L&l-jLLEYp5k!8a7Du*KvBjFt-Fn5~mzd+K7fH#rX!<*EXq5eiVfM<7+k)q- zOl+;11)*ERi)EAO`Puom*ImzfZvLn{QBP#9G_T4g3p~6S2I13YtC#d{mAIYj>3rwm zExA@x#4MaTZCYTb?9vX=k<;kmeSui0Cg;UYRaXDH;8U0G zm1~q+(%&NuBfBG(a{`HN3-q2N<#QB9{nc+s7Gxj_CgpP0(PLNumBfU-t~G6k3ir? zkYt>_BCA&!8$K@5N@w|TpNR~hhyWwN`Y&zFw&bu+fkewLE`GYK1qMC_x(Q1vFW{FA zHlcoQzc<*u?R)H1DiGxmG41t%`bx%8A*3p#E@zja6tXi3fUBDbFpSCt9I0*smC)@? zvn&#@kEr*xjlNS^qKZO!@?1rA*9wq=iX@=%GX+jG?y(e_vwavDZVk*KP$fIX{u z*ajEmE+(yLnE(tVZFWk*rj&`Gs!$cRX9A^`wtRtJ>UhewsfvXA5uHXPrP*x9W6N5; z5w}IJ&2NwXwRI-X75GKMaGC0+-BwKQ_S*dB?;XHb_KZU|L-peYob4RtP#_lY5!i_5 dwMT>r{ZlX_i`&%i*MAUi{TuY=0K7RK007J|WAOk0 literal 0 HcmV?d00001 diff --git a/tests/responses/xkcd-303.html.gz b/tests/responses/xkcd-303.html.gz new file mode 100644 index 0000000000000000000000000000000000000000..fea0974d4d26560c496dad93bd4396c706982e08 GIT binary patch literal 3247 zcmV;g3{dkQiwFSIl-gMW1MOMea@)8SzOJ7F;Z9?_6-oWrmj9%T<7Bhmb>cL3X1kNg z?0_Uh!X^oZ04-~i%=9tZnf9iS(!N-~15%XaIQDLPTVIGIaPZ;aoP+b{!$;4~jxTG*aaovZFhy6L-oE?_`@F<-7G4O2w%-%6U37 zGSp|mr3lUX`%!ry-<9u2^z-RcyM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xvstogfLTp*YUL4mSJO0GrIjJcpu_9KSbYddbM zldpo4xTpEO&Y(YqDmMy@B* z&HK0HT20`yaO$+_R~@l)J48oLqx<(oNTmXrPv*jU+78^mum~nA@MCik;KkJ))tk z+K4dGDwPp0rJ3386mA#>VRZA+2Ou&L$ttVekGz(lOPDTFKjfh(`le)sKJ}4H3QEIK5j<5uqH&LXiz90hR%8tTgpbOx zZ&CAwU*JPdnh{HM%sPn=kh5wkhT6#Xg=$i;gTm&5f+>cPiCs|fXiFJ9o9PJEPlW5i z*KXeh`+qVdchF!4o~->gi?koi+&uLA-ZpiZ8bb2kM9GefDP>?~?Y>eu4a28Mo-!<8 zr!|J{MuG2Q+_IJlq=6*Obrd@jibN1qsEXP$k)>i7cUg-%gVbz;${d&<(P?;6TeNL@ zY+j!??6%o!^X<{US)K7q1-wWYE>qp~#)|Rn#+cvyF9zu=JLTXFW!;ROz}Sva4h3Qc h8-b2^URy+%P+R|sG;Tw`U;jsU?LVGNNml9|004`bf`R}5 literal 0 HcmV?d00001 diff --git a/tests/test_dosage.py b/tests/test_dosage.py index 88e244ff7..50aff45ee 100644 --- a/tests/test_dosage.py +++ b/tests/test_dosage.py @@ -6,20 +6,25 @@ from __future__ import absolute_import, division, print_function import pytest -import sys +import responses import dosagelib.cmd +import httpmocks + def cmd(*options): """'Fake' run dosage with given options.""" return dosagelib.cmd.main(('--allow-multiple',) + options) + def cmd_ok(*options): assert cmd(*options) == 0 + def cmd_err(*options): assert cmd(*options) == 1 + class TestDosage(object): """Test the dosage commandline client.""" @@ -48,14 +53,20 @@ class TestDosage(object): def test_multiple_comics_match(self): cmd_err('Garfield') + @responses.activate def test_fetch_html_and_rss_json(self, tmpdir): + httpmocks.xkcd() cmd_ok("-n", "2", "-v", "-b", str(tmpdir), "-o", "html", "-o", "rss", - "-o", "json", "xkcd") + "-o", "json", "xkcd") + @responses.activate def test_fetch_html_and_rss_2(self, tmpdir): + httpmocks.bloomingfaeries() cmd_ok("--numstrips", "2", "--baseurl", "bla", "--basepath", - str(tmpdir), "--output", "rss", "--output", "html", "--adult", - "BloomingFaeries") + str(tmpdir), "--output", "rss", "--output", "html", "--adult", + "BloomingFaeries") + @responses.activate def test_fetch_indexed(self, tmpdir): + httpmocks.xkcd() cmd_ok("-n", "2", "-v", "-b", str(tmpdir), "xkcd:303") diff --git a/tests/test_vote.py b/tests/test_vote.py index 8dac29aec..801897db3 100644 --- a/tests/test_vote.py +++ b/tests/test_vote.py @@ -1,11 +1,14 @@ # -*- coding: utf-8 -*- # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam -# Copyright (C) 2015-2016 Tobias Gruetzmacher +# Copyright (C) 2015-2017 Tobias Gruetzmacher from __future__ import absolute_import, division, print_function +import responses + from dosagelib import scraper +import httpmocks class ATestScraper(scraper._BasicScraper): @@ -14,6 +17,8 @@ class ATestScraper(scraper._BasicScraper): class TestVote(object): + @responses.activate def test_vote(self): + httpmocks.vote() answer = ATestScraper('Test_Test').vote() assert answer in ('counted', 'no'), 'invalid answer %r' % answer