Best Python code snippet using tempest_python
test_oauth.py
Source:test_oauth.py
...45 response = self.client.get(self.two_legged_api_path)46 self.assertEqual(response.status_code, 401)47 def test_get_request_token(self):48 self.get_request_token()49 def authorize_request_token(self, request_token_key):50 return super(OAuthTest,51 self).authorize_request_token(request_token_key,52 'testoauth', 'testoauth')53 def test_authorize_request_token_without_callback(self):54 request_token = self.get_request_token('oob')55 response = self.authorize_request_token(request_token.key)56 self.assertEquals(response.status_code, 200)57 def test_authorize_request_token_with_callback(self):58 request_token = self.get_request_token(CALLBACK_URL)59 response = self.authorize_request_token(request_token.key)60 self.assertEquals(response.status_code, 302)61 self.assert_(response['Location'].startswith(CALLBACK_URL))62 def test_get_access_token(self):63 self.get_access_token(CALLBACK_URL)64 def test_two_legged_api(self):65 request = Request.from_consumer_and_token(self.consumer, None, 'GET',66 self.two_legged_api_url,67 {'msg': 'expected response'})68 request.sign_request(self.signature_method, self.consumer, None)69 response = self.client.get(self.two_legged_api_path, request)70 self.assertEquals(response.status_code, 200)71 self.assertIn('world', response.content)72 def test_three_legged_api(self):73 consumer = OAConsumer(self.consumer.key, self.consumer.secret)...
urls.py
Source:urls.py
1# encoding: utf-82# Copyright 2011 Tree.io Limited3# This file is part of Treeio.4# License www.tree.io/license5from django.conf.urls.defaults import patterns, url6urlpatterns = patterns('treeio.core.api.auth.views',7 url(r'^get_request_token$', 'get_request_token',8 name="api_get_request_token"),9 url(r'^authorize_request_token$', 'authorize_request_token',10 name="api_authorize_request_token"),11 url(r'^get_access_token$', 'get_access_token',12 name="api_get_access_token"),...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!