Example #1
0
def do_not_test_check_free_net():
    netlist = NetList([
        NetPlayer('01336056', False),
        NetPlayer('01337238', False),
        NetPlayer('01502382', False)
    ], date(2019, 10, 5))
    actual = check_free_net(netlist, 'freenet_test.txt')
Example #2
0
def test_net_payment_checker_for_unpaid_nets_on_single_date():
    payments = {'133656': 2, '1337238': 1, '1502382': 1}
    netlist1 = NetList(
        [NetPlayer('133656', False),
         NetPlayer('1502382', False)], date(2019, 10, 5))
    netlist2 = NetList([NetPlayer('1337238', False)], date(2019, 10, 5))
    netlists = [netlist1, netlist2]
    actual = check_payments(netlists, payments)

    netlists[0].players[0].paid = True
    netlists[0].players[1].paid = True
    netlists[1].players[0].paid = True

    assert actual == netlists
Example #3
0
def test_net_payment_checker_for_one_day():
    payments = {'01336056': 1, '01337238': 1, '01502382': 1}
    netlist1 = NetList([
        NetPlayer('01336056', False),
        NetPlayer('01337238', False),
        NetPlayer('01502382', False)
    ], date(2019, 10, 5))
    netlists = [netlist1]
    actual = check_payments(netlists, payments)

    netlists[0].players[0].paid = True
    netlists[0].players[1].paid = True
    netlists[0].players[2].paid = True

    assert actual == netlists
Example #4
0
def test_netlist_loader_with_netplayer_name_not_found():
    test_file = os.path.join(TEST_DIR, 'netlist_test_incorrect_name.csv')
    cin_map = pd.DataFrame(
        [['01336056', 'Name1 Surname1'], ['01337238', 'Name2 Surname2'],
         ['01502382', 'Name3 Surname3']],
        columns=['cid', 'name'])
    netlist1 = NetList([
        NetPlayer('Name4 Surname1', False),
        NetPlayer('01337238', False),
        NetPlayer('01502382', False)
    ],
                       date=date(2019, 10, 8))
    netlist2 = NetList([
        NetPlayer('01337238', False),
        NetPlayer('01502382', False),
        NetPlayer('01336056', False)
    ],
                       date=date(2019, 10, 9))
    expected = [netlist1, netlist2]
    actual = load_netlists(test_file, cin_map)
    assert actual == expected