Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'redirect_state=' + start_query['redirect_state']
else:
location_url = target_url
location_query = parse_qs(urlparse(location_url).query)
HTTPretty.register_uri(HTTPretty.GET, start_url, status=301,
location=location_url)
HTTPretty.register_uri(HTTPretty.GET, location_url, status=200,
body='foobar')
response = requests.get(start_url)
expect(response.url).to.equal(location_url)
expect(response.text).to.equal('foobar')
method = self.backend.ACCESS_TOKEN_METHOD == 'GET' and HTTPretty.GET \
or HTTPretty.POST
HTTPretty.register_uri(method,
uri=self.backend.ACCESS_TOKEN_URL,
status=200,
body=self.access_token_body or '',
content_type=self.user_data_content_type)
if self.user_data_url:
HTTPretty.register_uri(HTTPretty.GET, self.user_data_url,
body=self.user_data_body or '',
content_type=self.user_data_content_type)
self.strategy.set_request_data(location_query)
def test_start_works(self):
url = '{0}/restore/action-requested'.format(self.connection.host)
HTTPretty.register_uri(HTTPretty.POST, url)
self.cmd.start()
def setUp(self):
HTTPretty.register_uri(
HTTPretty.POST, FAKE_EXCHANGE_URL,
body=LIST_EVENTS_RESPONSE.encode('utf-8'),
content_type='text/xml; charset=utf-8'
)
self.event_list = self.service.calendar().list_events(
start=TEST_EVENT_LIST_START,
end=TEST_EVENT_LIST_END
)
def test_move(self):
HTTPretty.register_uri(
HTTPretty.POST,
FAKE_EXCHANGE_URL,
body=MOVE_FOLDER_RESPONSE.encode('utf-8'),
content_type='text/xml; charset=utf-8'
)
self.folder.move_to('AABBCCDDEEFFGG==')
assert self.folder.parent_id == 'AABBCCDDEEFFGG=='
def pipeline_handlers(self, url):
HTTPretty.register_uri(HTTPretty.GET, url, status=200, body='foobar')
HTTPretty.register_uri(HTTPretty.POST, url, status=200)
def _mock_auth(status):
reply = mock_auth.authenticate()
HTTPretty.register_uri(HTTPretty.POST, IDENTITY_TOKEN_URL,
status=status, body=json.dumps(reply))
def test_move(self):
HTTPretty.register_uri(
HTTPretty.POST,
FAKE_EXCHANGE_URL,
body=MOVE_EVENT_RESPONSE.encode('utf-8'),
content_type='text/xml; charset=utf-8'
)
self.event.move_to('AAAhKSe7AAA=')
assert self.event.calendar_id == 'AAAhKSe7AAA='
assert self.event.id == TEST_EVENT_MOVED.id
def test_can_set_display_name(self):
HTTPretty.register_uri(
HTTPretty.POST,
FAKE_EXCHANGE_URL,
body=CREATE_FOLDER_RESPONSE.encode('utf-8'),
content_type='text/xml; charset=utf-8',
)
self.folder.display_name = TEST_FOLDER.display_name
self.folder.parent_id = TEST_FOLDER.parent_id
self.folder.create()
assert TEST_FOLDER.display_name in HTTPretty.last_request.body.decode('utf-8')
def test_can_set_subject(self):
HTTPretty.register_uri(HTTPretty.POST, FAKE_EXCHANGE_URL,
responses=[
self.get_change_key_response,
self.update_event_response,
])
self.event.subject = TEST_EVENT_UPDATED.subject
self.event.update()
assert TEST_EVENT_UPDATED.subject in HTTPretty.last_request.body.decode('utf-8')
def setUp(self):
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)