Ejemplo n.º 1
0
def test_query_row_table_inventory(monkeypatch):
    row_table = inventory.RowTableInventory("invtesttable", ".foo.bar:")
    monkeypatch.setattr(row_table, "_get_raw_data",
                        lambda only_sites, query: RAW_ROWS)
    monkeypatch.setattr(row_table, "_get_inv_data", lambda hostrow: INV_ROWS)
    rows, len_rows = row_table.query(None, [], None, None, None, [])
    for row in rows:
        assert set(row) == set(EXPECTED_INV_KEYS)
Ejemplo n.º 2
0
def test_query_row_table_inventory_add_columns(monkeypatch):
    row_table = inventory.RowTableInventory("invtesttable", ".foo.bar:")
    view = View("", {}, {})
    monkeypatch.setattr(row_table, "_get_raw_data", lambda only_sites, query: RAW_ROWS2)
    monkeypatch.setattr(row_table, "_get_inv_data", lambda hostrow: INV_ROWS)
    rows, _len_rows = row_table.query(view, ['host_foo'], "", None, None, [])
    for row in rows:
        assert set(row) == set(EXPECTED_INV_KEYS + ['host_foo'])