From 14bf09d07ab8331b17fd047544735cebc7342953 Mon Sep 17 00:00:00 2001 From: kamaljeet Date: Fri, 29 Mar 2019 12:31:46 +0530 Subject: [PATCH] [Non-ACR][OAuth2][auto][New Test Cases added for CodeGrantAuthorize and ImplicitGrantAuthorize] Change-Id: I2e8aeb8d2a872b089894fa48ff9431554ed47cf3 Signed-off-by: kamaljeet --- .../testcase/TSCodeGrantAuthorizer.cs | 39 ++++++++++------------ .../testcase/TSImplicitGrantAuthorizer.cs | 13 +++----- 2 files changed, 23 insertions(+), 29 deletions(-) diff --git a/tct-suite-vs/Tizen.OAuth2.Tests/testcase/TSCodeGrantAuthorizer.cs b/tct-suite-vs/Tizen.OAuth2.Tests/testcase/TSCodeGrantAuthorizer.cs index b84ff5c..8d78682 100755 --- a/tct-suite-vs/Tizen.OAuth2.Tests/testcase/TSCodeGrantAuthorizer.cs +++ b/tct-suite-vs/Tizen.OAuth2.Tests/testcase/TSCodeGrantAuthorizer.cs @@ -63,13 +63,13 @@ namespace Tizen.Account.OAuth2.Tests } } - //[Test] + [Test] [Category("P2")] [Description("Validates the response of AuthorizeAsync")] [Property("SPEC", "Tizen.Account.OAuth2.CodeGrantAuthorizer.AuthorizeAsync M")] [Property("SPEC_URL", "-")] [Property("CRITERIA", "MEX")] - [Property("AUTHOR", "Jyothi Kumar Sambolu, s.jyothi@samsung.com")] + [Property("AUTHOR", "Kamaljeet Chauhan, kamal.jc@samsung.com")] public async Task AuthorizeAsync_CHECK_EXCEPTION() { try @@ -82,11 +82,8 @@ namespace Tizen.Account.OAuth2.Tests var authorizer = new CodeGrantAuthorizer(); Assert.IsNotNull(authorizer, "Object should not be null after construction"); - var request = OAuth2Helper.CreateCodeGrantAuthRequest(true); - Assert.IsNotNull(request, "Object should not be null after construction"); - /* TESTCODE */ - var response = await authorizer.AuthorizeAsync(request); + var response = await authorizer.AuthorizeAsync(null); Assert.IsTrue(false, "Expected to throw an exception"); /* POSTCONDITION */ @@ -98,7 +95,7 @@ namespace Tizen.Account.OAuth2.Tests } catch (Exception ex) { - Assert.IsTrue(ex is OAuth2Exception, "Wrong exception thrown.Expected is OAuth2Exception"); + Assert.IsTrue(true, "Expected to throw an exception"); } } @@ -141,14 +138,14 @@ namespace Tizen.Account.OAuth2.Tests } } - //[Test] - [Category("P1")] - [Description("Checks the invocation of ClearCookies")] + [Test] + [Category("P2")] + [Description("Validates the response of ClearCookies")] [Property("SPEC", "Tizen.Account.OAuth2.CodeGrantAuthorizer.ClearCookies M")] [Property("SPEC_URL", "-")] [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Jyothi Kumar Sambolu, s.jyothi@samsung.com")] - public void ClearCookies_CHECK_NO_EXCEPTION() + [Property("AUTHOR", "Kamaljeet Chauhan, kamal.jc@samsung.com")] + public void ClearCookies_CHECK_EXCEPTION() { try { @@ -161,7 +158,7 @@ namespace Tizen.Account.OAuth2.Tests /* TESTCODE */ authorizer.ClearCookies(); - Assert.IsTrue(true, "Not Expected to throw an exception"); + Assert.IsTrue(false, "Expected to throw an exception"); /* POSTCONDITION */ authorizer.Dispose(); @@ -173,18 +170,18 @@ namespace Tizen.Account.OAuth2.Tests catch (Exception ex) { LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, ex.ToString()); - Assert.IsTrue(false, "Exception is not expected"); + Assert.IsTrue(true, "Exception is expected"); } } - //[Test] - [Category("P1")] - [Description("Checks the invocation of ClearCache")] + [Test] + [Category("P2")] + [Description("Validates the response of ClearCache")] [Property("SPEC", "Tizen.Account.OAuth2.CodeGrantAuthorizer.ClearCache M")] [Property("SPEC_URL", "-")] [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Jyothi Kumar Sambolu, s.jyothi@samsung.com")] - public void ClearCache_CHECK_NO_EXCEPTION() + [Property("AUTHOR", "Kamaljeet Chauhan, kamal.jc@samsung.com")] + public void ClearCache_CHECK_EXCEPTION() { try { @@ -197,7 +194,7 @@ namespace Tizen.Account.OAuth2.Tests /* TESTCODE */ authorizer.ClearCache(); - Assert.IsTrue(true, "Not Expected to throw an exception"); + Assert.IsTrue(false, "Expected to throw an exception"); /* POSTCONDITION */ authorizer.Dispose(); @@ -209,7 +206,7 @@ namespace Tizen.Account.OAuth2.Tests catch (Exception ex) { LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, ex.ToString()); - Assert.IsTrue(false, "Exception is not expected"); + Assert.IsTrue(true, "Exception is expected"); } } } diff --git a/tct-suite-vs/Tizen.OAuth2.Tests/testcase/TSImplicitGrantAuthorizer.cs b/tct-suite-vs/Tizen.OAuth2.Tests/testcase/TSImplicitGrantAuthorizer.cs index 4499c7c..f8be299 100755 --- a/tct-suite-vs/Tizen.OAuth2.Tests/testcase/TSImplicitGrantAuthorizer.cs +++ b/tct-suite-vs/Tizen.OAuth2.Tests/testcase/TSImplicitGrantAuthorizer.cs @@ -63,14 +63,14 @@ namespace Tizen.Account.OAuth2.Tests } } - //[Test] + [Test] [Category("P2")] [Description("Validates the response of AuthorizeAsync")] [Property("SPEC", "Tizen.Account.OAuth2.ImplicitGrantAuthorizer.AuthorizeAsync M")] [Property("SPEC_URL", "-")] [Property("CRITERIA", "MEX")] - [Property("AUTHOR", "Jyothi Kumar Sambolu, s.jyothi@samsung.com")] - public async Task AuthorizeAsync_EXCEPTION() + [Property("AUTHOR", "Kamaljeet Chauhan, kamal.jc@samsung.com")] + public async Task AuthorizeAsync_CHECK_EXCEPTION() { try { @@ -82,11 +82,8 @@ namespace Tizen.Account.OAuth2.Tests var authorizer = new ImplicitGrantAuthorizer(); Assert.IsNotNull(authorizer, "Object should not be null after construction"); - var request = OAuth2Helper.CreateImplicitGrantAuthRequest(true); - Assert.IsNotNull(request, "Object should not be null after construction"); - /* TESTCODE */ - var response = await authorizer.AuthorizeAsync(request); + var response = await authorizer.AuthorizeAsync(null); Assert.IsTrue(false, "Expected to throw an exception"); /* POSTCONDITION */ @@ -98,7 +95,7 @@ namespace Tizen.Account.OAuth2.Tests } catch (Exception ex) { - Assert.IsTrue(ex is OAuth2Exception, "Wrong exception thrown.Expected is OAuth2Exception"); + Assert.IsTrue(true, "Expected to throw an exception"); } } -- 2.7.4