"No","テストID","対象クラス","対象メソッド","テスト観点","テストケース名","前提条件","入力値","期待結果","優先度","備考"
"1","UT-USR-001","users.models.ApiToken","generate_key","正常系","カスタムプレフィックス付きトークンキーが生成されること","なし","prefix='inv-'","'inv-'で始まり日付サフィックスを含むキーが返却される","高","トークン生成の基本機能"
"2","UT-USR-002","users.models.ApiToken","generate_key","正常系","デフォルトプレフィックスでトークンが生成されること","なし","引数なし","'inv-'で始まるキーが返却される","中","デフォルト値の確認"
"3","UT-USR-003","users.models.ApiToken","token","正常系","トークンが正しく隠蔽されること","ApiTokenインスタンスが存在","保存済みトークン","先頭8文字と末尾12文字以外が'*'で隠蔽される","高","セキュリティ要件"
"4","UT-USR-004","users.models.ApiToken","token","境界値","未保存トークンで生のキーが返却されること","pk=Noneの新規インスタンス","新規トークン","生のキーがそのまま返却される","中","新規作成時の挙動"
"5","UT-USR-005","users.models.ApiToken","expired","正常系","有効期限切れトークンがTrueを返すこと","expiry < 今日の日付","期限切れトークン","Trueが返却される","高","認証制御の重要機能"
"6","UT-USR-006","users.models.ApiToken","expired","正常系","有効期限内トークンがFalseを返すこと","expiry >= 今日の日付","有効なトークン","Falseが返却される","高","認証制御の重要機能"
"7","UT-USR-007","users.models.ApiToken","expired","境界値","expiry=Noneの場合Falseを返すこと","expiryがNone","expiry=None","Falseが返却される","中","Null処理の確認"
"8","UT-USR-008","users.models.ApiToken","active","正常系","revoked=Falseかつ未期限切れでTrueを返すこと","revoked=False, expired=False","有効なトークン","Trueが返却される","高","認証判定の基本機能"
"9","UT-USR-009","users.models.ApiToken","active","正常系","revoked=TrueでFalseを返すこと","revoked=True","無効化されたトークン","Falseが返却される","高","無効化トークンの検証"
"10","UT-USR-010","users.models.ApiToken","active","正常系","期限切れでFalseを返すこと","expired=True","期限切れトークン","Falseが返却される","高","期限切れトークンの検証"
"11","UT-USR-011","users.models.ApiToken","sanitize_name","正常系","名前が正しくサニタイズされること","なし","name=' test name '","'test-name'が返却される","中","入力値の正規化"
"12","UT-USR-012","users.models.ApiToken","sanitize_name","境界値","100文字を超える名前が切り詰められること","なし","101文字以上の文字列","100文字に切り詰められる","中","文字数制限の確認"
"13","UT-USR-013","users.models.ApiToken","sanitize_name","異常系","HTMLタグが除去されること","なし","name='<script>test</script>'","'test'が返却される","高","XSS対策"
"14","UT-USR-014","users.models.ApiToken","sanitize_name","異常系","非印刷文字が除去されること","なし","制御文字を含む文字列","制御文字が除去された文字列","中","入力値のクリーニング"
"15","UT-USR-015","users.models.RuleSet","save","正常系","can_addがTrueのときcan_viewがTrueになること","RuleSetインスタンス","can_add=True, can_view=False","can_view=Trueで保存される","高","権限の整合性保持"
"16","UT-USR-016","users.models.RuleSet","save","正常系","can_changeがTrueのときcan_viewがTrueになること","RuleSetインスタンス","can_change=True, can_view=False","can_view=Trueで保存される","高","権限の整合性保持"
"17","UT-USR-017","users.models.RuleSet","save","正常系","can_deleteがTrueのときcan_viewとcan_changeがTrueになること","RuleSetインスタンス","can_delete=True","can_view=True, can_change=Trueで保存される","高","権限の整合性保持"
"18","UT-USR-018","users.models.RuleSet","save","正常系","can_addがTrueのときcan_changeがTrueになること","RuleSetインスタンス","can_add=True","can_change=Trueで保存される","高","権限の整合性保持"
"19","UT-USR-019","users.models.RuleSet","label","正常系","ルールセット名に対応するラベルが返却されること","RuleSetインスタンス","name='admin'","'Admin'が返却される","中","表示用ラベルの取得"
"20","UT-USR-020","users.models.RuleSet","label","異常系","未定義のルールセット名で名前がそのまま返却されること","RuleSetインスタンス","name='unknown'","'unknown'が返却される","低","不明な名前のフォールバック"
"21","UT-USR-021","users.models.RuleSet","get_models","正常系","ルールセットに対応するモデルリストが返却されること","RuleSetインスタンス","name='admin'","adminに関連するモデルリストが返却される","中","モデルマッピングの確認"
"22","UT-USR-022","users.models.RuleSet","get_models","境界値","未定義のルールセット名で空リストが返却されること","RuleSetインスタンス","name='unknown'","空リストが返却される","低","存在しない名前の処理"
"23","UT-USR-023","users.models.Owner","get_owners_matching_user","正常系","ユーザーに一致するOwnerが返却されること","ユーザーとOwnerが存在","user=対象ユーザー","ユーザーのOwnerが含まれるリスト","高","権限チェックの基盤"
"24","UT-USR-024","users.models.Owner","get_owners_matching_user","正常系","ユーザーが所属するグループのOwnerも返却されること","ユーザーがグループに所属","user=グループ所属ユーザー","ユーザーとグループのOwnerが含まれるリスト","高","グループ権限の継承"
"25","UT-USR-025","users.models.Owner","create","正常系","新規Ownerが作成されること","Ownerが存在しない","obj=新規ユーザー","新規Ownerインスタンスが返却される","高","Owner自動作成機能"
"26","UT-USR-026","users.models.Owner","create","正常系","既存Ownerが返却されること","Ownerが既に存在","obj=既存ユーザー","既存Ownerインスタンスが返却される","中","重複作成の防止"
"27","UT-USR-027","users.models.Owner","get_owner","正常系","Userに対応するOwnerが取得できること","ユーザーとOwnerが存在","user_or_group=User","ユーザーのOwnerが返却される","高","Owner取得の基本機能"
"28","UT-USR-028","users.models.Owner","get_owner","正常系","Groupに対応するOwnerが取得できること","グループとOwnerが存在","user_or_group=Group","グループのOwnerが返却される","高","Owner取得の基本機能"
"29","UT-USR-029","users.models.Owner","get_owner","異常系","Ownerが存在しない場合Noneが返却されること","Ownerが存在しない","user_or_group=存在しないユーザー","Noneが返却される","中","存在しないOwnerの処理"
"30","UT-USR-030","users.models.Owner","name","正常系","DISPLAY_FULL_NAMESがTrueでフルネームが返却されること","設定=DISPLAY_FULL_NAMES=True","owner_type='user'","ユーザーのフルネームが返却される","中","表示名設定の反映"
"31","UT-USR-031","users.models.Owner","name","正常系","DISPLAY_FULL_NAMESがFalseでusernameが返却されること","設定=DISPLAY_FULL_NAMES=False","owner_type='user'","ユーザー名が返却される","中","表示名設定の反映"
"32","UT-USR-032","users.models.Owner","label","正常系","owner_typeの名前が返却されること","Ownerインスタンス","owner_type=User","'user'が返却される","低","タイプラベルの取得"
"33","UT-USR-033","users.models.Owner","get_related_owners","正常系","グループの関連ユーザーOwnerが返却されること","グループに所属するユーザーが存在","owner=Group型Owner","グループ内ユーザーのOwnerリスト","高","関連Owner取得機能"
"34","UT-USR-034","users.models.Owner","get_related_owners","正常系","include_group=Trueでグループ自身も含まれること","グループに所属するユーザーが存在","owner=Group型Owner, include_group=True","グループとユーザーのOwnerリスト","中","グループ含有オプション"
"35","UT-USR-035","users.models.Owner","get_related_owners","正常系","User型Ownerで自身のみが返却されること","ユーザーOwnerが存在","owner=User型Owner","自身のOwnerのみ含むリスト","中","User型の処理"
"36","UT-USR-036","users.models.Owner","is_user_allowed","正常系","許可されたユーザーでTrueが返却されること","ユーザーがグループに所属","user=グループ所属ユーザー, owner=グループOwner","Trueが返却される","高","権限チェック機能"
"37","UT-USR-037","users.models.Owner","is_user_allowed","正常系","許可されていないユーザーでFalseが返却されること","ユーザーがグループに非所属","user=非所属ユーザー, owner=グループOwner","Falseが返却される","高","権限チェック機能"
"38","UT-USR-038","users.models.Owner","__str__","正常系","文字列表現が正しく生成されること","Ownerインスタンス","owner=User","'username (user)'形式の文字列","低","表示用文字列"
"39","UT-USR-039","users.models.UserProfile","save","正常系","primary_groupがユーザーのグループに含まれない場合Noneになること","ユーザーがグループに非所属","primary_group=非所属グループ","primary_group=Noneで保存される","高","データ整合性の保持"
"40","UT-USR-040","users.models.UserProfile","save","正常系","primary_groupがユーザーのグループに含まれる場合保持されること","ユーザーがグループに所属","primary_group=所属グループ","primary_groupが保持される","中","正常な保存処理"
"41","UT-USR-041","users.models.UserProfile","__str__","正常系","文字列表現が正しく生成されること","UserProfileインスタンス","user.username='testuser'","'testuser user profile'が返却される","低","表示用文字列"
"42","UT-USR-042","users.models","user_model_str","正常系","DISPLAY_FULL_NAMESがTrueでフルネームが返却されること","設定=DISPLAY_FULL_NAMES=True, first_name/last_name設定済み","User.first_name='John', last_name='Doe'","'John Doe'が返却される","中","ユーザー表示名のカスタマイズ"
"43","UT-USR-043","users.models","user_model_str","正常系","DISPLAY_FULL_NAMESがTrueでも名前未設定時usernameが返却されること","設定=DISPLAY_FULL_NAMES=True, first_name/last_name未設定","first_name='', last_name=''","usernameが返却される","中","フォールバック処理"
"44","UT-USR-044","users.models","user_model_str","正常系","DISPLAY_FULL_NAMESがFalseでusernameが返却されること","設定=DISPLAY_FULL_NAMES=False","User","usernameが返却される","中","デフォルト表示"
"45","UT-USR-045","users.models","default_token_expiry","正常系","1年後の日付が返却されること","なし","なし","現在日付+365日が返却される","中","トークン有効期限のデフォルト"
"46","UT-USR-046","users.models","create_owner","正常系","User保存時にOwnerが自動作成されること","新規User","User.save()","Ownerインスタンスが作成される","高","シグナル連携"
"47","UT-USR-047","users.models","create_owner","正常系","Group保存時にOwnerが自動作成されること","新規Group","Group.save()","Ownerインスタンスが作成される","高","シグナル連携"
"48","UT-USR-048","users.models","delete_owner","正常系","User削除時にOwnerも削除されること","UserとOwnerが存在","User.delete()","Ownerも削除される","高","シグナル連携"
"49","UT-USR-049","users.models","delete_owner","正常系","Group削除時にOwnerも削除されること","GroupとOwnerが存在","Group.delete()","Ownerも削除される","高","シグナル連携"
"50","UT-USR-050","users.models","create_or_update_user_profile","正常系","User作成時にUserProfileが自動作成されること","新規User","User.save() (created=True)","UserProfileインスタンスが作成される","高","シグナル連携"
"51","UT-USR-051","users.models","validate_primary_group_on_group_change","正常系","ユーザーがグループから外された時primary_groupがNoneになること","ユーザーがグループに所属, primary_group=該当グループ","user.groups.remove(group)","profile.primary_group=None","高","データ整合性の保持"
"52","UT-USR-052","users.permissions","check_user_role","正常系","スーパーユーザーでTrueが返却されること","user.is_superuser=True","user=スーパーユーザー, role='admin', permission='view'","Trueが返却される","高","権限チェックの基本"
"53","UT-USR-053","users.permissions","check_user_role","正常系","非アクティブユーザーでFalseが返却されること","user.is_active=False","user=非アクティブユーザー","Falseが返却される","高","アクティブ状態チェック"
"54","UT-USR-054","users.permissions","check_user_role","正常系","allow_inactive=Trueで非アクティブユーザーも許可されること","user.is_active=False","user=非アクティブ, allow_inactive=True","権限に応じた結果","中","非アクティブ許可オプション"
"55","UT-USR-055","users.permissions","check_user_role","正常系","ロールを持つグループに所属するユーザーでTrueが返却されること","ユーザーが権限付きグループに所属","user=権限付きユーザー, role='part', permission='view'","Trueが返却される","高","ロールベース権限"
"56","UT-USR-056","users.permissions","check_user_role","正常系","ロールを持たないユーザーでFalseが返却されること","ユーザーが権限なしグループに所属","user=権限なしユーザー, role='admin', permission='delete'","Falseが返却される","高","権限不足の検証"
"57","UT-USR-057","users.permissions","check_user_role","境界値","user=NoneでFalseが返却されること","なし","user=None","Falseが返却される","中","Nullユーザーの処理"
"58","UT-USR-058","users.permissions","check_user_permission","正常系","スーパーユーザーでTrueが返却されること","user.is_superuser=True","user=スーパーユーザー, model=Part, permission='view'","Trueが返却される","高","権限チェックの基本"
"59","UT-USR-059","users.permissions","check_user_permission","正常系","get_ruleset_ignoreに含まれるモデルでTrueが返却されること","なし","model=無視対象モデル","Trueが返却される","中","無視リストの処理"
"60","UT-USR-060","users.permissions","check_user_permission","正常系","ロールベース権限で許可されること","ユーザーがロールを持つ","user=権限ユーザー, model=Part, permission='view'","Trueが返却される","高","モデル権限チェック"
"61","UT-USR-061","users.permissions","split_model","正常系","モデルラベルが正しく分割されること","なし","model_label='part_partcategory'","('partcategory', 'part')が返却される","中","ユーティリティ関数"
"62","UT-USR-062","users.permissions","split_model","正常系","アンダースコア含むアプリ名が正しく処理されること","なし","model_label='oauth2_provider_application'","('application', 'oauth2_provider')が返却される","中","複合アプリ名の処理"
"63","UT-USR-063","users.permissions","get_model_permission_string","正常系","権限文字列が正しく生成されること","なし","model='part_part', permission='view'","'part.view_part'が返却される","中","権限文字列生成"
"64","UT-USR-064","users.permissions","prefetch_rule_sets","正常系","プリフェッチされたグループクエリセットが返却されること","ユーザーがグループに所属","user=対象ユーザー","prefetched_rule_sets属性を持つクエリセット","中","パフォーマンス最適化"
"65","UT-USR-065","users.authentication.ApiTokenAuthentication","authenticate_credentials","正常系","有効なトークンでユーザーとトークンが返却されること","有効なApiTokenが存在","key=有効なトークンキー","(user, token)タプルが返却される","高","認証の基本機能"
"66","UT-USR-066","users.authentication.ApiTokenAuthentication","authenticate_credentials","異常系","無効化されたトークンで例外が発生すること","revoked=TrueのApiToken","key=無効化トークン","AuthenticationFailed例外が発生","高","セキュリティ要件"
"67","UT-USR-067","users.authentication.ApiTokenAuthentication","authenticate_credentials","異常系","期限切れトークンで例外が発生すること","expired=TrueのApiToken","key=期限切れトークン","AuthenticationFailed例外が発生","高","セキュリティ要件"
"68","UT-USR-068","users.authentication.ApiTokenAuthentication","authenticate_credentials","正常系","last_seenが今日でない場合更新されること","last_seen!=今日","key=有効トークン","last_seenが今日の日付に更新される","中","アクセス追跡機能"
"69","UT-USR-069","users.tasks","update_group_roles","正常系","古いRuleSetが削除されること","無効なRuleSetが存在","group=対象グループ","outdated RuleSetが削除される","高","データクリーンアップ"
"70","UT-USR-070","users.tasks","update_group_roles","正常系","不足しているRuleSetが作成されること","一部RuleSetが欠如","group=対象グループ","全てのRuleSetが作成される","高","権限の完全性保持"
"71","UT-USR-071","users.tasks","update_group_roles","正常系","RuleSetに基づいてパーミッションが追加されること","can_view=TrueのRuleSet","group=対象グループ","view権限がグループに追加される","高","権限同期機能"
"72","UT-USR-072","users.tasks","update_group_roles","正常系","RuleSetに基づいてパーミッションが削除されること","can_view=FalseのRuleSet","group=対象グループ","view権限がグループから削除される","高","権限同期機能"
"73","UT-USR-073","users.tasks","rebuild_all_permissions","正常系","全グループの権限が再構築されること","複数グループが存在","なし","全グループでupdate_group_rolesが実行される","中","バッチ処理"
"74","UT-USR-074","users.serializers","make_random_password","正常系","指定長のパスワードが生成されること","なし","length=14","14文字のパスワードが返却される","中","パスワード生成"
"75","UT-USR-075","users.serializers","make_random_password","正常系","大文字・小文字・数字を含むパスワードが生成されること","なし","length=14","条件を満たすパスワード(小文字/大文字/数字3文字以上)","高","パスワード強度要件"
"76","UT-USR-076","users.serializers","generate_permission_dict","正常系","権限が辞書形式で返却されること","Permissionオブジェクトリスト","permissions=[view_part, add_part]","{'part': ['view', 'add']}形式","中","権限データ変換"
"77","UT-USR-077","users.serializers.ExtendedUserSerializer","validate_is_superuser","正常系","スーパーユーザーがis_superuserを変更できること","リクエストユーザー=スーパーユーザー","is_superuser=True","バリデーション成功","高","権限昇格の制御"
"78","UT-USR-078","users.serializers.ExtendedUserSerializer","validate_is_superuser","異常系","非スーパーユーザーがis_superuserを変更しようとすると例外が発生すること","リクエストユーザー=一般ユーザー","is_superuser=True","PermissionDenied例外が発生","高","セキュリティ要件"
"79","UT-USR-079","users.serializers.ExtendedUserSerializer","update","正常系","group_idsでグループが更新されること","ユーザーインスタンス","group_ids=[1, 2]","user.groupsが更新される","中","グループ更新機能"
"80","UT-USR-080","users.serializers.UserCreateSerializer","validate","正常系","権限があるユーザーでバリデーション成功すること","リクエストユーザー=staff+admin権限","attrs=有効なデータ","passwordが自動生成されてバリデーション成功","高","ユーザー作成の権限チェック"
"81","UT-USR-081","users.serializers.UserCreateSerializer","create","正常系","ユーザー作成後にログイン不可パスワードが設定されること","有効なvalidated_data","validated_data=ユーザーデータ","set_unusable_password()が呼ばれる","高","セキュリティ要件"
"82","UT-USR-082","users.serializers.ApiTokenSerializer","get_in_use","正常系","現在使用中のトークンでTrueが返却されること","リクエストで使用中のトークン","token=使用中トークン","Trueが返却される","中","使用中トークンの識別"
"83","UT-USR-083","users.serializers.ApiTokenSerializer","get_in_use","正常系","使用中でないトークンでFalseが返却されること","リクエストで未使用のトークン","token=未使用トークン","Falseが返却される","中","使用中トークンの識別"
"84","UT-USR-084","users.serializers.RoleSerializer","get_roles","正常系","ユーザーのロールが辞書形式で返却されること","ユーザーがロールを持つ","user=権限ユーザー","{'admin': ['view'], 'part': ['view', 'add']}形式","中","ロール情報取得"
"85","UT-USR-085","users.serializers.RoleSerializer","get_permissions","正常系","スーパーユーザーで全権限が返却されること","user.is_superuser=True","user=スーパーユーザー","全モデルの全権限が含まれる","中","権限一覧取得"
"86","UT-USR-086","users.api.OwnerFilter","filter_is_active","正常系","is_active=Trueでアクティブユーザーのみフィルタされること","アクティブ/非アクティブユーザーが存在","is_active=True","アクティブユーザーのOwnerのみ返却","中","オーナーフィルタリング"
"87","UT-USR-087","users.api.OwnerFilter","filter_is_active","正常系","is_active=Falseで非アクティブユーザーのみフィルタされること","アクティブ/非アクティブユーザーが存在","is_active=False","非アクティブユーザーのOwnerのみ返却","中","オーナーフィルタリング"
"88","UT-USR-088","users.api.OwnerList","filter_queryset","正常系","検索語でOwnerがフィルタされること","複数Ownerが存在","search='john'","名前に'john'を含むOwnerのみ返却","中","検索機能"
"89","UT-USR-089","users.api.UserDetail","perform_destroy","正常系","ユーザー削除時にセッションも削除されること","ユーザーにセッションが存在","instance=対象ユーザー","usersession_set.delete()が呼ばれる","高","セッション管理"
"90","UT-USR-090","users.api.UserDetailSetPassword","perform_update","正常系","パスワードが設定されること","有効なパスワード","password='NewPassword123'","user.set_password()が呼ばれる","高","パスワード設定機能"
"91","UT-USR-091","users.api.UserDetailSetPassword","perform_update","異常系","バリデーションエラーのパスワードで例外が発生すること","無効なパスワード(override_warning=False)","password='weak'","ValidationError例外が発生","高","パスワード強度チェック"
"92","UT-USR-092","users.api.UserDetailSetPassword","perform_update","正常系","override_warning=Trueでバリデーションがスキップされること","override_warning=True","password='weak', override_warning=True","パスワードが設定される","中","警告オーバーライド"
"93","UT-USR-093","users.api.GetAuthToken","get","正常系","認証済みユーザーでトークンが返却されること","認証済みユーザー","name='test-token'","token, name, expiryを含むレスポンス","高","トークン取得API"
"94","UT-USR-094","users.api.GetAuthToken","get","正常系","既存の有効なトークンが再利用されること","同名の有効トークンが存在","name='existing-token'","既存トークンが返却される","中","トークン再利用"
"95","UT-USR-095","users.api.GetAuthToken","get","正常系","メタデータがトークンに保存されること","認証済みユーザー","リクエストヘッダー付き","user_agent等のメタデータが保存される","中","メタデータ記録"
"96","UT-USR-096","users.api.TokenMixin","get_queryset","正常系","一般ユーザーで自分のトークンのみ返却されること","一般ユーザー","user=一般ユーザー","自分のトークンのみのクエリセット","高","データアクセス制御"
"97","UT-USR-097","users.api.TokenMixin","get_queryset","正常系","スーパーユーザー+all_users=Trueで全トークンが返却されること","スーパーユーザー","user=スーパーユーザー, all_users=True","全ユーザーのトークン","中","管理者機能"
"98","UT-USR-098","users.api.TokenDetailView","perform_destroy","正常系","トークンが削除ではなくrevokedになること","ApiTokenインスタンス","instance=対象トークン","revoked=Trueに設定される","高","ソフトデリート"
"99","UT-USR-099","users.api.TokenListView","create","正常系","作成されたトークンの生キーがレスポンスに含まれること","認証済みユーザー","name='new-token'","レスポンスにtokenキーが含まれる","高","トークン作成API"
"100","UT-USR-100","users.api.MeUserDetail","get_object","正常系","常にリクエストユーザーが返却されること","認証済みユーザー","なし","request.userが返却される","中","自己参照エンドポイント"
"101","UT-USR-101","users.api.UserProfileDetail","get_object","正常系","常にリクエストユーザーのプロファイルが返却されること","認証済みユーザー","なし","request.user.profileが返却される","中","プロファイルエンドポイント"
"102","UT-USR-102","users.ruleset","get_ruleset_models","正常系","ルールセットとモデルのマッピングが返却されること","なし","なし","辞書形式でルールセット-モデルリストが返却される","中","設定データの取得"
"103","UT-USR-103","users.ruleset","get_ruleset_ignore","正常系","無視すべきモデルリストが返却されること","なし","なし","権限不要モデルのリストが返却される","中","設定データの取得"
