def test_veneno_rateLimitsss_dailyLimitExceed(self, listType): self.listId = self.testObjectForRateLimit['list'][listType]['groupDetails']['id'] authorizeResult = VenenoHelper.authorizeForRateLimit(self, listType) authorize.assertAuthorize(authorizeResult['authorizeResponse'], 200) communicationDetailId ,communicationDetailBucketId, communicationDetailExpectedCount=authorize.assertMessageQueueAndGetCommunicationDetailsForReferenceMessageQueueId(self.campaignId,authorizeResult['groupVersionResult']['TEST']['id'],authorizeResult['messageId']) VenenoDBAssertion(self.campaignId, 'SMS', communicationDetailId, authorizeResult['groupVersionResult']['TEST']['customer_count'], authorizeResult['groupVersionResult']['TEST']['id'], authorizeResult['payload']['message'],testControlType='custom',skippedReasons=['rate limit crossed for user']).check() authorize.assertUserPresenceInSkippedTable(communicationDetailId, communicationDetailBucketId, constant.config['skipped_errors']['RATE_LIMIT_ERROR'], 'rate limit crossed for user') authorize.dbAssertRateLimitStats(self.testObjectForRateLimit['list'][listType]['campaignGroupRecipients']['TEST'], {'DAILY':1, 'WEEKLY':1, 'MONTHLY':1})
def test_veneno_rateLimitsss_allStrategySatisified_sms_sanity(self, listType): self.listId = self.testObjectForRateLimit['list'][listType]['groupDetails']['id'] authorizeResult = VenenoHelper.authorizeForRateLimit(self, listType) authorize.assertAuthorize(authorizeResult['authorizeResponse'], 200) communicationDetailId ,communicationDetailBucketId ,communicationDetailExpectedCount=authorize.assertMessageQueueAndGetCommunicationDetailsForReferenceMessageQueueId(self.campaignId,authorizeResult['groupVersionResult']['TEST']['id'],authorizeResult['messageId']) VenenoDBAssertion(self.campaignId, 'SMS', communicationDetailId, authorizeResult['groupVersionResult']['TEST']['customer_count'], authorizeResult['groupVersionResult']['TEST']['id'], authorizeResult['payload']['message'],testControlType='custom').check() authorize.assertUserPresenceInNsAdminTable(communicationDetailId , communicationDetailBucketId, int(communicationDetailExpectedCount)) authorize.dbAssertRateLimitStats(self.testObjectForRateLimit['list'][listType]['campaignGroupRecipients']['TEST'], {'DAILY':1, 'WEEKLY':1, 'MONTHLY':1})
def test_veneno_rateLimit_reconfig_allStrategySatisified_StatsUpdateCheck(self, listType): VenenoHelper.setupStrategy(daily=3, weekly=3, monthly=3) self.listId = self.testObjectForRateLimit['list'][listType]['groupDetails']['id'] authorizeResult = VenenoHelper.authorizeForRateLimit(self, listType) communicationDetailId ,communicationDetailBucketId ,communicationDetailExpectedCount=authorize.assertMessageQueueAndGetCommunicationDetailsForReferenceMessageQueueId(self.campaignId,authorizeResult['groupVersionResult']['TEST']['id'],authorizeResult['messageId']) VenenoDBAssertion(self.campaignId, 'SMS', communicationDetailId, authorizeResult['groupVersionResult']['TEST']['customer_count'], authorizeResult['groupVersionResult']['TEST']['id'], authorizeResult['payload']['message'],testControlType='custom').check() authorize.assertUserPresenceInNsAdminTable(communicationDetailId , communicationDetailBucketId, int(communicationDetailExpectedCount)) authorize.dbAssertRateLimitStats(self.testObjectForRateLimit['list'][listType]['campaignGroupRecipients']['TEST'], {'DAILY':3, 'WEEKLY':3, 'MONTHLY':3})
def test_veneno_rateLimit_SetWithSomeNegativeValue(self, listType): VenenoHelper.setupStrategy(daily=-1, weekly=-1, monthly=-1) VenenoHelper.updateWindowValueToByPassStrategy(self.testObjectForRateLimit['list'][listType]['campaignGroupRecipients']['TEST'], 'MONTHLY') self.listId = self.testObjectForRateLimit['list'][listType]['groupDetails']['id'] authorizeResult = VenenoHelper.authorizeForRateLimit(self, listType) communicationDetailId ,communicationDetailBucketId, communicationDetailExpectedCount=authorize.assertMessageQueueAndGetCommunicationDetailsForReferenceMessageQueueId(self.campaignId,authorizeResult['groupVersionResult']['TEST']['id'],authorizeResult['messageId']) VenenoDBAssertion(self.campaignId, 'SMS', communicationDetailId, authorizeResult['groupVersionResult']['TEST']['customer_count'], authorizeResult['groupVersionResult']['TEST']['id'], authorizeResult['payload']['message'],testControlType='custom',skippedReasons=['rate limit crossed for user']).check() authorize.assertUserPresenceInSkippedTable(communicationDetailId, communicationDetailBucketId, constant.config['skipped_errors']['RATE_LIMIT_ERROR'], 'rate limit crossed for user') authorize.dbAssertRateLimitStats(self.testObjectForRateLimit['list'][listType]['campaignGroupRecipients']['TEST'], {'DAILY':3, 'WEEKLY':2, 'MONTHLY':1})