Exemplo n.º 1
0
    def setUp(self):
        self.geoip = GeoIP()
        self.geoip.enabled = True

        self.mock_open_database = mock.patch('maxminddb.open_database').start()
        self.mock_download_db = mock.patch(__name__ + '.GeoIP._download_db',
                                           asynctest.CoroutineMock()).start()
Exemplo n.º 2
0
    def setUp(self):
        self.geoip = GeoIP()
        self.geoip.enabled = True

        self.mock_maxminddb = mock.patch.object(self.geoip, '_db').start()
        self.mock_download_db = mock.patch(__name__ + '.GeoIP._download_db',
                                           asynctest.CoroutineMock()).start()
        self.mock_load = mock.patch(__name__ + '.GeoIP.load',
                                    asynctest.CoroutineMock()).start()
Exemplo n.º 3
0
    def setUp(self):
        self.geoip = GeoIP()

        self.mock_response = asynctest.MagicMock()
        self.mock_response.content.read = asynctest.CoroutineMock()
        self.mock_get = asynctest.patch('aiohttp.ClientSession.get').start()
        self.mock_get.return_value.__aenter__.return_value = self.mock_response

        self.mock_exists = mock.patch('os.path.exists').start()
        self.mock_getmtime = mock.patch('os.path.getmtime').start()
        self.mock_time = mock.patch('time.time').start()

        self.mock_maybe_replace_db = mock.patch(
            __name__ + '.GeoIP._maybe_replace_db').start()
Exemplo n.º 4
0
 def setUp(self):
     self.geoip = GeoIP()
Exemplo n.º 5
0
 def setUp(self):
     self.geoip = GeoIP()
     self.mock_time = mock.patch('time.time').start()
Exemplo n.º 6
0
    def setUp(self):
        class GeoIP(GeoIPBase):
            pass

        self.geoip = GeoIP()