Ejemplo n.º 1
0
def test_get_product(snapshot: Snapshot) -> None:
    post_item: PostItem = {
        "url": "tests/product_page.html",
        "type": "silver-black/140 \" ″'MM",
        "qty": 1,
        "pa": "",
    }
    html = load_test_product_page_html(post_item["url"])
    document = lxml.html.document_fromstring(html)
    product = bc.get_product(document, post_item)
    snapshot.assert_match(product)
Ejemplo n.º 2
0
def test_parse_config(snapshot: Snapshot, config_raw: dict):
    """
        tests the function parse_config against a snapshot
    """
    # GIVEN the raw MIP analysis config file

    # WHEN getting the files used to build the bundle
    mip_rna_parse_config = store_mip.parse_config(config_raw)

    # THEN the result should contain the data to be stored in Housekeeper
    snapshot.assert_match(mip_rna_parse_config)
Ejemplo n.º 3
0
def test_dry_sample(cli_runner, base_context, microbial_sample_id,
                    snapshot: Snapshot):
    """Test working dry command for sample"""
    # GIVEN

    # WHEN dry running a sample name
    result = cli_runner.invoke(config_case, ["--dry", microbial_sample_id],
                               obj=base_context)

    # THEN command should give us a json dump
    assert result.exit_code == EXIT_SUCCESS
    snapshot.assert_match(result.output)
Ejemplo n.º 4
0
def test_parse_files(mock_missing, snapshot: Snapshot, deliverables_raw: dict):
    """
        tests the function parse_files against a snapshot
    """
    # GIVEN the a MIP analysis deliverables file
    mock_missing.return_value = False, []
    pipeline = "wts"

    # WHEN getting the files used to build the bundle
    mip_files = store_base.parse_files(deliverables_raw, pipeline)

    # THEN the result should contain the data to be stored in Housekeeper
    snapshot.assert_match(mip_files)
Ejemplo n.º 5
0
def test_parse_sampleinfo_data(snapshot: Snapshot, files_raw):
    """
        tests the function parse_sampleinfo_data against a snapshot
    """
    # GIVEN the raw MIP sample info file

    rna_sampleinfo = files_raw["rna_sampleinfo"]

    # WHEN getting the smaple info used to build the bundle
    mip_rna_parse_sampleinfo = store_mip.parse_sampleinfo(rna_sampleinfo)

    # THEN the result should contain the data to be stored in Housekeeper
    snapshot.assert_match(mip_rna_parse_sampleinfo)
Ejemplo n.º 6
0
def test_sample(cli_runner, base_context, microbial_sample_id, queries_path,
                snapshot: Snapshot):
    """Test working command for sample"""

    # GIVEN an existing queries path
    Path(queries_path).mkdir(exist_ok=True)

    # WHEN dry running a sample name
    result = cli_runner.invoke(config_case, [microbial_sample_id],
                               obj=base_context)

    # THEN command should give us a json dump
    assert result.exit_code == EXIT_SUCCESS
    outfilename = queries_path / microbial_sample_id
    outfilename = outfilename.with_suffix(".json")
    with open(outfilename, "r") as outputfile:
        snapshot.assert_match(outputfile.readlines())
Ejemplo n.º 7
0
def test_parse_sampleinfo_rna_result_contents(snapshot: Snapshot,
                                              files_raw: dict):
    """test parse_sampleinfo_rna using snapshot

       Note: to retake all snapshots run `pytest --snapshot-update`

       Args:
           snapshot (Snapshot): a file with a snapshot of the correct test result, see
           cg/cg/tests/snapshots/snap_test_apps_mip_files.py
           files_raw (dict): dict of raw .yaml files
    """
    # GIVEN an RNA sample info file
    sampleinfo_raw = files_raw["rna_sampleinfo"]

    # WHEN parsing the file
    sampleinfo_data = files.parse_sampleinfo_rna(sampleinfo_raw)

    # THEN the result should contains the data as specified by the MIP team
    snapshot.assert_match(sampleinfo_data)
Ejemplo n.º 8
0
def test_build_bundle(
    mock_missing,
    mock_parse_files,
    snapshot: Snapshot,
    config_data: dict,
    sampleinfo_data: dict,
    deliverables_raw: dict,
):
    """
        tests the function_build bundle against a snapshot
    """
    # GIVEN the MIP analysis config data, the sampleinfo data and the deliverables file

    # WHEN building the bundle
    mock_missing.return_value = False, []
    mock_parse_files.return_value = ["mock of parsed files"]
    mip_rna_bundle = store_base.build_bundle(config_data, sampleinfo_data,
                                             deliverables_raw)

    # THEN the result should contain the data to be stored in Housekeeper
    snapshot.assert_match(mip_rna_bundle)
Ejemplo n.º 9
0
def test_get_cells(snapshot: Snapshot) -> None:
    order_items_per_user = load_test_order_items_per_user()
    cells = spreadsheet.get_cells(order_items_per_user)
    snapshot.assert_match(cells)
Ejemplo n.º 10
0
def test_get_post_items_per_user(snapshot: Snapshot) -> None:
    bc_number = 150
    posts = load_test_posts()
    post_items_per_user = wtos.get_post_items_per_user(bc_number, posts)
    snapshot.assert_match(post_items_per_user)