Exemplo n.º 1
0
    def test_that_start_calls_setup_smtp_gateway(self, gateway_mock):
        smtp = LeapSmtp(self.provider, self.keymanager, self.srp_session)
        port = 500
        smtp.TWISTED_PORT = port
        gateway_mock.return_value = (None, None)
        with HTTMock(ca_cert_mock, not_found_mock):
            smtp.start()

        cert_path = self._client_cert_path()
        gateway_mock.assert_called_with(keymanager=self.keymanager, smtp_cert=cert_path, smtp_key=cert_path, userid='*****@*****.**', smtp_port='1234', encrypted_only=False, smtp_host='smtp.some-sever.test', port=port)
Exemplo n.º 2
0
    def test_that_running_smtp_sevice_is_stopped(self, gateway_mock):
        smtp = LeapSmtp(self.provider, self.keymanager, self.srp_session)

        smtp_service = MagicMock()
        smtp_port = MagicMock()
        gateway_mock.return_value = (smtp_service, smtp_port)

        with HTTMock(ca_cert_mock, not_found_mock):
            smtp.start()
            smtp.stop()

        smtp_port.stopListening.assert_called_with()
        smtp_service.doStop.assert_called_with()
Exemplo n.º 3
0
    def test_that_running_smtp_sevice_is_stopped(self, gateway_mock):
        smtp = LeapSmtp(self.provider, self.keymanager, self.srp_session)

        smtp_service = MagicMock()
        smtp_port = MagicMock()
        gateway_mock.return_value = (smtp_service, smtp_port)

        with HTTMock(ca_cert_mock, not_found_mock):
            smtp.start()
            smtp.stop()

        smtp_port.stopListening.assert_called_with()
        smtp_service.doStop.assert_called_with()
Exemplo n.º 4
0
    def test_that_start_calls_setup_smtp_gateway(self, gateway_mock):
        smtp = LeapSmtp(self.provider, self.keymanager, self.srp_session)
        port = 500
        smtp.TWISTED_PORT = port
        gateway_mock.return_value = (None, None)
        with HTTMock(ca_cert_mock, not_found_mock):
            smtp.start()

        cert_path = self._client_cert_path()
        gateway_mock.assert_called_with(keymanager=self.keymanager,
                                        smtp_cert=cert_path,
                                        smtp_key=cert_path,
                                        userid='*****@*****.**',
                                        smtp_port='1234',
                                        encrypted_only=False,
                                        smtp_host='smtp.some-sever.test',
                                        port=port)
Exemplo n.º 5
0
 def _create_smtp_server(self):
     server = LeapSmtp(self.leap_session.provider, self.leap_session.nicknym.keymanager, self.leap_session.srp_session)
     server.start()
     return server