Beispiel #1
0
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()
Beispiel #2
0
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()
Beispiel #3
0
def test_start_sync_export_add(mock_post):
    """ start syncing an export - add to Bulk """
    bulk = Bulk(test=True)
    bulk.exports('contacts')
    bulk.job_def = EXPORT_JOB_DEF
    mock_post.return_value = Mock(ok=True, status_code=200)
    mock_post.return_value.json.return_value = deepcopy(SYNC_RESPONSE)
    bulk.start_sync()
    assert bulk.job_sync == SYNC_RESPONSE
Beispiel #4
0
def test_start_sync_export_add(mock_post):
    """ start syncing an export - add to Bulk """
    bulk = Bulk(test=True)
    bulk.exports('contacts')
    bulk.job_def = EXPORT_JOB_DEF
    mock_post.return_value = Mock(ok=True, status_code=200)
    mock_post.return_value.json.return_value = deepcopy(SYNC_RESPONSE)
    bulk.start_sync()
    assert bulk.job_sync == SYNC_RESPONSE
Beispiel #5
0
def test_start_sync_export(mock_post):
    """ start syncing an export - api call """
    bulk = Bulk(test=True)
    bulk.exports('contacts')
    bulk.job_def = EXPORT_JOB_DEF
    mock_post.return_value = Mock(ok=True, status_code=200)
    mock_post.return_value.json.return_value = deepcopy(SYNC_RESPONSE)
    bulk.start_sync()
    mock_post.assert_called_with(url=bulk.bulk_base + '/syncs',
                                 auth=bulk.auth,
                                 data=dumps(
                                     {
                                         "syncedInstanceUri": "/contacts/exports/1"
                                     },
                                 ensure_ascii=False).encode('utf8'),
                                 headers=POST_HEADERS)
Beispiel #6
0
def test_start_sync_export(mock_post):
    """ start syncing an export - api call """
    bulk = Bulk(test=True)
    bulk.exports('contacts')
    bulk.job_def = EXPORT_JOB_DEF
    mock_post.return_value = Mock(ok=True, status_code=200)
    mock_post.return_value.json.return_value = deepcopy(SYNC_RESPONSE)
    bulk.start_sync()
    mock_post.assert_called_with(
        url=bulk.bulk_base + '/syncs',
        auth=bulk.auth,
        data=dumps({
            "syncedInstanceUri": "/contacts/exports/1"
        },
                   ensure_ascii=False).encode('utf8'),
        headers=POST_HEADERS)