From ed342b8e153b68d35844e3f9ff807b938cebd525 Mon Sep 17 00:00:00 2001 From: PigeonsHouse Date: Tue, 5 Jul 2022 09:42:10 +0900 Subject: [PATCH] =?UTF-8?q?[delete]=20print=E3=81=AE=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cruds/tags/tag.py | 3 --- cruds/url_infos/__init__.py | 1 - tests/test_asset.py | 2 -- tests/test_tag.py | 4 ---- tests/test_user.py | 23 ----------------------- utils/discord.py | 1 - 6 files changed, 34 deletions(-) diff --git a/cruds/tags/tag.py b/cruds/tags/tag.py index 70e913d..23737a5 100644 --- a/cruds/tags/tag.py +++ b/cruds/tags/tag.py @@ -24,9 +24,6 @@ def create_tag(db: Session, name: str, color_code: str) -> GetTag: db.commit() db.refresh(tag_orm) - print(tag_orm.name) - print(tag_orm.color) - tag = GetTag.from_orm(tag_orm) return tag diff --git a/cruds/url_infos/__init__.py b/cruds/url_infos/__init__.py index f241694..edec29a 100644 --- a/cruds/url_infos/__init__.py +++ b/cruds/url_infos/__init__.py @@ -14,7 +14,6 @@ def create_url_info(db: Session, url: str, url_type: str, work_id: str, user_id: str): pattern = url_type_pattern.get(url_type, '') - print(pattern) if not re.match(pattern, url): raise HTTPException(status_code=400, detail='url pattern is invalid') url_info_orm = models.UrlInfo( diff --git a/tests/test_asset.py b/tests/test_asset.py index 4dcf6f0..e53d9fe 100644 --- a/tests/test_asset.py +++ b/tests/test_asset.py @@ -18,8 +18,6 @@ def test_post_asset_without_auth(use_test_db_fixture): "asset_type": asset_type }) - print(res.request) - assert res.status_code == 403, 'Assetの投稿に失敗する' def test_post_correct_image_asset(use_test_db_fixture, user_token_factory_for_test): diff --git a/tests/test_tag.py b/tests/test_tag.py index 5ccf97b..4d53b58 100644 --- a/tests/test_tag.py +++ b/tests/test_tag.py @@ -22,7 +22,6 @@ def test_post_tag(use_test_db_fixture, user_token_factory_for_test): assert res.status_code == 200, 'tagの作成に成功する' res_json = res.json() - print(res_json) assert res_json['name'] == name assert res_json['color'] == color @@ -81,7 +80,6 @@ def test_get_tag_by_tag_id(use_test_db_fixture, tag_for_test, user_token_factory res_json = res.json() - print(res_json) assert res_json['id'] == tag_id assert res_json['name'] == name assert res_json['color'] == color @@ -106,7 +104,6 @@ def test_put_tag(use_test_db_fixture, tag_for_test, user_token_factory_for_test) assert res.status_code == 200, 'タグの編集に成功する' res_json = res.json() - print(res_json) assert res_json['id'] == tag_id assert res_json['name'] == name assert res_json['color'] == color @@ -127,5 +124,4 @@ def test_put_tag(use_test_db_fixture, tag_for_test, user_token_factory_for_test) assert res.status_code == 200, 'タグの削除に成功する' res_json = res.json() - print(res_json) assert res_json == {'status': 'OK'} diff --git a/tests/test_user.py b/tests/test_user.py index 1855234..9635032 100644 --- a/tests/test_user.py +++ b/tests/test_user.py @@ -13,7 +13,6 @@ def test_get_me(use_test_db_fixture, user_factory_for_test, user_token_factory_f 自分の情報を取得 """ token = user_token_factory_for_test() - print('Token', token) res = client.get('/api/v1/users/@me', headers={ "Authorization": f"Bearer { token.access_token }" }) @@ -43,7 +42,6 @@ def test_get_me_with_expired_access_token(use_test_db_fixture, user_factory_for_ assert res.status_code == 403, '有効期限切れのアクセストークンを使った自分の情報の取得に失敗する' def test_get_user_by_id(use_test_db_fixture, users_factory_for_test): - print("test_get_user_by_id :::::::: ユーザーの情報を取得") """ ユーザーの情報を取得 """ @@ -51,7 +49,6 @@ def test_get_user_by_id(use_test_db_fixture, users_factory_for_test): users_info = users_factory_for_test() for user_info in users_info: count+=1 - print(f"===========================test_get_user_by_id: {count}==========================") user_id: str = user_info.id email: str = user_info.email name: str = user_info.name @@ -65,7 +62,6 @@ def test_get_user_by_id(use_test_db_fixture, users_factory_for_test): assert res.json()['display_name'] == display_name def test_get_user_by_not_correct_id(use_test_db_fixture, users_factory_for_test): - print("test_get_user_by_not_correct_id :::::::: 間違ったユーザーIDでユーザーの情報を取得") """ 間違ったユーザーIDでユーザーの情報を取得 """ @@ -73,14 +69,12 @@ def test_get_user_by_not_correct_id(use_test_db_fixture, users_factory_for_test) users_info = users_factory_for_test() for user_info in users_info: count+=1 - print(f"===========================test_get_user_by_not_correct_id: {count}==========================") user_id: str = user_info.id + "hoge" res = client.get(f'/api/v1/users/{user_id}') assert res.status_code == 404, 'ユーザーの情報の取得に失敗する' def test_get_users(use_test_db_fixture, users_factory_for_test): - print("test_get_users :::::::: ユーザー一覧を取得") """ ユーザー一覧を取得 """ @@ -90,9 +84,6 @@ def test_get_users(use_test_db_fixture, users_factory_for_test): res = client.get(f'/api/v1/users') for user_info in users_info: count+=1 - print(f"===========================test_get_users: {count}==========================") - print(user_info) - print(res.json()) user_id: str = user_info.id assert res.status_code == 200, 'ユーザー一覧の取得に成功する' @@ -100,7 +91,6 @@ def test_get_users(use_test_db_fixture, users_factory_for_test): index += 1 def test_get_users_with_limit(use_test_db_fixture, users_factory_for_test): - print("test_get_users_with_limit :::::::: 取得するユーザー数を制限してユーザー一覧を取得") """ 取得するユーザー数を制限してユーザー一覧を取得 """ @@ -108,13 +98,10 @@ def test_get_users_with_limit(use_test_db_fixture, users_factory_for_test): users_info = users_factory_for_test() res = client.get(f'/api/v1/users?limit={limit}') - print(res.json()) - assert res.status_code == 200, '取得するユーザー数を制限してユーザー一覧の取得に成功する' assert len(res.json()) == limit def test_get_users_with_offset_id(use_test_db_fixture, users_factory_for_test): - print("test_get_users_with_offset_id :::::::: オフセットを指定してユーザー一覧を取得") """ オフセットを指定してユーザー一覧を取得 """ @@ -127,7 +114,6 @@ def test_get_users_with_offset_id(use_test_db_fixture, users_factory_for_test): assert res.json()[0]['id'] == user_id def test_get_users_with_not_exit_offset_id(use_test_db_fixture, users_factory_for_test): - print("test_get_users_with_not_exit_offset_id :::::::: 存在しないオフセットIDを指定してユーザー一覧を取得") """ 存在しないオフセットIDを指定してユーザー一覧を取得 """ @@ -139,7 +125,6 @@ def test_get_users_with_not_exit_offset_id(use_test_db_fixture, users_factory_fo def test_put_all_info_of_user_me(use_test_db_fixture, user_factory_for_test, user_token_factory_for_test, session_for_test): - print("test_put_all_info_of_user_me :::::::: ユーザーの情報をすべて編集") """ ユーザーの情報をすべて編集 """ @@ -156,7 +141,6 @@ def test_put_all_info_of_user_me(use_test_db_fixture, user_factory_for_test, use new_twitter_id:str = "new_twitter_id" new_github_id:str = "new_github_id" - print('Token', token) res = client.put('/api/v1/users/@me', headers={ "Authorization": f"Bearer { token.access_token }" }, json={ @@ -178,7 +162,6 @@ def test_put_all_info_of_user_me(use_test_db_fixture, user_factory_for_test, use assert res.json()['profile'] != profile def test_put_a_info_of_user_me(use_test_db_fixture, user_factory_for_test, user_token_factory_for_test, session_for_test): - print("test_put_a_info_of_user_me :::::::: ユーザーの情報を1つ編集") """ ユーザーの情報を1つ編集 """ @@ -191,7 +174,6 @@ def test_put_a_info_of_user_me(use_test_db_fixture, user_factory_for_test, user_ new_display_name: str = "new_display_name" - print('Token', token) res = client.put('/api/v1/users/@me', headers={ "Authorization": f"Bearer { token.access_token }" }, json={ @@ -205,7 +187,6 @@ def test_put_a_info_of_user_me(use_test_db_fixture, user_factory_for_test, user_ assert res.json()['profile'] == profile def test_put_user_avatar_with_not_url_format(use_test_db_fixture, user_token_factory_for_test): - print("test_put_user_avatar_with_not_url_format :::::::: ユーザーのアイコンをURLフォーマットが間違ったものに編集") """ ユーザーのアイコンをURLフォーマットが間違ったものに編集 """ @@ -213,7 +194,6 @@ def test_put_user_avatar_with_not_url_format(use_test_db_fixture, user_token_fac new_avatar_url: str = "newavatar.png" - print('Token', token) res = client.put('/api/v1/users/@me', headers={ "Authorization": f"Bearer { token.access_token }" }, json={ @@ -223,7 +203,6 @@ def test_put_user_avatar_with_not_url_format(use_test_db_fixture, user_token_fac assert res.status_code == 422, 'ユーザーのアイコンの編集に失敗する' def test_put_unauthorized(use_test_db_fixture): - print("test_put_unauthorized :::::::: アクセストークンなしで自分の情報を変更する") """ アクセストークンなしで自分の情報を変更する """ @@ -242,7 +221,6 @@ def test_put_unauthorized(use_test_db_fixture): assert res.status_code == 403, 'アクセストークンなしで自分の情報の変更に失敗する' def test_put_with_expired_access_token(use_test_db_fixture, user_token_factory_for_test): - print("test_put_with_expired_access_token :::::::: 期限切れのアクセストークンを用いて自分の情報を変更する") """ 期限切れのアクセストークンを用いて自分の情報を変更する """ @@ -253,7 +231,6 @@ def test_put_with_expired_access_token(use_test_db_fixture, user_token_factory_f new_avatar_url: str = "https://newavatar.png" new_profile: str = "new_profile" - print('Token', token) res = client.put('/api/v1/users/@me', headers={ "Authorization": f"Bearer { token.access_token }" }, json={ diff --git a/utils/discord.py b/utils/discord.py index c584280..589c571 100644 --- a/utils/discord.py +++ b/utils/discord.py @@ -110,7 +110,6 @@ def discord_verify_user_belongs_to_valid_guild(access_token: str) -> bool: guilds = discord_fetch_user_guilds(access_token=access_token) valid_guild_id = os.environ.get('DISCORD_GUILD_ID') for guild in guilds: - print(guild.id, '==', valid_guild_id) if guild.id == valid_guild_id: return True