本文整理汇总了Python中pyeloqua.Bulk类的典型用法代码示例。如果您正苦于以下问题:Python Bulk类的具体用法?Python Bulk怎么用?Python Bulk使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Bulk类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_filter_date_badstr_end
def test_filter_date_badstr_end(mock_get):
""" exception when bad datetime string passed - end """
bulk = Bulk(test=True)
bulk.exports('contacts')
mock_get.return_value = Mock(ok=True, status_code=200)
mock_get.return_value.json.return_value = deepcopy(GOOD_CONTACT_FIELDS)
bulk.filter_date(field='created', end='2017-01- 00:00:00')
示例2: test_leadscore_fields_noparams
def test_leadscore_fields_noparams(mock_get):
""" add fields from a lead score model by model name """
bulk = Bulk(test=True)
bulk.exports('contacts')
mock_get.return_value = Mock(ok=True, status_code=200)
mock_get.return_value.json.return_value = deepcopy(LEADSCORE_MODEL_NAME)
bulk.add_leadscore_fields()
示例3: test_start_sync_export_nodef
def test_start_sync_export_nodef(mock_post):
""" except when no job_def """
bulk = Bulk(test=True)
bulk.exports('contacts')
mock_post.return_value = Mock(ok=True, status_code=200)
mock_post.return_value.json.return_value = deepcopy(SYNC_RESPONSE)
bulk.start_sync()
示例4: test_add_fields_actvty
def test_add_fields_actvty():
""" add some activity fields """
bulk = Bulk(test=True)
bulk.exports('activities', act_type='EmailOpen')
fields = ['ActivityId', 'AssetId']
bulk.add_fields(fields)
assert len(bulk.job['fields']) == 2
示例5: test_writebulkjob
def test_writebulkjob(mock_dump):
""" ensure job def calls json.dump """
bulk = Bulk(test=True)
bulk.job = JOB_EXPORTS_CONTACTS
mock_dump.return_value = None
bulk.write_job('/tmp/pyeloqua_test_bulk_write.json')
assert mock_dump.called
示例6: test_asset_exists_list_none
def test_asset_exists_list_none(mock_get):
""" add exists filter - exception on no params """
bulk = Bulk(test=True)
bulk.exports('contacts')
mock_get.return_value = Mock(ok=True, status_code=200)
mock_get.return_value.json.return_value = deepcopy(GOOD_LIST_NAME)
bulk.asset_exists(asset='lists')
示例7: test_option_add_all
def test_option_add_all():
""" add several random options """
bulk = Bulk(test=True)
bulk.exports('contacts')
bulk.add_options(identifierFieldName='C_EmailAddress',
areSystemTimestampsInUTC=True)
assert len(bulk.job['options']) == 2
示例8: test_leadscore_fields_name
def test_leadscore_fields_name(mock_get):
""" add fields from a lead score model by model name """
bulk = Bulk(test=True)
bulk.exports('contacts')
mock_get.return_value = Mock(ok=True, status_code=200)
mock_get.return_value.json.return_value = deepcopy(LEADSCORE_MODEL_NAME)
bulk.add_leadscore_fields(name='Model 1')
assert bulk.job['fields'] == LEADSCORE_MODEL_FIELDS
示例9: test_event_lnk_cntct_fields
def test_event_lnk_cntct_fields(mock_get):
""" add some linked contact fields to event """
bulk = Bulk(test=True)
bulk.exports('events', 1)
mock_get.return_value = Mock(ok=True, status_code=200)
mock_get.return_value.json.return_value = deepcopy(GOOD_FIELDS)
bulk.add_linked_fields('contacts', ['C_EmailAddress', 'C_FirstName'])
assert bulk.job['fields'] == LINKED_EVENT_CONTACT_FIELDS
示例10: test_cntct_lnk_acct_fields
def test_cntct_lnk_acct_fields(mock_get):
""" add some linked account fields """
bulk = Bulk(test=True)
bulk.exports('contacts')
mock_get.return_value = Mock(ok=True, status_code=200)
mock_get.return_value.json.return_value = deepcopy(GOOD_FIELDS_ACCOUNT)
bulk.add_linked_fields('accounts', ['M_CompanyName', 'M_Country'])
assert bulk.job['fields'] == LINKED_ACCOUNT_FIELDS
示例11: test_accnt_system_fields_set
def test_accnt_system_fields_set(mock_get):
""" add some account system fields """
bulk = Bulk(test=True)
bulk.exports('accounts')
mock_get.return_value = Mock(ok=True, status_code=200)
mock_get.return_value.json.return_value = deepcopy(GOOD_FIELDS)
bulk.add_fields(['accountID', 'createdAt'])
assert len(bulk.job['fields']) == 2
示例12: test_add_fields_notfound
def test_add_fields_notfound(mock_get):
""" raise exception when field not found """
bulk = Bulk(test=True)
bulk.exports('contacts')
mock_get.return_value = Mock(ok=True, status_code=200)
mock_get.return_value.json.return_value = deepcopy(GOOD_FIELDS)
fields = ['C_EmailAddress', 'C_FirstName', 'C_LastName']
bulk.add_fields(fields)
示例13: test_get_fields_specify
def test_get_fields_specify(mock_get):
""" specify elq_object to return fields for """
bulk = Bulk(test=True)
bulk.exports('accounts')
mock_get.return_value = Mock(ok=True, status_code=200)
mock_get.return_value.json.return_value = deepcopy(GOOD_FIELDS)
fields = bulk.get_fields(elq_object='contacts')
assert fields == ALL_CONTACT_FIELDS
示例14: test_create_imports_error
def test_create_imports_error(mock_post):
""" raise exception on bad import def """
bulk = Bulk(test=True)
bulk.job = JOB_IMPORTS_CONTACTS_BAD
mock_post.return_value = Mock(ok=True, status_code=400)
mock_post.return_value.json.return_value = deepcopy(
IMPORT_JOB_RESPONSE_BAD)
bulk.create_def('test name')
示例15: test_get_export_data_rt
def test_get_export_data_rt(mock_data):
""" get data from a synced export - return data """
bulk = Bulk(test=True)
bulk.exports('contacts')
bulk.job_def = EXPORT_JOB_DEF
mock_data.return_value = RETURN_DATA['items']
data = bulk.get_export_data()
assert data == RETURN_DATA['items']