<s> from __future__ import absolute_import <EOL> import mock <EOL> import time <EOL> import socket <EOL> import gevent . monkey <EOL> from raven . utils . testutils import TestCase <EOL> from raven . base import Client <EOL> from raven . transport . gevent import GeventedHTTPTransport <EOL> class GeventTransportTest ( TestCase ) : <EOL> def setUp ( self ) : <EOL> gevent . monkey . patch_socket ( ) <EOL> self . addCleanup ( reload , socket ) <EOL> gevent . monkey . patch_time ( ) <EOL> self . addCleanup ( reload , time ) <EOL> self . client = Client ( <EOL> dsn = "<STR_LIT>" , <EOL> ) <EOL> @ mock . patch . object ( GeventedHTTPTransport , '<STR_LIT>' ) <EOL> @ mock . patch ( '<STR_LIT>' ) <EOL> def test_does_send ( self , send , done ) : <EOL> self . client . captureMessage ( message = '<STR_LIT:foo>' ) <EOL> time . sleep ( <NUM_LIT:0> ) <EOL> self . assertEqual ( send . call_count , <NUM_LIT:1> ) <EOL> time . sleep ( <NUM_LIT:0> ) <EOL> self . assertEquals ( done . call_count , <NUM_LIT:1> ) </s>
