Project

General

Profile

Task(タスク) #2908

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

Added by Youichi Kimura over 7 years ago. Updated over 7 years ago.

Status:
Fixed(完了)
Priority:
Normal(通常)
Target version:
Start date:
2012-03-27
Due date:
% Done:

100%


Description

概要

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


Related issues

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

Associated revisions

Revision 806583f1 (diff)
Added by Youichi Kimura over 7 years ago

add unit test for opActivityQueryBuilder (refs #2908)

Revision 525270fd (diff)
Added by Youichi Kimura over 7 years ago

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

Revision c842e421 (diff)
Added by Youichi Kimura over 7 years ago

add unit test for opActivityQueryBuilder (refs #2908)

Revision d89ca8a2 (diff)
Added by Youichi Kimura over 7 years ago

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

Revision e5b47793 (diff)
Added by Shouta Kashiwagi over 7 years ago

added api unit test. (fixes #2908)

Revision 3be54c51 (diff)
Added by Shouta Kashiwagi over 7 years ago

added api unit test. (fixes #2908)

History

#1 Updated by Yuma Sakata over 7 years ago

  • Tracker changed from Enhancement(機能追加・改善) to Task(タスク)

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

#2 Updated by Shouta Kashiwagi over 7 years ago

  • Subject changed from JSON APIのユニットテストを作成する to 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 Updated by Shouta Kashiwagi over 7 years ago

  • Status changed from New(新規) to Pending Review(レビュー待ち)
  • % Done changed from 0 to 50

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

#4 Updated by Shouta Kashiwagi over 7 years ago

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

#5 Updated by Yuya Watanabe over 7 years ago

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 Updated by Yuya Watanabe over 7 years ago

  • Status changed from Pending Review(レビュー待ち) to Fixed(完了)
  • % Done changed from 50 to 100

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

Also available in: Atom PDF