async def test_kosscanner_next_free_row(f_asheet_kos, session, db_cleanup): fscan = KOSScanner(f_asheet_kos) assert not session.query(KOS).all() await fscan.update_cells() assert fscan.next_free_row() == 1469
async def test_kosscanner_kos_entries(f_asheet_kos): fscan = KOSScanner(f_asheet_kos) await fscan.update_cells() ents = fscan.kos_entries() assert [x for x in ents if x.cmdr == "NewkTV"]
async def test_kosscanner_find_dupe(f_asheet_kos): fscan = KOSScanner(f_asheet_kos) await fscan.update_cells() cnt, row = fscan.find_dupe('Silas Kruge') assert cnt == 1468 assert not fscan.find_dupe('NotThere')[0]
async def test_kosscanner_parse_sheet(f_asheet_kos, session, db_cleanup): fscan = KOSScanner(f_asheet_kos) assert not session.query(KOS).all() await fscan.update_cells() fscan.parse_sheet(session) assert session.query(KOS).all()
async def test_kosscanner_parse_sheet_dupes(f_asheet_kos, session, db_cleanup): fscan = KOSScanner(f_asheet_kos) assert not session.query(KOS).all() await fscan.update_cells() fscan.cells_row_major = fscan.cells_row_major[:3] + fscan.cells_row_major[1:3] with pytest.raises(cog.exc.SheetParsingError): fscan.parse_sheet(session)
async def test_kosscanner_add_report_dict(f_asheet_kos, session, db_cleanup): fscan = KOSScanner(f_asheet_kos) assert not session.query(KOS).all() await fscan.update_cells() kos_info = { 'cmdr': 'cmdr', 'squad': 'squad', 'reason': 'A reason', 'is_friendly': False } payload = fscan.add_report_dict(kos_info) assert payload == [{'range': 'A1469:D1469', 'values': [['cmdr', 'squad', 'KILL', 'A reason']]}]
async def test_kosscanner_update_cells(f_asheet_kos): fscan = KOSScanner(f_asheet_kos) assert not fscan.cells_row_major await fscan.update_cells() assert fscan.cells_row_major[2][0] == "WildWetWalrus1" assert fscan.cells_col_major[0][2] == "WildWetWalrus1"