def test_get_sync_rejects_rt(mock_data): """ get logs from a sync - return data """ bulk = Bulk(test=True) bulk.exports('contacts') bulk.job_sync = SYNC_RESPONSE_SUCCESS mock_data.return_value = RETURN_SYNC_REJECTS['items'] data = bulk.get_sync_rejects() assert data == RETURN_SYNC_REJECTS['items']
def test_get_sync_rejects_rt(mock_data): """ get logs from a sync - return data """ bulk = Bulk(test=True) bulk.exports('contacts') bulk.job_sync = SYNC_RESPONSE_SUCCESS mock_data.return_value = RETURN_SYNC_REJECTS['items'] data = bulk.get_sync_rejects() assert data == RETURN_SYNC_REJECTS['items']
def test_get_sync_rejects_call(mock_data): """ get logs from a sync - method call """ bulk = Bulk(test=True) bulk.exports('contacts') bulk.job_sync = SYNC_RESPONSE_SUCCESS mock_data.return_value = RETURN_SYNC_REJECTS['items'] bulk.get_sync_rejects() mock_data.assert_called_with(endpoint='/syncs/1/rejects')
def test_get_sync_rejects_call(mock_data): """ get logs from a sync - method call """ bulk = Bulk(test=True) bulk.exports('contacts') bulk.job_sync = SYNC_RESPONSE_SUCCESS mock_data.return_value = RETURN_SYNC_REJECTS['items'] bulk.get_sync_rejects() mock_data.assert_called_with(endpoint='/syncs/1/rejects')
def test_check_sync_error(mock_get): """ check on status of 'error' sync - return True """ bulk = Bulk(test=True) bulk.exports('contacts') bulk.job_sync = SYNC_RESPONSE mock_get.return_value = Mock(ok=True, status_code=200) mock_get.return_value.json.return_value = SYNC_RESPONSE_ERROR status = bulk.check_sync() assert status is True
def test_check_sync_notfinished(mock_get): """ check on status of 'active' sync - return False """ bulk = Bulk(test=True) bulk.exports('contacts') bulk.job_sync = SYNC_RESPONSE mock_get.return_value = Mock(ok=True, status_code=200) mock_get.return_value.json.return_value = SYNC_RESPONSE_ACTIVE status = bulk.check_sync() assert status is False
def test_check_sync_update(mock_get): """ check on status of 'active' sync - update job_sync """ bulk = Bulk(test=True) bulk.exports('contacts') bulk.job_sync = SYNC_RESPONSE mock_get.return_value = Mock(ok=True, status_code=200) mock_get.return_value.json.return_value = SYNC_RESPONSE_ACTIVE bulk.check_sync() assert bulk.job_sync == SYNC_RESPONSE_ACTIVE
def test_check_sync_error(mock_get): """ check on status of 'error' sync - return True """ bulk = Bulk(test=True) bulk.exports('contacts') bulk.job_sync = SYNC_RESPONSE mock_get.return_value = Mock(ok=True, status_code=200) mock_get.return_value.json.return_value = SYNC_RESPONSE_ERROR status = bulk.check_sync() assert status is True
def test_check_sync_notfinished(mock_get): """ check on status of 'active' sync - return False """ bulk = Bulk(test=True) bulk.exports('contacts') bulk.job_sync = SYNC_RESPONSE mock_get.return_value = Mock(ok=True, status_code=200) mock_get.return_value.json.return_value = SYNC_RESPONSE_ACTIVE status = bulk.check_sync() assert status is False
def test_check_sync_update(mock_get): """ check on status of 'active' sync - update job_sync """ bulk = Bulk(test=True) bulk.exports('contacts') bulk.job_sync = SYNC_RESPONSE mock_get.return_value = Mock(ok=True, status_code=200) mock_get.return_value.json.return_value = SYNC_RESPONSE_ACTIVE bulk.check_sync() assert bulk.job_sync == SYNC_RESPONSE_ACTIVE
def test_check_sync_call(mock_get): """ check on status of 'active' sync - api call """ bulk = Bulk(test=True) bulk.exports('contacts') bulk.job_sync = SYNC_RESPONSE mock_get.return_value = Mock(ok=True, status_code=200) mock_get.return_value.json.return_value = SYNC_RESPONSE_ACTIVE bulk.check_sync() mock_get.assert_called_with(url=bulk.bulk_base + '/syncs/1', auth=bulk.auth)
def test_check_sync_call(mock_get): """ check on status of 'active' sync - api call """ bulk = Bulk(test=True) bulk.exports('contacts') bulk.job_sync = SYNC_RESPONSE mock_get.return_value = Mock(ok=True, status_code=200) mock_get.return_value.json.return_value = SYNC_RESPONSE_ACTIVE bulk.check_sync() mock_get.assert_called_with(url=bulk.bulk_base + '/syncs/1', auth=bulk.auth)