def test_irisV2_createAudience_Derived_ExistingListName(self): label = 'Automation_ExistingList_check_{}'.format( int(time.time() * 1000)) CreateAudience.derivedList('LIVE', 'ORG', label=label, derivedListInfo={ 'includedGroups': ['UPLOAD', 'LOYALTY'], 'excludedGroup': ['LOYALTY'], 'noOfUserUpload': 5 }) listDetail = CreateAudience.derivedList('LIVE', 'ORG', label=label, derivedListInfo={ 'includedGroups': ['UPLOAD', 'LOYALTY'], 'excludedGroup': ['LOYALTY'], 'noOfUserUpload': 5 }) CreateAudience.assertResponse( listDetail['RESPONSE'], 400, 5003, ['invalid request : Audience label already exits'])
def test_irisV2_createAudience_Derived_IncludeList_ExcludeList_MoreThan10Lists_NegativeCases( self, description, derivedListInfo, popfield, statusCode, errorCode, errorDescription): list = CreateAudience.derivedList('LIVE', 'ORG', updateNode=True, lockNode=True, campaignCheck=False, derivedListInfo=derivedListInfo, popFields=popfield) CreateAudience.assertResponse(list['RESPONSE'], statusCode, errorCode, errorDescription)
def test_irisV2_createAudience_Derived_Include_SMS( self, description, campaignType, testControlType, listType, derivedListInfo, popfield): list = CreateAudience.derivedList(campaignType, testControlType, campaignCheck=False, derivedListInfo=derivedListInfo, popFields=popfield) CreateAudience.waitForGVDToBeUpdated(list['ID']) CreateAudienceDBAssertion(list['ID'], list, listType, list['expectedUserCount'], reachabilityCheck=True).check()
def test_irisV2_createAudience_Derived_IncludeExcludeList_WithInvalidIdInExcludeGroup_NegativeCases( self): payload = copy.deepcopy(constant.payload['derivedlist']) payload['includedGroups'] = [self.listId_1, self.listId_2] payload['excludedGroups'] = [99999] list = CreateAudience.derivedList('LIVE', 'ORG', updateNode=True, lockNode=True, campaignCheck=False, payload=payload) CreateAudience.assertResponse( list['RESPONSE'], 400, 5004, ['invalid audience group : audience groups not exists: [99999]'])
def test_irisV2_createAudience_Derived_IncludeExcludeList_WithSameIdInExcludeIncludeGroup_NegativeCases( self): payload = copy.deepcopy(constant.payload['derivedlist']) payload['includedGroups'] = [self.listId_1, self.listId_2] payload['excludedGroups'] = [self.listId_1] list = CreateAudience.derivedList('LIVE', 'ORG', updateNode=True, lockNode=True, campaignCheck=False, payload=payload) CreateAudience.assertResponse(list['RESPONSE'], 400, 5006, [ 'invalid request : groups added in both include and exclude : [{}]' .format(self.listId_1) ])
def test_irisV2_createAudience_Derived_IncludeList_WithoutFieldInPayload_NegativeCases( self, description, payloadChange, statusCode, errorCode, errorDescription): payload = copy.deepcopy(constant.payload['derivedlist']) payload.pop('excludedGroups') payload['includedGroups'] = [self.listId_1, self.listId_2] payload.pop(payloadChange) list = CreateAudience.derivedList('LIVE', 'ORG', updateNode=True, lockNode=True, campaignCheck=False, payload=payload) CreateAudience.assertResponse(list['RESPONSE'], statusCode, errorCode, errorDescription)
def test_irisV2_createAudience_Derived_IncludeList_SameListIdIncludedGroups_NegativeCases( self): payload = copy.deepcopy(constant.payload['derivedlist']) payload.pop('excludedGroups') payload['includedGroups'] = [self.listId_1, self.listId_1] list = CreateAudience.derivedList('LIVE', 'ORG', updateNode=True, lockNode=True, campaignCheck=False, payload=payload) CreateAudience.assertResponse(list['RESPONSE'], 400, 5006, [ 'invalid request : include groups contains duplicate', 'invalid request : combine include and exclude groups size should be minimum 2' ])
def test_irisV2_createAudience_Derived_Include_Exclude_DifferentChannels( self, description, campaignType, testControlType, listType, derivedListInfo, schemaIdentifier, popfield): list = CreateAudience.derivedList(campaignType, testControlType, schemaIdentifier=[schemaIdentifier], newUser=False, campaignCheck=False, derivedListInfo=derivedListInfo, popFields=popfield) CreateAudience.waitForGVDToBeUpdated(list['ID']) CreateAudienceDBAssertion(list['ID'], list, listType, list['expectedUserCount'], reachabilityCheck=False).check()
def test_irisV2_createAudience_Derived_IncludeList_InvalidFieldIncludedGroups_NegativeCases( self, description, payloadChange, statusCode, errorCode, errorDescription): payload = copy.deepcopy(constant.payload['derivedlist']) payload['includedGroups'] = [self.listId_1, self.listId_2] for eachKey in payload: if eachKey in payloadChange: value = payload[eachKey] payload.pop(eachKey) payload[payloadChange[eachKey]] = value list = CreateAudience.derivedList('LIVE', 'ORG', updateNode=True, lockNode=True, campaignCheck=False, payload=payload) CreateAudience.assertResponse(list['RESPONSE'], statusCode, errorCode, errorDescription)
def test_irisV2_createAudience_Derived_WithLabelLengthGretaerThan50Charecters_NegativeCases( self): label = 'Automation_ExistingList_checkkkkkkkkkkkkkk_{}'.format( int(time.time() * 1000)) listDetail = CreateAudience.derivedList('LIVE', 'ORG', label=label * 3, derivedListInfo={ 'includedGroups': ['UPLOAD', 'LOYALTY'], 'excludedGroup': ['LOYALTY'], 'noOfUserUpload': 5 }) CreateAudience.assertResponse(listDetail['RESPONSE'], 400, 102, [ 'Invalid request : Invalid audience name. Name exceeds 160 characters. ' ])
def test_irisV2_createAudience_Derived_WithSpecialCharecters(self): label = '~!@#$%^&*)(_{}'.format(int(time.time() * 1000)) list = CreateAudience.derivedList('LIVE', 'ORG', label=label, derivedListInfo={ 'includedGroups': ['UPLOAD', 'UPLOAD', 'LOYALTY'], 'excludedGroup': ['LOYALTY'], 'noOfUserUpload': 5 }) CreateAudience.waitForGVDToBeUpdated(list['ID']) CreateAudienceDBAssertion(list['ID'], list, 'DERIVED', list['expectedUserCount'], reachabilityCheck=True).check()
def getListInfo(campaignType, testControlType, listType, schemaIdentifier, newUser, derivedListInfo): if schemaIdentifier.upper() == 'MOBILE_PUSH': return CreateAudience.uploadList(campaignType, testControlType, schemaIdentifier=['USER_ID'], schemaData=['USER_ID'], newUser=newUser, updateNode=True, lockNode=True, campaignCheck=False, mobilePush=True) if listType == 'UPLOAD': return CreateAudience.uploadList( campaignType, testControlType, schemaIdentifier=[schemaIdentifier], schemaData=[schemaIdentifier, 'FIRST_NAME'], newUser=newUser, campaignCheck=False) elif listType == 'LOYALTY': return CreateAudience.FilterList( campaignType, testControlType, schemaIdentifier=[schemaIdentifier], campaignCheck=False) elif listType == 'DERIVED': return CreateAudience.derivedList( campaignType, testControlType, schemaIdentifier=[schemaIdentifier], newUser=newUser, campaignCheck=False, derivedListInfo=derivedListInfo) elif listType == 'ORG_USERS': return CreateAudience.stickyList( campaignType, testControlType, schemaIdentifier=[schemaIdentifier], campaignCheck=False, stickyInfo=derivedListInfo) else: raise Exception( 'ListTypeNotSupportedException:{}'.format(listType))