Exemplo n.º 1
0
 def _start_web_server(cls):
     mp = get_shared_mailpile()
     session = mp._session
     config = mp._config
     sspec = cls._get_mailpile_sspec()
     cls.http_worker = config.http_worker = HttpWorker(session, sspec)
     config.http_worker.start()
Exemplo n.º 2
0
 def test_lookup_emailkeys(self):
     m = get_shared_mailpile()[0]
     d = EmailKeyLookupHandler(m._session)
     res = d.lookup('*****@*****.**')
     self.assertIsNotNone(res)
     self.assertEqual(len(res), 2)
     self.assertEqual(len(res[0].keys()), len(res[1].keys()))
Exemplo n.º 3
0
 def _start_web_server(cls):
     mp = get_shared_mailpile()
     session = mp._session
     config = mp._config
     sspec = cls._get_mailpile_sspec()
     cls.http_worker = config.http_worker = HttpWorker(session, sspec)
     config.http_worker.start()
Exemplo n.º 4
0
 def __init__(self):
     self.mp = get_shared_mailpile()
     self.mp.set("sys.postinglist_kb=%s" % postinglist_kb)
     self.mp.set("prefs.num_results=50")
     self.mp.set("prefs.default_order=rev-date")
     results = self.mp.search(*query)
     assert_less(float(results.as_dict()["elapsed"]), 0.2)
Exemplo n.º 5
0
 def _start_web_server(cls):
     if not MailpileSeleniumTest.http_worker:
         (mp, session, config, _) = get_shared_mailpile()
         sspec = MailpileSeleniumTest._get_mailpile_sspec()
         MailpileSeleniumTest.http_worker = config.http_worker = HttpWorker(
             session, sspec)
         config.http_worker.start()
Exemplo n.º 6
0
 def __init__(self):
     self.mp = get_shared_mailpile()
     self.mp.set("sys.postinglist_kb=%s" % postinglist_kb)
     self.mp.set("prefs.num_results=50")
     self.mp.set("prefs.default_order=rev-date")
     results = self.mp.search(*query)
     assert_less(float(results.as_dict()["elapsed"]), 0.2)
Exemplo n.º 7
0
 def _start_web_server(cls):
     if not MailpileSeleniumTest.http_worker:
         mp = get_shared_mailpile()
         session = mp._session
         config = mp._config
         sspec = MailpileSeleniumTest._get_mailpile_sspec()
         MailpileSeleniumTest.http_worker = config.http_worker = HttpWorker(session, sspec)
         config.http_worker.start()
Exemplo n.º 8
0
 def __init__(self):
     self.mp = get_shared_mailpile()[0]
     results = self.mp.search(*query)
     try:
         assert_equal(results.result['stats']['count'], expected_count)
         assert_less(float(results.as_dict()["elapsed"]), 0.2)
     except:
         print 'BAD RESULT:\n%s' % results.as_text()
         raise
Exemplo n.º 9
0
 def __init__(self):
     self.mp = get_shared_mailpile()[0]
     results = self.mp.search(*query)
     try:
         assert_equal(results.result['stats']['count'], expected_count)
         assert_less(float(results.as_dict()["elapsed"]), 0.2)
     except:
         print 'BAD RESULT:\n%s' % results.as_text()
         raise
Exemplo n.º 10
0
 def _start_web_server(cls):
     if not MailpileSeleniumTest.http_worker:
         mp = get_shared_mailpile()
         session = mp._session
         config = mp._config
         sspec = MailpileSeleniumTest._get_mailpile_sspec()
         MailpileSeleniumTest.http_worker = config.http_worker = HttpWorker(
             session, sspec)
         config.http_worker.start()
Exemplo n.º 11
0
    def test_lookup(self):
        with patch('DNS.Request') as dns_mock, patch('mailpile.crypto.gpgi.GnuPG.search_key') as gpg_mock:
            gpg_mock.return_value = GPG_MOCK_RETURN
            dns_mock.return_value.req.return_value.answers = DNSPKA_MOCK_RETURN

            m = get_shared_mailpile()[0]
            res = lookup_crypto_keys(m._session, '*****@*****.**')

        self.assertIsNotNone(res)
        self.assertEqual(type(res), list)
        for r in res:
            self.assertEqual(type(r), dict)
Exemplo n.º 12
0
 def _start_web_server(cls):
     if not MailpileSeleniumTest.http_worker:
         (mp, session, config, _) = get_shared_mailpile()
         sspec = MailpileSeleniumTest._get_mailpile_sspec()
         MailpileSeleniumTest.http_worker = config.http_worker = HttpWorker(session, sspec)
         config.http_worker.start()
Exemplo n.º 13
0
 def _get_mailpile_sspec(cls):
     (_, _, config, _) = get_shared_mailpile()
     return (config.sys.http_host, config.sys.http_port)
Exemplo n.º 14
0
 def test_lookup_emailkeys(self):
     m = get_shared_mailpile()[0]
     d = EmailKeyLookupHandler(m._session, {})
     res = d.lookup('*****@*****.**')
     self.assertIsNotNone(res)
Exemplo n.º 15
0
 def _get_mailpile_sspec(cls):
     config = get_shared_mailpile()._config
     return (config.sys.http_host, config.sys.http_port)
Exemplo n.º 16
0
 def _stop_web_server(cls):
     mp = get_shared_mailpile()
     mp._config.http_worker = None
     cls.http_worker.quit()
     cls.http_worker = None
Exemplo n.º 17
0
 def __init__(self):
     self.mp = get_shared_mailpile()[0]
     results = self.mp.search(*query)
     assert_equal(results.result['stats']['count'], expected_count)
     assert_less(float(results.as_dict()["elapsed"]), 0.2)
Exemplo n.º 18
0
 def _stop_web_server(cls):
     if MailpileSeleniumTest.http_worker:
         (mp, _, config, _) = get_shared_mailpile()
         mp._config.http_worker = None
         MailpileSeleniumTest.http_worker.quit()
         MailpileSeleniumTest.http_worker = MailpileSeleniumTest.http_worker = None
Exemplo n.º 19
0
 def _get_mailpile_sspec(cls):
     (_, _, config, _) = get_shared_mailpile()
     return (config.sys.http_host, config.sys.http_port)
Exemplo n.º 20
0
 def __init__(self):
     self.mp = get_shared_mailpile()
     results = self.mp.search(*query)
     assert_equal(results.result['stats']['count'], expected_count)
     assert_less(float(results.as_dict()["elapsed"]), 0.2)
Exemplo n.º 21
0
 def _get_mailpile_sspec(cls):
     config = get_shared_mailpile()._config
     return (config.sys.http_host, config.sys.http_port)
Exemplo n.º 22
0
 def _stop_web_server(cls):
     mp = get_shared_mailpile()
     mp._config.http_worker = None
     cls.http_worker.quit()
     cls.http_worker = None
Exemplo n.º 23
0
 def _stop_web_server(cls):
     if MailpileSeleniumTest.http_worker:
         mp = get_shared_mailpile()
         mp._config.http_worker = None
         MailpileSeleniumTest.http_worker.quit()
         MailpileSeleniumTest.http_worker = MailpileSeleniumTest.http_worker = None
Exemplo n.º 24
0
 def test_lookup_emailkeys(self):
     m = get_shared_mailpile()[0]
     d = EmailKeyLookupHandler(m._session, {})
     res = d.lookup('*****@*****.**')
     self.assertIsNotNone(res)