예제 #1
0
def perform_import():
    log.info('Clearing models')
    clear_models()

    objstore = ObjectStore(config=settings.OBJECTSTORE_CONNECTION_CONFIG)

    log.info('Opening object store connection')
    connection = objstore.get_connection()

    log.info('Getting documents list')
    document_list = objstore.get_wba_documents_list(connection)
    log.info(f'document list size: {len(document_list)}')

    log.info('Fetching xls file')
    xls_path = objstore.fetch_spots(connection)
    log.info('Importing xls file')
    process_xls(xls_path, document_list)

    log.info(f'Spot count: {Spot.objects.all().count()}')
    log.info(f'Document count: {Document.objects.all().count()}')
예제 #2
0
 def test_fetch_spots(self, mocked_get_file):
     objstore = ObjectStore(config='this is the config')
     objstore.fetch_spots(connection='test connection')
     mocked_get_file.assert_called_with('test connection',
                                        WBA_CONTAINER_NAME, XLS_OBJECT_NAME)