def test4_0():
    print("TEST4_0 - Dump the tree")
    context = None
    #    context = peeps.loadPeepFile(context, '../hoh-people.json')
    context = mycontext.setPeepFile(context, '../hoh-people.json')
    lines = peeps.produceDecendentList(context,
                                       "09e34f8b-3f9c-43fa-8c03-3b529c01a1aa")

    for line in lines:
        print(line)
    return
def test5_2():
    print("TEST5_0 - PEOPLE LIST TESTS - single peep not matched")
    context = None
    #    context = peeps.loadPeepFile(context, '../hoh-people.json')
    context = mycontext.setPeepFile(context, '../hoh-people.json')

    p = peeps.getPeepsList(context, "11111111-2222-3333-8c03-3b529c01a1aa")

    print("peeps count = " + str(len(p)))
    assert (len(p) == 0)

    return
def test5_1():
    print("TEST5_1 - PEOPLE LIST TESTS - list of peeps")
    context = None
    #    context = peeps.loadPeepFile(context, '../hoh-people.json')
    context = mycontext.setPeepFile(context, '../hoh-people.json')

    p = peeps.getPeepsList(context, "")

    assert (len(p) >= 1)

    print("peeps count = " + str(len(p)))

    return
def test5_0():
    print("TEST5_0 - PEOPLE LIST TESTS - single peep")
    context = None
    #    context = peeps.loadPeepFile(context, '../hoh-people.json')
    context = mycontext.setPeepFile(context, '../hoh-people.json')
    testGuid = "09e34f8b-3f9c-43fa-8c03-3b529c01a1aa"
    p = peeps.getPeepsList(context, testGuid)

    print("peeps count = " + str(len(peeps)))
    assert (len(p) == 1)
    assert (p[0]['id'] == testGuid)
    assert (p[0]['firstName'] == 'Nita')

    return
def test1_0():
    print("Test1_0 - level 0 peeps")

    context = mycontext.newContext()

    #context = peeps.loadPeepFile(context, '../hoh-people.json')
    context = mycontext.setPeepFile(context, '../hoh-people.json')

    items = peeps.getBirthdayList(context, "0", "365", "365", "True")
    print("Peeps matched")
    for item in items:
        print("peep " + peeps.getPreferredName(item) + " birthday is in " +
              item['daysAway'] + " days")
    assert (len(items) >= 0)

    return
def test1_4():
    context = None

    print("Test1_4 - level * (ALL) peeps")

    #print("context (before) = " + str(context))
    #   context = peeps.loadPeepFile(context, '../hoh-people.json')
    context = mycontext.setPeepFile(context, '../hoh-people.json')
    #print("context (after) = " + str(context))

    items = peeps.getBirthdayList(context, "*", "180", "181", "True")
    print("Peeps matched")
    for item in items:
        print("peep " + peeps.getPreferredName(item) + " birthday is in " +
              item['daysAway'] + " days")
    assert (len(items) >= 0)
    return
def test3_0():

    context = None
    #    context = peeps.loadPeepFile(context, '../hoh-people.json')
    context = mycontext.setPeepFile(context, '../hoh-people.json')
    list = peeps.produceCSVList(context)
    print("List has " + str(len(list)) + " peeps in it")

    with open('peeps.csv', mode='w', newline="") as csv_file:
        fieldnames = [
            'index', 'id', 'level', 'firstName', 'familyName', 'preferredName',
            'maidenName', 'dob', 'dod', 'fatherIndex', 'motherIndex'
        ]
        writer = csv.DictWriter(csv_file,
                                fieldnames=fieldnames,
                                delimiter=',',
                                quotechar='"',
                                quoting=csv.QUOTE_ALL)

        writer.writeheader()
        for row in list:
            writer.writerow(row)

    return