Ejemplo n.º 1
0
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']
Ejemplo n.º 2
0
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']
Ejemplo n.º 3
0
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')
Ejemplo n.º 4
0
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')
Ejemplo n.º 5
0
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
Ejemplo n.º 6
0
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
Ejemplo n.º 7
0
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
Ejemplo n.º 8
0
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
Ejemplo n.º 9
0
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
Ejemplo n.º 10
0
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
Ejemplo n.º 11
0
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)
Ejemplo n.º 12
0
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)