Skip to content

Commit

Permalink
[delete] printの削除
Browse files Browse the repository at this point in the history
  • Loading branch information
PigeonsHouse committed Jul 5, 2022
1 parent f8d0107 commit ed342b8
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 34 deletions.
3 changes: 0 additions & 3 deletions cruds/tags/tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion cruds/url_infos/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 0 additions & 2 deletions tests/test_asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 0 additions & 4 deletions tests/test_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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'}
23 changes: 0 additions & 23 deletions tests/test_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 }"
})
Expand Down Expand Up @@ -43,15 +42,13 @@ 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 :::::::: ユーザーの情報を取得")
"""
ユーザーの情報を取得
"""
count = 0
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
Expand All @@ -65,22 +62,19 @@ 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でユーザーの情報を取得
"""
count = 0
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 :::::::: ユーザー一覧を取得")
"""
ユーザー一覧を取得
"""
Expand All @@ -90,31 +84,24 @@ 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, 'ユーザー一覧の取得に成功する'
assert res.json()[index]['id'] == user_id
index += 1

def test_get_users_with_limit(use_test_db_fixture, users_factory_for_test):
print("test_get_users_with_limit :::::::: 取得するユーザー数を制限してユーザー一覧を取得")
"""
取得するユーザー数を制限してユーザー一覧を取得
"""
limit = 3
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 :::::::: オフセットを指定してユーザー一覧を取得")
"""
オフセットを指定してユーザー一覧を取得
"""
Expand All @@ -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を指定してユーザー一覧を取得
"""
Expand All @@ -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 :::::::: ユーザーの情報をすべて編集")
"""
ユーザーの情報をすべて編集
"""
Expand All @@ -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={
Expand All @@ -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つ編集
"""
Expand All @@ -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={
Expand All @@ -205,15 +187,13 @@ 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フォーマットが間違ったものに編集
"""
token = user_token_factory_for_test()

new_avatar_url: str = "newavatar.png"

print('Token', token)
res = client.put('/api/v1/users/@me', headers={
"Authorization": f"Bearer { token.access_token }"
}, json={
Expand All @@ -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 :::::::: アクセストークンなしで自分の情報を変更する")
"""
アクセストークンなしで自分の情報を変更する
"""
Expand All @@ -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 :::::::: 期限切れのアクセストークンを用いて自分の情報を変更する")
"""
期限切れのアクセストークンを用いて自分の情報を変更する
"""
Expand All @@ -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={
Expand Down
1 change: 0 additions & 1 deletion utils/discord.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit ed342b8

Please sign in to comment.