Re: [Python] Mockare aiohttp per tests

2015-08-07 Per discussione enrico franchi
2015-08-07 18:21 GMT+01:00 Manlio Perillo : > Se hai un client HTTP e devi testare che la richiesta che fa รจ corretta, > non vedo modo migliore di usare un server HTTP > e verificare quello che viene ricevuto. > > Fare il mocking la vedo come ultima risorsa. > Sono due cose diverse. -- . ..: -

Re: [Python] Mockare aiohttp per tests

2015-08-07 Per discussione Manlio Perillo
2015-08-07 18:41 GMT+02:00 flandero : > La cosa bella e' che lavorando con asyncio non avrei neanche bisogno di > multiprocessing e queues, > Puoi anche lanciare il server HTTP all'interno dello stesso processo usando un thread o asyncio ma hai comunque bisogno di un canale di comunicazione. Come

Re: [Python] Mockare aiohttp per tests

2015-08-07 Per discussione flandero
La cosa bella e' che lavorando con asyncio non avrei neanche bisogno di multiprocessing e queues, ma cosi' non si sconfina dal contesto test di unita' a quello dei test di interoperabilita'? On Aug 7, 2015 5:42 PM, "Manlio Perillo" wrote: > 2015-08-07 16:50 GMT+02:00 flandero : > >> Ciao, >> sto

Re: [Python] Mockare aiohttp per tests

2015-08-07 Per discussione Manlio Perillo
2015-08-07 16:50 GMT+02:00 flandero : > Ciao, > sto usando una library per mockare su requests, chiamata httpretty. Un > codice tipo questo: > > import httpretty > import requests > @httpretty.httprettified > def prova(): > httpretty.register_uri(method=httpretty.POST,uri='http://url/',body='cia

[Python] Mockare aiohttp per tests

2015-08-07 Per discussione flandero
Ciao, sto usando una library per mockare su requests, chiamata httpretty. Un codice tipo questo: import httpretty import requests @httpretty.httprettified def prova(): httpretty.register_uri(method=httpretty.POST,uri='http://url/',body='ciao ciao') requests.post('http://url/', data={'a': 1})