From 200e5c194e72b243ea1d0c0d8c7e44dadbd3da3e Mon Sep 17 00:00:00 2001 From: Pavle Date: Fri, 12 Jun 2020 10:15:38 +0200 Subject: [PATCH] Version 3.6.1 --- .../user_in_queue_service.rb | 71 ++++++++----- .../user_in_queue_state_cookie_repository.rb | 43 ++++---- .../test_user_in_queue_service.rb | 99 +++++++++++++++---- ...t_user_in_queue_state_cookie_repository.rb | 12 +++ 4 files changed, 167 insertions(+), 58 deletions(-) diff --git a/lib/queueit_knownuserv3/user_in_queue_service.rb b/lib/queueit_knownuserv3/user_in_queue_service.rb index ff4b4d2..a2b19a6 100644 --- a/lib/queueit_knownuserv3/user_in_queue_service.rb +++ b/lib/queueit_knownuserv3/user_in_queue_service.rb @@ -3,7 +3,7 @@ module QueueIt class UserInQueueService - SDK_VERSION_NO = "3.6.0" + SDK_VERSION_NO = "3.6.1" SDK_VERSION = "v3-ruby-" + SDK_VERSION_NO def initialize(userInQueueStateRepository) @@ -27,11 +27,27 @@ def validateQueueRequest(targetUrl, queueitToken, config, customerId, secretKey) queueParams = QueueUrlParams::extractQueueParams(queueitToken) - if(!queueParams.nil?) - return getQueueITTokenValidationResult(targetUrl, config, queueParams, customerId, secretKey) + requestValidationResult = nil + isTokenValid = false + + if (!queueParams.nil?) + tokenValidationResult = validateToken(config, queueParams, secretKey) + isTokenValid = tokenValidationResult.isValid + + if (isTokenValid) + requestValidationResult = getValidTokenResult(config, queueParams, secretKey) + else + requestValidationResult = getErrorResult(customerId, targetUrl, config, queueParams, tokenValidationResult.errorCode) + end else - return cancelQueueCookieReturnQueueResult(targetUrl, config, customerId) + requestValidationResult = getQueueResult(targetUrl, config, customerId) + end + + if (state.isFound && !isTokenValid) + @userInQueueStateRepository.cancelQueueCookie(config.eventId, config.cookieDomain); end + + return requestValidationResult; end def validateCancelRequest(targetUrl, cancelConfig, customerId, secretKey) @@ -49,18 +65,7 @@ def validateCancelRequest(targetUrl, cancelConfig, customerId, secretKey) end end - def getQueueITTokenValidationResult(targetUrl, config, queueParams,customerId, secretKey) - calculatedHash = OpenSSL::HMAC.hexdigest('sha256', secretKey, queueParams.queueITTokenWithoutHash) - if (calculatedHash.upcase() != queueParams.hashCode.upcase()) - return cancelQueueCookieReturnErrorResult(customerId, targetUrl, config, queueParams, "hash") - end - if (queueParams.eventId.upcase() != config.eventId.upcase()) - return cancelQueueCookieReturnErrorResult(customerId, targetUrl, config, queueParams, "eventid") - end - if (queueParams.timeStamp < Time.now.getutc.tv_sec) - return cancelQueueCookieReturnErrorResult(customerId, targetUrl, config, queueParams, "timestamp") - end - + def getValidTokenResult(config, queueParams, secretKey) @userInQueueStateRepository.store( config.eventId, queueParams.queueId, @@ -68,12 +73,11 @@ def getQueueITTokenValidationResult(targetUrl, config, queueParams,customerId, s !Utils::isNilOrEmpty(config.cookieDomain) ? config.cookieDomain : '', queueParams.redirectType, secretKey) + return RequestValidationResult.new(ActionTypes::QUEUE, config.eventId, queueParams.queueId, nil, queueParams.redirectType, config.actionName) end - def cancelQueueCookieReturnErrorResult(customerId, targetUrl, config, qParams, errorCode) - @userInQueueStateRepository.cancelQueueCookie(config.eventId, config.cookieDomain) - + def getErrorResult(customerId, targetUrl, config, qParams, errorCode) query = getQueryString(customerId, config.eventId, config.version, config.actionName, config.culture, config.layoutName) + "&queueittoken=" + qParams.queueITToken + "&ts=" + Time.now.getutc.tv_sec.to_s + @@ -84,9 +88,7 @@ def cancelQueueCookieReturnErrorResult(customerId, targetUrl, config, qParams, e return RequestValidationResult.new(ActionTypes::QUEUE, config.eventId, nil, redirectUrl, nil, config.actionName) end - def cancelQueueCookieReturnQueueResult(targetUrl, config, customerId) - @userInQueueStateRepository.cancelQueueCookie(config.eventId, config.cookieDomain) - + def getQueueResult(targetUrl, config, customerId) query = getQueryString(customerId, config.eventId, config.version, config.actionName, config.culture, config.layoutName) + (!Utils::isNilOrEmpty(targetUrl) ? "&t=" + Utils.urlEncode( targetUrl) : "") @@ -126,5 +128,30 @@ def extendQueueCookie(eventId, cookieValidityMinutes, cookieDomain, secretKey) def getIgnoreActionResult(actionName) return RequestValidationResult.new(ActionTypes::IGNORE, nil, nil, nil, nil, actionName) end + + def validateToken(config, queueParams, secretKey) + calculatedHash = OpenSSL::HMAC.hexdigest('sha256', secretKey, queueParams.queueITTokenWithoutHash) + if (calculatedHash.upcase() != queueParams.hashCode.upcase()) + return TokenValidationResult.new(false, "hash") + end + if (queueParams.eventId.upcase() != config.eventId.upcase()) + return TokenValidationResult.new(false, "eventid") + end + if (queueParams.timeStamp < Time.now.getutc.tv_sec) + return TokenValidationResult.new(false, "timestamp") + end + + return TokenValidationResult.new(true, nil) + end + + class TokenValidationResult + attr_reader :isValid + attr_reader :errorCode + + def initialize(isValid, errorCode) + @isValid = isValid + @errorCode = errorCode + end + end end end diff --git a/lib/queueit_knownuserv3/user_in_queue_state_cookie_repository.rb b/lib/queueit_knownuserv3/user_in_queue_state_cookie_repository.rb index 6e40e72..27336b8 100644 --- a/lib/queueit_knownuserv3/user_in_queue_state_cookie_repository.rb +++ b/lib/queueit_knownuserv3/user_in_queue_state_cookie_repository.rb @@ -143,35 +143,42 @@ def reissueQueueCookie(eventId, cookieValidityMinutes, cookieDomain, secretKey) end def getState(eventId, cookieValidityMinutes, secretKey, validateTime) - cookieKey = self.class.getCookieKey(eventId) - if (@cookieManager.getCookie(cookieKey).nil?) - return StateInfo.new(false, nil, nil, nil) - end - cookieNameValueMap = getCookieNameValueMap(@cookieManager.getCookie(cookieKey)) - if (!isCookieValid(secretKey, cookieNameValueMap, eventId, cookieValidityMinutes, validateTime)) - return StateInfo.new(false, nil, nil, nil) - end + begin + cookieKey = self.class.getCookieKey(eventId) + if (@cookieManager.getCookie(cookieKey).nil?) + return StateInfo.new(false, false, nil, nil, nil) + end + cookieNameValueMap = getCookieNameValueMap(@cookieManager.getCookie(cookieKey)) + if (!isCookieValid(secretKey, cookieNameValueMap, eventId, cookieValidityMinutes, validateTime)) + return StateInfo.new(true, false, nil, nil, nil) + end - fixedCookieValidityMinutes = nil - if (cookieNameValueMap.key?("FixedValidityMins")) - fixedCookieValidityMinutes = cookieNameValueMap["FixedValidityMins"].to_i - end + fixedCookieValidityMinutes = nil + if (cookieNameValueMap.key?("FixedValidityMins")) + fixedCookieValidityMinutes = cookieNameValueMap["FixedValidityMins"].to_i + end - return StateInfo.new( - true, - cookieNameValueMap["QueueId"], - fixedCookieValidityMinutes, - cookieNameValueMap["RedirectType"]) + return StateInfo.new( + true, + true, + cookieNameValueMap["QueueId"], + fixedCookieValidityMinutes, + cookieNameValueMap["RedirectType"]) + rescue + return StateInfo.new(true, false, nil, nil, nil) + end end end class StateInfo + attr_reader :isFound attr_reader :isValid attr_reader :queueId attr_reader :fixedCookieValidityMinutes attr_reader :redirectType - def initialize(isValid, queueId, fixedCookieValidityMinutes, redirectType) + def initialize(isFound, isValid, queueId, fixedCookieValidityMinutes, redirectType) + @isFound = isFound @isValid = isValid @queueId = queueId @fixedCookieValidityMinutes = fixedCookieValidityMinutes diff --git a/test/queueit_knownuserv3/test_user_in_queue_service.rb b/test/queueit_knownuserv3/test_user_in_queue_service.rb index d8213e4..a72056c 100644 --- a/test/queueit_knownuserv3/test_user_in_queue_service.rb +++ b/test/queueit_knownuserv3/test_user_in_queue_service.rb @@ -90,7 +90,7 @@ def test_ValidateQueueRequest_ValidState_ExtendableCookie_NoCookieExtensionFromC queueConfig.extendCookieValidity = false queueConfig.actionName = "QueueAction" cookieProviderMock = UserInQueueStateRepositoryMockClass.new() - cookieProviderMock.arrayReturns['getState'].push(StateInfo.new(true, "queueId", nil, "idle")) + cookieProviderMock.arrayReturns['getState'].push(StateInfo.new(true, true, "queueId", nil, "idle")) testObject = UserInQueueService.new(cookieProviderMock) result = testObject.validateQueueRequest("url", "token", queueConfig, "customerid", "key") @@ -112,7 +112,7 @@ def test_ValidateQueueRequest_ValidState_ExtendableCookie_CookieExtensionFromCon queueConfig.actionName = "QueueAction" cookieProviderMock = UserInQueueStateRepositoryMockClass.new() - cookieProviderMock.arrayReturns['getState'].push(StateInfo.new(true, "queueId", nil, "disabled")) + cookieProviderMock.arrayReturns['getState'].push(StateInfo.new(true, true, "queueId", nil, "disabled")) testObject = UserInQueueService.new(cookieProviderMock) result = testObject.validateQueueRequest("url", "token", queueConfig, "customerid", "key") assert(!result.doRedirect()) @@ -132,7 +132,7 @@ def test_ValidateQueueRequest_ValidState_NoExtendableCookie_DoNotRedirectDoNotSt queueConfig.actionName = "QueueAction" cookieProviderMock = UserInQueueStateRepositoryMockClass.new() - cookieProviderMock.arrayReturns['getState'].push(StateInfo.new(true, "queueId", 3, "idle")) + cookieProviderMock.arrayReturns['getState'].push(StateInfo.new(true, true, "queueId", 3, "idle")) testObject = UserInQueueService.new(cookieProviderMock) result = testObject.validateQueueRequest("url", "token", queueConfig, "customerid", "key") assert(!result.doRedirect()) @@ -155,7 +155,7 @@ def test_ValidateQueueRequest_NoCookie_TampredToken_RedirectToErrorPageWithHashE url = "http://test.test.com?b=h" cookieProviderMock = UserInQueueStateRepositoryMockClass.new() - cookieProviderMock.arrayReturns['getState'].push(StateInfo.new(false, nil, nil, nil)) + cookieProviderMock.arrayReturns['getState'].push(StateInfo.new(false, false, nil, nil, nil)) token = generateHash('e1', 'queueId', (Time.now.getutc.to_i + (3 * 60)).to_s, 'False', nil, 'idle', key) token = token.sub("False", 'True') @@ -179,7 +179,7 @@ def test_ValidateQueueRequest_NoCookie_TampredToken_RedirectToErrorPageWithHashE assert(Time.now.getutc.to_i - timestamp.to_i < 100) urlWithoutTimeStamp = result.redirectUrl.gsub(/&ts=[^&]*/, "") assert(urlWithoutTimeStamp.upcase() == expectedErrorUrl.upcase()) - assert(cookieProviderMock.expectCallAny('cancelQueueCookie')) + assert(!cookieProviderMock.expectCallAny('cancelQueueCookie')) end def test_ValidateQueueRequest_NoCookie_ExpiredTimeStampInToken_RedirectToErrorPageWithTimeStampError_DoNotStoreCookie @@ -193,7 +193,7 @@ def test_ValidateQueueRequest_NoCookie_ExpiredTimeStampInToken_RedirectToErrorPa queueConfig.actionName = "QueueAction" url = "http://test.test.com?b=h" cookieProviderMock = UserInQueueStateRepositoryMockClass.new - cookieProviderMock.arrayReturns['getState'].push(StateInfo.new(false, nil, nil, nil)) + cookieProviderMock.arrayReturns['getState'].push(StateInfo.new(false, false, nil, nil, nil)) token = generateHash('e1','queueId', (Time.now.getutc.to_i - (3 * 60)).to_s, 'False', nil, 'queue', key) expectedErrorUrl = "https://testDomain.com/error/timestamp/?c=testCustomer&e=e1" + "&ver=" + UserInQueueService::SDK_VERSION + @@ -214,7 +214,7 @@ def test_ValidateQueueRequest_NoCookie_ExpiredTimeStampInToken_RedirectToErrorPa assert(Time.now.getutc.to_i - timestamp.to_i < 100) urlWithoutTimeStamp = result.redirectUrl.gsub(/&ts=[^&]*/, "") assert(urlWithoutTimeStamp.upcase == expectedErrorUrl.upcase) - assert(cookieProviderMock.expectCallAny('cancelQueueCookie')) + assert(!cookieProviderMock.expectCallAny('cancelQueueCookie')) end def test_ValidateQueueRequest_NoCookie_EventIdMismatch_RedirectToErrorPageWithEventIdMissMatchError_DoNotStoreCookie @@ -228,7 +228,7 @@ def test_ValidateQueueRequest_NoCookie_EventIdMismatch_RedirectToErrorPageWithEv queueConfig.actionName = "QueueAction" url = "http://test.test.com?b=h" cookieProviderMock = UserInQueueStateRepositoryMockClass.new - cookieProviderMock.arrayReturns['getState'].push(StateInfo.new(false, nil, nil, nil)) + cookieProviderMock.arrayReturns['getState'].push(StateInfo.new(false, false, nil, nil, nil)) token = generateHash('e1', 'queueId',(Time.now.getutc.to_i - (3 * 60)).to_s, 'False', nil, 'queue', key) expectedErrorUrl = "https://testDomain.com/error/eventid/?c=testCustomer&e=e2" + "&ver=" + UserInQueueService::SDK_VERSION + "&cver=11" + @@ -247,7 +247,7 @@ def test_ValidateQueueRequest_NoCookie_EventIdMismatch_RedirectToErrorPageWithEv assert(Time.now.getutc.to_i - timestamp.to_i < 100) urlWithoutTimeStamp = result.redirectUrl.gsub(/&ts=[^&]*/, "") assert(urlWithoutTimeStamp.upcase == expectedErrorUrl.upcase) - assert(cookieProviderMock.expectCallAny('cancelQueueCookie')) + assert(!cookieProviderMock.expectCallAny('cancelQueueCookie')) end def test_ValidateQueueRequest_NoCookie_ValidToken_ExtendableCookie_DoNotRedirect_StoreExtendableCookie @@ -262,7 +262,7 @@ def test_ValidateQueueRequest_NoCookie_ValidToken_ExtendableCookie_DoNotRedirect queueConfig.actionName = "QueueAction" url = "http://test.test.com?b=h" cookieProviderMock = UserInQueueStateRepositoryMockClass.new - cookieProviderMock.arrayReturns['getState'].push(StateInfo.new(false, nil, nil, nil)) + cookieProviderMock.arrayReturns['getState'].push(StateInfo.new(false, false, nil, nil, nil)) token = generateHash('e1', 'queueId',(Time.now.getutc.to_i + (3 * 60)).to_s, 'true', nil, 'queue', key) testObject = UserInQueueService.new(cookieProviderMock) @@ -288,7 +288,7 @@ def test_ValidateQueueRequest_NoCookie_ValidToken_CookieValidityMinuteFromToken_ queueConfig.actionName = "QueueAction" url = "http://test.test.com?b=h" cookieProviderMock = UserInQueueStateRepositoryMockClass.new() - cookieProviderMock.arrayReturns['getState'].push(StateInfo.new(false, nil, nil, nil)) + cookieProviderMock.arrayReturns['getState'].push(StateInfo.new(false, false, nil, nil, nil)) token = generateHash('e1', 'queueId',(Time.now.getutc.to_i + (3 * 60)).to_s, 'false', 3, 'DirectLink', key) testObject = UserInQueueService.new(cookieProviderMock) result = testObject.validateQueueRequest(url, token, queueConfig, "testCustomer", key) @@ -301,7 +301,7 @@ def test_ValidateQueueRequest_NoCookie_ValidToken_CookieValidityMinuteFromToken_ assert(!cookieProviderMock.expectCallAny('cancelQueueCookie')) end - def test_NoCookie_NoValidToken_WithoutToken_RedirectToQueue() + def test_ValidateQueueRequest_NoCookie_WithoutToken_RedirectToQueue() key = "4e1db821-a825-49da-acd0-5d376f2068db" queueConfig = QueueEventConfig.new queueConfig.eventId = "e1" @@ -314,7 +314,7 @@ def test_NoCookie_NoValidToken_WithoutToken_RedirectToQueue() queueConfig.actionName = "QueueAction" url = "http://test.test.com?b=h" cookieProviderMock = UserInQueueStateRepositoryMockClass.new() - cookieProviderMock.arrayReturns['getState'].push(StateInfo.new(false, nil, nil, nil)) + cookieProviderMock.arrayReturns['getState'].push(StateInfo.new(false, false, nil, nil, nil)) token = "" expectedRedirectUrl = "https://testDomain.com/?c=testCustomer&e=e1" + "&ver=" + UserInQueueService::SDK_VERSION + "&cver=11" + @@ -329,7 +329,7 @@ def test_NoCookie_NoValidToken_WithoutToken_RedirectToQueue() assert(result.queueId == nil) assert(result.redirectUrl.upcase() == expectedRedirectUrl.upcase()) assert(result.actionName == queueConfig.actionName) - assert(cookieProviderMock.expectCallAny('cancelQueueCookie')) + assert(!cookieProviderMock.expectCallAny('cancelQueueCookie')) end def test_ValidateRequest_NoCookie_WithoutToken_RedirectToQueue_NotargetUrl @@ -344,7 +344,37 @@ def test_ValidateRequest_NoCookie_WithoutToken_RedirectToQueue_NotargetUrl queueConfig.layoutName = 'testlayout' queueConfig.actionName = "QueueAction" cookieProviderMock = UserInQueueStateRepositoryMockClass.new() - cookieProviderMock.arrayReturns['getState'].push(StateInfo.new(false, nil, nil, nil)) + cookieProviderMock.arrayReturns['getState'].push(StateInfo.new(false, false, nil, nil, nil)) + token = "" + expectedRedirectUrl = "https://testDomain.com/?c=testCustomer&e=e1" + + "&ver=" + UserInQueueService::SDK_VERSION + "&cver=11" + + "&man=" + queueConfig.actionName + + "&cid=en-US" + + "&l=testlayout" + testObject = UserInQueueService.new(cookieProviderMock) + result = testObject.validateQueueRequest(nil, token, queueConfig, "testCustomer", key) + assert(!cookieProviderMock.expectCallAny('store')) + assert(result.doRedirect()) + assert(result.eventId == 'e1') + assert(result.queueId == nil) + assert(result.redirectUrl.upcase() == expectedRedirectUrl.upcase()) + assert(result.actionName == queueConfig.actionName) + assert(!cookieProviderMock.expectCallAny('cancelQueueCookie')) + end + + def test_ValidateRequest_InvalidCookie_WithoutToken_RedirectToQueue_CancelCookie + key = "4e1db821-a825-49da-acd0-5d376f2068db" + queueConfig = QueueEventConfig.new + queueConfig.eventId = "e1" + queueConfig.queueDomain = "testDomain.com" + queueConfig.cookieValidityMinute = 10 + queueConfig.extendCookieValidity = true + queueConfig.version = 11 + queueConfig.culture = 'en-US' + queueConfig.layoutName = 'testlayout' + queueConfig.actionName = "QueueAction" + cookieProviderMock = UserInQueueStateRepositoryMockClass.new() + cookieProviderMock.arrayReturns['getState'].push(StateInfo.new(true, false, nil, nil, nil)) token = "" expectedRedirectUrl = "https://testDomain.com/?c=testCustomer&e=e1" + "&ver=" + UserInQueueService::SDK_VERSION + "&cver=11" + @@ -383,7 +413,7 @@ def test_ValidateQueueRequest_NoCookie_InValidToken "&queueittoken=ts_sasa~cv_adsasa~ce_falwwwse~q_944c1f44-60dd-4e37-aabc-f3e4bb1c8895" cookieProviderMock = UserInQueueStateRepositoryMockClass.new - cookieProviderMock.arrayReturns['getState'].push(StateInfo.new(false, nil, nil, nil)) + cookieProviderMock.arrayReturns['getState'].push(StateInfo.new(false, false, nil, nil, nil)) testObject = UserInQueueService.new(cookieProviderMock) result = testObject.validateQueueRequest(url, "ts_sasa~cv_adsasa~ce_falwwwse~q_944c1f44-60dd-4e37-aabc-f3e4bb1c8895", queueConfig, "testCustomer", key) assert(!cookieProviderMock.expectCallAny('store')) @@ -392,9 +422,42 @@ def test_ValidateQueueRequest_NoCookie_InValidToken assert(result.queueId == nil) assert(result.redirectUrl.start_with?(expectedRedirectUrl)) assert(result.actionName == queueConfig.actionName) - assert(cookieProviderMock.expectCallAny('cancelQueueCookie')) + assert(!cookieProviderMock.expectCallAny('cancelQueueCookie')) end + def test_ValidateRequest_InvalidCookie_InvalidToken_CancelCookie + key = "4e1db821-a825-49da-acd0-5d376f2068db" + queueConfig = QueueEventConfig.new + queueConfig.eventId = "e1" + queueConfig.queueDomain = "testDomain.com" + queueConfig.cookieValidityMinute = 10 + queueConfig.extendCookieValidity = true + queueConfig.version = 11 + queueConfig.culture = 'en-US' + queueConfig.layoutName = 'testlayout' + queueConfig.actionName = "QueueAction" + url = "http://test.test.com?b=h" + + expectedRedirectUrl = "https://testDomain.com/error/hash/?c=testCustomer&e=e1" + + "&ver=" + UserInQueueService::SDK_VERSION + "&cver=11" + + "&man=" + queueConfig.actionName + + "&cid=en-US" + + "&l=testlayout" + + "&queueittoken=ts_sasa~cv_adsasa~ce_falwwwse~q_944c1f44-60dd-4e37-aabc-f3e4bb1c8895" + + cookieProviderMock = UserInQueueStateRepositoryMockClass.new + cookieProviderMock.arrayReturns['getState'].push(StateInfo.new(true, false, nil, nil, nil)) + testObject = UserInQueueService.new(cookieProviderMock) + result = testObject.validateQueueRequest(url, "ts_sasa~cv_adsasa~ce_falwwwse~q_944c1f44-60dd-4e37-aabc-f3e4bb1c8895", queueConfig, "testCustomer", key) + assert(!cookieProviderMock.expectCallAny('store')) + assert(result.doRedirect()) + assert(result.eventId == 'e1') + assert(result.queueId == nil) + assert(result.redirectUrl.start_with?(expectedRedirectUrl)) + assert(result.actionName == queueConfig.actionName) + assert(cookieProviderMock.expectCallAny('cancelQueueCookie')) + end + def test_validateCancelRequest cancelConfig = CancelEventConfig.new cancelConfig.eventId = "e1" @@ -404,7 +467,7 @@ def test_validateCancelRequest cancelConfig.actionName = "Cancel Action (._~-&) !*|'\"" url = "http://test.test.com?b=h" cookieProviderMock = UserInQueueStateRepositoryMockClass.new() - cookieProviderMock.arrayReturns['getState'].push(StateInfo.new(true, "queueId", 3, "idle")) + cookieProviderMock.arrayReturns['getState'].push(StateInfo.new(true, true, "queueId", 3, "idle")) expectedUrl = "https://testDomain.com/cancel/testCustomer/e1/?c=testCustomer&e=e1&ver=" + UserInQueueService::SDK_VERSION + "&cver=10&man=" + "Cancel%20Action%20%28._~-%26%29%20%21%2A%7C%27%22" + "&r=" + Utils.urlEncode(url); diff --git a/test/queueit_knownuserv3/test_user_in_queue_state_cookie_repository.rb b/test/queueit_knownuserv3/test_user_in_queue_state_cookie_repository.rb index 251ff29..ac81f32 100644 --- a/test/queueit_knownuserv3/test_user_in_queue_state_cookie_repository.rb +++ b/test/queueit_knownuserv3/test_user_in_queue_state_cookie_repository.rb @@ -305,5 +305,17 @@ def test_getState_validCookieFormat_nonExtendable() assert(state.queueId == queueId) assert(state.redirectType == "idle") end + + def test_getState_noCookie() + eventId = "event1" + secretKey = "4e1deweb821-a82ew5-49da-acdqq0-5d3476f2068db" + + cookieManager = CookieManagerMockClass.new() + testObject = UserInQueueStateCookieRepository.new(cookieManager) + state = testObject.getState(eventId, 10, secretKey, true) + + assert(!state.isFound) + assert(!state.isValid) + end end end \ No newline at end of file