Example #1
0
    def validateCronInfo(self):
        mapOfVariantWithCron = self.getCronInfoWithVariants()
        Logger.log('MapOfVariantWithStatus :{}'.format(mapOfVariantWithCron))
        for eachVariant in mapOfVariantWithCron:
            if mapOfVariantWithCron[eachVariant] is None:
                Assertion.addValidationMessage(
                    'For VariantId :{} cronInfo not Found'.format(eachVariant))

            Assertion.constructAssertion(
                mapOfVariantWithCron[eachVariant]['status'] in self.cronStatus,
                'Actual CronStatus is {} for varient :{} and expected :{}'.
                format(mapOfVariantWithCron[eachVariant]['status'],
                       eachVariant, self.cronStatus))
Example #2
0
    def assertCampaignGroupRecipient(self):
        for eachUniqueHashId in self.hashLookupDetails:
            numberOfTestDataInCGR = dbCallsList.getCampaignGroupRecipient(
                self.groupVersionDetailResult['TEST']['bucket_id'],
                self.groupVersionDetailResult['TEST']['id'], eachUniqueHashId)
            Assertion.constructAssertion(
                numberOfTestDataInCGR[eachUniqueHashId]['userCount'] ==
                self.groupVersionDetailResult['TEST']['customer_count'],
                'Number Of Test Users in CGR :{} and expected :{}'.format(
                    numberOfTestDataInCGR[eachUniqueHashId]['userCount'],
                    self.groupVersionDetailResult['TEST']['customer_count']))
            reachabilityStatusForTestuser = self.getReachabilityStatus(
                numberOfTestDataInCGR[eachUniqueHashId]
                ['reachability_type_id'])
            if constant.config['cluster'] == 'staging':
                Assertion.constructAssertion(
                    reachabilityStatusForTestuser in ['SUBSCRIBED', None],
                    'Reachability Status of Test Users :{}'.format(
                        reachabilityStatusForTestuser))
                if reachabilityStatusForTestuser is None:
                    Assertion.addValidationMessage(
                        'Reachability Id is {} for hashId :{}'.format(
                            reachabilityStatusForTestuser, eachUniqueHashId))
            else:
                Assertion.constructAssertion(
                    reachabilityStatusForTestuser == 'SUBSCRIBED',
                    'Reachability Status of Test Users :{}'.format(
                        reachabilityStatusForTestuser))

            testControlCount = dbCallsList.getCampaignGroupRecipientTestControlCount(
                self.groupVersionDetailResult['TEST']['bucket_id'],
                self.groupVersionDetailResult['TEST']['id'], eachUniqueHashId)
            Assertion.constructAssertion(
                testControlCount[1] == self.numberOfTestUsers,
                'Test Users in CGR :{} and as per secretA :{}'.format(
                    testControlCount[1], self.numberOfTestUsers))
            if 0 in testControlCount:
                Assertion.constructAssertion(
                    testControlCount[0] == self.numberOfControlUsers,
                    'Control Users in CGR :{} and as per secretA :{}'.format(
                        testControlCount[0], self.numberOfControlUsers))
Example #3
0
                "orgId": int(constant.config['orgId']),
                "bulkCredits": int(credit),
                'messageClass': messageClass
            }
            creditDetails1 = NSAdminObject.OrgCreditDetails(creditDetails1)
            if credit == 0:
                currVal = nsObj.getCreditDetailsByOrgAndChannel(constant.config['orgId'], messageClass, 'test_{}'.format(int(time.time())))
                currVal = int(currVal.bulkCredits) * -1
                creditDetails1.bulkCredits = currVal
            nsObj.addCredits(creditDetails1)
        except Exception,exp:
            raise Exception('NotAbleToUpdateCreditTo:{}'.format(credit))
            Logger.log(exp)
        finally:
            if IrisHelper.logCurrentCredit(messageClass) != credit:
                Assertion.addValidationMessage('Credit Not Set as Expected')


    @staticmethod
    def logCurrentCredit(messageClass):
        nsObj = NSAdminHelper.getConnObj(newConnection=True)
        currVal = nsObj.getCreditDetailsByOrgAndChannel(constant.config['orgId'], messageClass,
                                                        'test_{}'.format(int(time.time())))
        Logger.log('Current Credit :{}'.format(currVal.bulkCredits))
        return int(currVal.bulkCredits)

    @staticmethod
    def getDomainGatewayMapId(messageClass='SMS'):
        nsObj = NSAdminHelper.getConnObj(newConnection=True)
        domainGateway = nsObj.getDomainPropertiesGatewayMapByOrg(int(constant.config['orgId']),
                                                                 NSAdminObject.MessageClass[messageClass])[0]