本文整理匯總了Python中sentry.utils.MockDjangoRequest類的典型用法代碼示例。如果您正苦於以下問題:Python MockDjangoRequest類的具體用法?Python MockDjangoRequest怎麽用?Python MockDjangoRequest使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了MockDjangoRequest類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: request
def request(self):
data = self.data
if 'META' in data:
kwargs = {
'META': data.get('META'),
'GET': data.get('GET'),
'POST': data.get('POST'),
'FILES': data.get('FILES'),
'COOKIES': data.get('COOKIES'),
'url': data.get('url'),
}
elif 'sentry.interfaces.Http' in data:
http = data['sentry.interfaces.Http']
kwargs = {
'META': http
}
else:
return MockDjangoRequest()
fake_request = MockDjangoRequest(**kwargs)
if kwargs['url']:
fake_request.path_info = '/' + kwargs['url'].split('/', 3)[-1]
else:
fake_request.path_info = ''
fake_request.path = fake_request.path_info
return fake_request
示例2: request
def request(self):
fake_request = MockDjangoRequest(
META=self.data.get("META") or {},
GET=self.data.get("GET") or {},
POST=self.data.get("POST") or {},
FILES=self.data.get("FILES") or {},
COOKIES=self.data.get("COOKIES") or {},
url=self.url,
)
if self.url:
fake_request.path_info = "/" + self.url.split("/", 3)[-1]
else:
fake_request.path_info = ""
fake_request.path = fake_request.path_info
return fake_request
示例3: request
def request(self):
fake_request = MockDjangoRequest(
META = self.data.get('META') or {},
GET = self.data.get('GET') or {},
POST = self.data.get('POST') or {},
FILES = self.data.get('FILES') or {},
COOKIES = self.data.get('COOKIES') or {},
url = self.url,
)
if self.url:
fake_request.path_info = '/' + self.url.split('/', 3)[-1]
else:
fake_request.path_info = ''
fake_request.path = fake_request.path_info
return fake_request