Skip to content
This repository has been archived by the owner on Apr 1, 2024. It is now read-only.

fix error logout when session token expired time #132 #174

Merged
merged 3 commits into from
Nov 24, 2017

Conversation

hocnguyen
Copy link
Contributor

概要(Summary)

動作確認手順(Step for Confirmation)

Run the unit test.

@ykokw
Copy link
Contributor

ykokw commented Dec 21, 2016

@hocnguyen
Thank you for creating p-r!

Could you separate p-r for issue #161 or add description in p-r summary ?
And I can't find test code for this fixing.

@hocnguyen
Copy link
Contributor Author

@ykokw
Thanks for your review.
I will separate to 2 p-r.

@hocnguyen
Copy link
Contributor Author

@ykokw
I remove the code of issue 161.
This is only code fixing of issue 132.
Please help me review again!

@ykokw
Copy link
Contributor

ykokw commented Jan 4, 2017

@hocnguyen
I've confirmed that your fixing is separated to 2 p-r. Thanks.
Could you add test code or tell me procedure for confirmation?

@hocnguyen
Copy link
Contributor Author

@ykokw
About this issue, when we call logout function with a session token was expired or wrong.
The error will appear.
Base from description of issue. I reset session info to null value when error code response is 401.
Because In mbaas.yml file, we had declare logout function with response 200.
So I can`t create response 401 with logout function from test code.
That is reason i can`t add the test code.
But Please see example code bellow. That is my code test on this issue :

var user = new ncmb.User({userName:"Yamada Tarou", password:"password"});
			ncmb.User.login(user)
				.then(function(data){
                                   // reset wrong token to error appear when logout 
				    user.sessionToken="wrong token"; 
				    user.logout(function(err, res){
					  if(err){
						console.log(err);
					  }
					});
				})
				.catch(function(err){
				  // エラー処理
				});

@ndyuya ndyuya removed their assignment Mar 16, 2017
@ykokw
Copy link
Contributor

ykokw commented Mar 22, 2017

Because In mbaas.yml file, we had declare logout function with response 200.

上記、mbaas.ymlに401エラーが返るスタブを用意することで

  • セッショントークンが期限切れなどで401エラーが返る場合に、ローカルにあるsessionTokenが削除されることを確認する

テストコードが実装可能になるかと思います。

@bkzen bkzen merged commit 80b4fda into develop Nov 24, 2017
@bkzen bkzen deleted the fix/logout_expired_token branch November 24, 2017 11:20
@bkzen bkzen mentioned this pull request Nov 27, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants