プロジェクト

全般

プロフィール

Task(タスク) #2908

JSON APIのユニットテストを作成する(正常系)

Youichi Kimuraほぼ12年前に追加. ほぼ12年前に更新.

ステータス:
Fixed(完了)
優先度:
Normal(通常)
担当者:
対象バージョン:
開始日:
2012-03-27
期日:
進捗率:

100%


説明

概要

OpenPNE3コアに含まれるJSON APIに対するユニットテストを作成する。


関連するチケット

関連している OpenPNE 3 - Enhancement(機能追加・改善) #2828: デモ及びテストに使える洗練されたフィクスチャデータを作成する New(新規) 2012-02-20

関係しているリビジョン

リビジョン 806583f1 (差分)
Youichi Kimuraほぼ12年前に追加

add unit test for opActivityQueryBuilder (refs #2908)

リビジョン 525270fd (差分)
Youichi Kimuraほぼ12年前に追加

fix http status code of json api when running in debug mode (refs #2908)

リビジョン c842e421 (差分)
Youichi Kimuraほぼ12年前に追加

add unit test for opActivityQueryBuilder (refs #2908)

リビジョン d89ca8a2 (差分)
Youichi Kimuraほぼ12年前に追加

fix http status code of json api when running in debug mode (refs #2908)

リビジョン e5b47793 (差分)
Shouta Kashiwagiほぼ12年前に追加

added api unit test. (fixes #2908)

リビジョン 3be54c51 (差分)
Shouta Kashiwagiほぼ12年前に追加

added api unit test. (fixes #2908)

履歴

#1 Yuma Sakataほぼ12年前に更新

  • トラッカーEnhancement(機能追加・改善) から Task(タスク) に変更

チケットのトラッカーを変更します。

#2 Shouta Kashiwagiほぼ12年前に更新

  • 題名JSON APIのユニットテストを作成する から JSON APIのユニットテストを作成する(正常系) に変更

異常系テストについては別チケットで対応します.
正常系については成功しているため閉じます.

正常系テスト: 5,6, 13, 17, 22, 28, 30, 31, 32, 34, 38, 41, 42

ok 1 - [apiKey] JSON API is not enabled.
not ok 2 - [apiKey] apiKey not specified
#     Failed test (./test/unit/api/opJsonApiTest.php at line 28)
#            got: 200
#       expected: 401
not ok 3 - [apiKey] empty apiKey
#     Failed test (./test/unit/api/opJsonApiTest.php at line 31)
#            got: 200
#       expected: 401
not ok 4 - [apiKey] invalid apiKey
#     Failed test (./test/unit/api/opJsonApiTest.php at line 34)
#            got: 200
#       expected: 401
ok 5 - [apiKey] valid apiKey
ok 6 - [activity/search.json] valid request
ok 7 - [activity/search.json] invalid parameter
not ok 8 - [activity/search.json] target => friend is valid parameter.
#     Failed test (./test/unit/api/opJsonApiTest.php at line 50)
#            got: 500
#       expected: 200
ok 9 - [activity/search.json] target => community parameter requires target_id parameter.
not ok 10 - [activity/search.json] target => community is valid parameter.
#     Failed test (./test/unit/api/opJsonApiTest.php at line 56)
#            got: 404
#       expected: 200
not ok 11 - [activity/search.json] activiy_id parameter is not set.
#     Failed test (./test/unit/api/opJsonApiTest.php at line 59)
#            got: 200
#       expected: 400
not ok 12 - [activity/search.json] activity_id => hogefuga is invalid parameter
#     Failed test (./test/unit/api/opJsonApiTest.php at line 62)
#            got: 200
#       expected: 400
ok 13 - [activity/search.json] activity_id => 1 is valid parameter
not ok 14 - [activity/search.json] member_id parameter is valid parameter.
#     Failed test (./test/unit/api/opJsonApiTest.php at line 68)
#            got: 500
#       expected: 200
ok 15 - [activity/search.json] max_id and since_id parameter is valid parameter.
ok 16 - [activity/post.json] body parameter is required.
ok 17 - [activity/post.json] body => hogefuga parameter should be posted.
not ok 18 - [activity/post.json] body => (space) parameter should be rejected.
#     Failed test (./test/unit/api/opJsonApiTest.php at line 85)
#            got: 200
#       expected: 400
not ok 19 - [activity/post.json] body => (tabs) parameter should be rejected.
#     Failed test (./test/unit/api/opJsonApiTest.php at line 88)
#            got: 200
#       expected: 400
ok 20 - [activity/post.json] target parameter (except: 'community') should not be set.
ok 21 - [activity/post.json] target_id parameter is required.
ok 22 - [activity/post.json] target => community and target_id => 1 parameter should be posted.
ok 23 - [activity/delete.json] activity_id parameter is required.
not ok 24 - [activity/delete.json] activity_id => 1 is valid parameter.
#     Failed test (./test/unit/api/opJsonApiTest.php at line 108)
#            got: 403
#       expected: 200
not ok 25 - [activity/delete.json] id => 2 parameter is invalid parameter (not found).
#     Failed test (./test/unit/api/opJsonApiTest.php at line 111)
#            got: 403
#       expected: 404
ok 26 - [activity/delete.json] id => 3 activity data is not allowed to delete.
ok 27 - [member/search.json] target => friend parameter is invalid.
ok 28 - [member/search.json] target => friend and target_id parameter is valid.
ok 29 - [member/search.json] target => community parameter is invalid.
ok 30 - [member/search.json] target => community and target_id parameter is valid.
ok 31 - [member/search.json] target => dummy parameter id valid.
ok 32 - [community/search.json] keyword => dummy parameter is valid.
ok 33 - [community/member.json] community_id parameter is required.
ok 34 - [community/member.json] community_id => 1 parameter is valid.
ok 35 - [community/join.json] community_id parameter is required.
ok 36 - [community/join.json] community_id => 10000 does not exist.
not ok 37 - [community/join.json] community_id => 1 is already joined.
#     Failed test (./test/unit/api/opJsonApiTest.php at line 157)
#            got: 200
#       expected: 400
ok 38 - [community/join.json] community_id => 2 parameter is valid.
not ok 39 - [community/join.json] community_id => 2 and leave => true parameter is valid.
#     Failed test (./test/unit/api/opJsonApiTest.php at line 163)
#            got: 500
#       expected: 200
not ok 40 - [community/join.json] This member cannot leave this community (community_id => 1)
#     Failed test (./test/unit/api/opJsonApiTest.php at line 166)
#            got: 200
#       expected: 400
ok 41 - [push/count.json] valid.
ok 42 - [push/search.json] valid.

#3 Shouta Kashiwagiほぼ12年前に更新

  • ステータスNew(新規) から Pending Review(レビュー待ち) に変更
  • 進捗率0 から 50 に変更

更新履歴 e5b477937b98b4236daa8c5ad17a2d61934c5cc3 で適用されました。

#4 Shouta Kashiwagiほぼ12年前に更新

更新履歴 3be54c51fc5a312d8a66671a6d91bf9f1fc3b84b で適用されました。

#5 Yuya Watanabeほぼ12年前に更新

note-2 から 正常系だけのテスト結果を抽出したもの

正常系テスト: 5,6, 13, 17, 22, 28, 30, 31, 32, 34, 38, 41, 42

ok 5 - [apiKey] valid apiKey
ok 6 - [activity/search.json] valid request
ok 13 - [activity/search.json] activity_id => 1 is valid parameter
ok 17 - [activity/post.json] body => hogefuga parameter should be posted.
ok 22 - [activity/post.json] target => community and target_id => 1 parameter should be posted.
ok 28 - [member/search.json] target => friend and target_id parameter is valid.
ok 30 - [member/search.json] target => community and target_id parameter is valid.
ok 31 - [member/search.json] target => dummy parameter id valid.
ok 32 - [community/search.json] keyword => dummy parameter is valid.
ok 34 - [community/member.json] community_id => 1 parameter is valid.
ok 38 - [community/join.json] community_id => 2 parameter is valid.
ok 41 - [push/count.json] valid.
ok 42 - [push/search.json] valid.

#6 Yuya Watanabeほぼ12年前に更新

  • ステータスPending Review(レビュー待ち) から Fixed(完了) に変更
  • 進捗率50 から 100 に変更

正常系については問題ないとし,実行もできているものとしてチケットをクローズします.

他の形式にエクスポート: Atom PDF