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_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)
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_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