Esempio n. 1
0
def test_pop_flowcell_no_flowcell_requested(mock_store, mock_pdc):
    """tests pop_flowcell method of the backup api"""
    # GIVEN status-db needs to be checked for flowcells to be retrieved from PDC
    backup_api = BackupApi(
        mock_store, mock_pdc, max_flowcells_on_disk=1250, root_dir="/path/to/root_dir"
    )

    # WHEN there are no flowcells requested to be retrieved from PDC
    mock_store.flowcells(status="requested").first.return_value = None

    popped_flowcell = backup_api.pop_flowcell(dry_run=False)

    # THEN no flowcell is returned
    assert popped_flowcell is None
Esempio n. 2
0
def test_pop_flowcell_dry_run(mock_store, mock_pdc, mock_flowcell):
    """tests pop_flowcell method of the backup api"""
    # GIVEN status-db needs to be checked for flowcells to be retrieved from PDC
    backup_api = BackupApi(
        mock_store, mock_pdc, max_flowcells_on_disk=1250, root_dir="/path/to/root_dir"
    )

    # WHEN a flowcell is requested to be retrieved from PDC
    # AND it's a  dry run
    popped_flowcell = backup_api.pop_flowcell(dry_run=True)

    # THEN a flowcell is returned, the status is set to "processing", but status-db is NOT updated with
    # the new status
    assert popped_flowcell is not None
    assert not mock_store.commit.called
Esempio n. 3
0
def test_pop_flowcell_next_requested(mock_store, mock_pdc, mock_flowcell):
    """tests pop_flowcell method of the backup api"""
    # GIVEN status-db needs to be checked for flowcells to be retrieved from PDC
    backup_api = BackupApi(
        mock_store, mock_pdc, max_flowcells_on_disk=1250, root_dir="/path/to/root_dir"
    )

    # WHEN a flowcell is requested to be retrieved from PDC
    mock_store.flowcells(status="requested").first.return_value = mock_flowcell

    popped_flowcell = backup_api.pop_flowcell(dry_run=False)

    # THEN a flowcell is returned, the status is set to "processing", and status-db is updated with
    # the new status
    assert popped_flowcell is not None