mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Add Black and Flake8
This commit is contained in:
parent
5b9d82f1ca
commit
7c51b1a7d7
124 changed files with 5841 additions and 3772 deletions
|
|
@ -2,7 +2,7 @@ import aresponses
|
|||
|
||||
from aiogram import Bot
|
||||
|
||||
TOKEN = '123456789:AABBCCDDEEFFaabbccddeeff-1234567890'
|
||||
TOKEN = "123456789:AABBCCDDEEFFaabbccddeeff-1234567890"
|
||||
|
||||
|
||||
class FakeTelegram(aresponses.ResponsesMockServer):
|
||||
|
|
@ -15,11 +15,11 @@ class FakeTelegram(aresponses.ResponsesMockServer):
|
|||
|
||||
async def __aenter__(self):
|
||||
await super().__aenter__()
|
||||
_response = self.Response(text=self._body, headers=self._headers, status=200, reason='OK')
|
||||
_response = self.Response(text=self._body, headers=self._headers, status=200, reason="OK")
|
||||
self.add(self.ANY, response=_response)
|
||||
|
||||
async def __aexit__(self, exc_type, exc_val, exc_tb):
|
||||
if hasattr(self, 'monkeypatch'):
|
||||
if hasattr(self, "monkeypatch"):
|
||||
self.monkeypatch.undo()
|
||||
await super().__aexit__(exc_type, exc_val, exc_tb)
|
||||
|
||||
|
|
@ -27,14 +27,16 @@ class FakeTelegram(aresponses.ResponsesMockServer):
|
|||
def parse_data(message_dict):
|
||||
import json
|
||||
|
||||
_body = '{"ok":true,"result":' + json.dumps(message_dict) + '}'
|
||||
_headers = {'Server': 'nginx/1.12.2',
|
||||
'Date': 'Tue, 03 Apr 2018 16:59:54 GMT',
|
||||
'Content-Type': 'application/json',
|
||||
'Content-Length': str(len(_body)),
|
||||
'Connection': 'keep-alive',
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Methods': 'GET, POST, OPTIONS',
|
||||
'Access-Control-Expose-Headers': 'Content-Length,Content-Type,Date,Server,Connection',
|
||||
'Strict-Transport-Security': 'max-age=31536000; includeSubdomains'}
|
||||
_body = '{"ok":true,"result":' + json.dumps(message_dict) + "}"
|
||||
_headers = {
|
||||
"Server": "nginx/1.12.2",
|
||||
"Date": "Tue, 03 Apr 2018 16:59:54 GMT",
|
||||
"Content-Type": "application/json",
|
||||
"Content-Length": str(len(_body)),
|
||||
"Connection": "keep-alive",
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
"Access-Control-Allow-Methods": "GET, POST, OPTIONS",
|
||||
"Access-Control-Expose-Headers": "Content-Length,Content-Type,Date,Server,Connection",
|
||||
"Strict-Transport-Security": "max-age=31536000; includeSubdomains",
|
||||
}
|
||||
return _body, _headers
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue