示例#1
0
    def setUpAll(cls):

        cls.calendar = Exchange2010Service(
            connection=ExchangeNTLMAuthConnection(
                url=FAKE_EXCHANGE_URL,
                username=FAKE_EXCHANGE_USERNAME,
                password=FAKE_EXCHANGE_PASSWORD)).calendar()
 def setUpClass(cls):
     cls.service = Exchange2010Service(
         connection=ExchangeNTLMAuthConnection(
             url=FAKE_EXCHANGE_URL,
             username=FAKE_EXCHANGE_USERNAME,
             password=FAKE_EXCHANGE_PASSWORD,
         ))
示例#3
0
    def fake_event_request():

      service = Exchange2010Service(connection=ExchangeNTLMAuthConnection(url=FAKE_EXCHANGE_URL, username=FAKE_EXCHANGE_USERNAME, password=FAKE_EXCHANGE_PASSWORD))

      httpretty.register_uri(httpretty.POST, FAKE_EXCHANGE_URL,
                                 body=GET_ITEM_RESPONSE.encode('utf-8'),
                                 content_type='text/xml; charset=utf-8')

      return service.calendar().get_event(id=TEST_EVENT.id)
    def setUp(self):
        self.calendar = Exchange2010Service(
            connection=ExchangeNTLMAuthConnection(**config)).calendar()

        HTTPretty.register_uri(HTTPretty.POST,
                               FAKE_EXCHANGE_URL,
                               body=GET_ITEM_RESPONSE.encode('utf-8'),
                               content_type='text/xml; charset=utf-8')

        self.event = self.calendar.get_event(id=TEST_EVENT_ATTACHED.id)
        self.event._change_key = TEST_EVENT_ATTACHED.change_key
示例#5
0
def test_session_is_cached():

  manager = MagicMock()

  httpretty.register_uri(httpretty.POST, FAKE_EXCHANGE_URL,
                           status=200,
                           body="", )

  with patch('requests.Session') as MockSession:

    manager.attach_mock(MockSession, 'MockSession')

    connection = ExchangeNTLMAuthConnection(url=FAKE_EXCHANGE_URL,
                                                username=FAKE_EXCHANGE_USERNAME,
                                                password=FAKE_EXCHANGE_PASSWORD)

    connection.send("test")
    connection.send("test again")

    # assert we only get called once, after that it's cached
    manager.MockSession.assert_called_once_with()
示例#6
0
def test_session_is_cached():

    manager = MagicMock()

    httpretty.register_uri(
        httpretty.POST,
        FAKE_EXCHANGE_URL,
        status=200,
        body="",
    )

    with patch('requests.Session') as MockSession:

        manager.attach_mock(MockSession, 'MockSession')

        connection = ExchangeNTLMAuthConnection(
            url=FAKE_EXCHANGE_URL,
            username=FAKE_EXCHANGE_USERNAME,
            password=FAKE_EXCHANGE_PASSWORD)

        connection.send("test")
        connection.send("test again")

        # assert we only get called once, after that it's cached
        manager.MockSession.assert_called_once_with()
示例#7
0
    def setUp(self):
        httpretty.enable()
        self.service = Exchange2010Service(
            connection=ExchangeNTLMAuthConnection(**config))

        HTTPretty.register_uri(HTTPretty.POST,
                               FAKE_EXCHANGE_URL,
                               body=GET_ATTACHMENT_RESPONSE.encode('utf-8'),
                               content_type='text/xml; charset=utf-8')

        self.attachment = Exchange2010Attachment(self.service,
                                                 ATTACHMENT_DETAILS.id,
                                                 load=True)
示例#8
0
 def setUpClass(self):
     self.service = Exchange2010Service(
         connection=ExchangeNTLMAuthConnection(
             url=FAKE_EXCHANGE_URL,
             username=FAKE_EXCHANGE_USERNAME,
             password=FAKE_EXCHANGE_PASSWORD))
     HTTPretty.register_uri(
         HTTPretty.POST,
         FAKE_EXCHANGE_URL,
         body=GET_ITEM_RESPONSE.encode('utf-8'),
         content_type='text/xml; charset=utf-8',
     )
     self.event = self.service.calendar().get_event(id=TEST_EVENT.id)
 def setUpClass(cls):
     cls.service = Exchange2010Service(
         connection=ExchangeNTLMAuthConnection(
             url=FAKE_EXCHANGE_URL,
             username=FAKE_EXCHANGE_USERNAME,
             password=FAKE_EXCHANGE_PASSWORD))
     cls.get_change_key_response = HTTPretty.Response(
         body=GET_ITEM_RESPONSE_ID_ONLY.encode('utf-8'),
         status=200,
         content_type='text/xml; charset=utf-8')
     cls.update_event_response = HTTPretty.Response(
         body=UPDATE_ITEM_RESPONSE.encode('utf-8'),
         status=200,
         content_type='text/xml; charset=utf-8')
示例#10
0
        def fake_folder_request():

            service = Exchange2010Service(
                connection=ExchangeNTLMAuthConnection(
                    url=FAKE_EXCHANGE_URL,
                    username=FAKE_EXCHANGE_USERNAME,
                    password=FAKE_EXCHANGE_PASSWORD,
                ))

            httpretty.register_uri(
                httpretty.POST,
                FAKE_EXCHANGE_URL,
                body=GET_FOLDER_RESPONSE.encode('utf-8'),
                content_type='text/xml; charset=utf-8',
            )

            return service.folder().get_folder(id=TEST_FOLDER.id)
示例#11
0
  def setUpClass(cls):
    cls.service = Exchange2010Service(
      connection=ExchangeNTLMAuthConnection(
        url=FAKE_EXCHANGE_URL,
        username=FAKE_EXCHANGE_USERNAME,
        password=FAKE_EXCHANGE_PASSWORD,
      )
    )

    cls.get_change_key_response = httpretty.Response(
      body=GET_FOLDER_RESPONSE.encode('utf-8'),
      status=200,
      content_type='text/xml; charset=utf-8'
    )
    cls.delete_folder_response = httpretty.Response(
      body=DELETE_FOLDER_RESPONSE.encode('utf-8'),
      status=200,
      content_type='text/xml; charset=utf-8'
    )
示例#12
0
    def setUpAll(cls):

        cls.connection = ExchangeNTLMAuthConnection(
            url=FAKE_EXCHANGE_URL,
            username=FAKE_EXCHANGE_USERNAME,
            password=FAKE_EXCHANGE_PASSWORD)
示例#13
0
 def setUpClass(cls):
     cls.service = Exchange2010Service(
         connection=ExchangeNTLMAuthConnection(**config))
示例#14
0
 def setUp(self):
     self.calendar = Exchange2010Service(
         connection=ExchangeNTLMAuthConnection(**config)).calendar()