Exemple #1
0
def test_enrollment_end(client, web2py):
    """
        Are class enrollments listed correctly?
    """
    setup_profile_tests(web2py)

    # get the url, for some reason the customers_subscriptions table is empty if we don't get this first
    url = '/profile/index'
    client.get(url)
    assert client.status == 200

    populate_classes(web2py)

    clrID = web2py.db.classes_reservation.insert(
        classes_id=1,
        auth_customer_id=300,
        Startdate='2014-01-01',
    )

    web2py.db.commit()

    url = '/profile/enrollment_end/' + str(clrID)
    client.get(url)
    assert client.status == 200

    data = {'id': clrID, 'Enddate': '2017-12-31'}

    url = '/profile/enrollment_end/' + str(clrID)
    client.post(url, data=data)
    assert client.status == 200

    clr = web2py.db.classes_reservation(clrID)
    assert clr.Enddate == datetime.date(2017, 12, 31)
Exemple #2
0
def test_class_cancel(client, web2py):
    """
        Can a customer cancel a class?
    """
    setup_profile_tests(web2py)
    populate_classes(web2py)

    d = datetime.date.today()
    next_monday = next_weekday(d, 0)

    clattID = web2py.db.classes_attendance.insert(classes_id=1,
                                                  ClassDate=next_monday,
                                                  auth_customer_id=300,
                                                  AttendanceType=1)

    # Allow cancellation 1 hours or more in advance
    web2py.db.sys_properties.insert(Property='shop_classes_cancellation_limit',
                                    PropertyValue='1')

    web2py.db.commit()

    url = '/profile/class_cancel?clattID=' + str(clattID)
    client.get(url)
    assert client.status == 200

    clatt = web2py.db.classes_attendance(clattID)
    assert clatt.BookingStatus == 'cancelled'
Exemple #3
0
def test_enrollments(client, web2py):
    """
        Are class enrollments listed correctly?
    """
    setup_profile_tests(web2py)

    # get the url, for some reason the customers_subscriptions table is empty if we don't get this first
    url = '/profile/index'
    client.get(url)
    assert client.status == 200

    populate_classes(web2py)

    web2py.db.classes_reservation.insert(
        classes_id=1,
        auth_customer_id=300,
        Startdate='2014-01-01',
    )

    web2py.db.commit()

    url = '/profile/enrollments'
    client.get(url)
    assert client.status == 200

    assert '2014-01-01' in client.text
    assert 'End enrollment' in client.text  # Check end link display
Exemple #4
0
def test_class_cancel_confirmation_cannot_be_cancelled(client, web2py):
    """
        Is the message showing notifying the customer that the class can't be cancelled anymore
    """
    setup_profile_tests(web2py)
    populate_classes(web2py)

    d = datetime.date.today()
    next_monday = next_weekday(d, 0)

    clattID = web2py.db.classes_attendance.insert(classes_id=1,
                                                  ClassDate=next_monday,
                                                  auth_customer_id=300,
                                                  AttendanceType=1)

    # Allow cancellation 24 hours or more in advance
    web2py.db.sys_properties.insert(Property='shop_classes_cancellation_limit',
                                    PropertyValue='744')

    web2py.db.commit()

    url = '/profile/class_cancel_confirm?clattID=' + str(clattID)
    client.get(url)
    assert client.status == 200

    assert "We're sorry to inform" in client.text
Exemple #5
0
def test_class_cancel_confirmation(client, web2py):
    """
         Is the cancel conformation page showing?
    """
    setup_profile_tests(web2py)
    populate_classes(web2py)

    d = datetime.date.today()
    next_next_monday = next_weekday(d, 0) + datetime.timedelta(days=7)

    clattID = web2py.db.classes_attendance.insert(classes_id=1,
                                                  ClassDate=next_next_monday,
                                                  auth_customer_id=300,
                                                  AttendanceType=1)

    # Allow cancellation 24 hours or more in advance
    web2py.db.sys_properties.insert(Property='shop_classes_cancellation_limit',
                                    PropertyValue='24')

    web2py.db.commit()

    url = '/profile/class_cancel_confirm?clattID=' + str(clattID)
    client.get(url)
    assert client.status == 200

    assert "Are you sure you want to cancel" in client.text
Exemple #6
0
def test_classes_show_cancel_link(client, web2py):
    """
        Is the cancel link shown when it should?
    """
    setup_profile_tests(web2py)
    populate_classes(web2py)

    d = datetime.date.today()
    next_next_monday = next_weekday(d, 0) + datetime.timedelta(days=7)

    clattID = web2py.db.classes_attendance.insert(classes_id=1,
                                                  ClassDate=next_next_monday,
                                                  auth_customer_id=300,
                                                  AttendanceType=1)

    # Allow cancellation 24 hours or more in advance
    web2py.db.sys_properties.insert(Property='shop_classes_cancellation_limit',
                                    PropertyValue='24')

    web2py.db.commit()

    # check profile/classes
    url = '/profile/classes'
    client.get(url)
    assert client.status == 200

    assert "/profile/class_cancel_confirm" in client.text
def test_reports_trialclasses(client, web2py):
    """
        Is the page listing drop in classes for a month working?
    """
    populate_customers(web2py)
    populate_classes(web2py, with_otc=True)

    web2py.db.classes_attendance.insert(
        classes_id=1,
        ClassDate='2014-01-06',
        auth_customer_id=1001,
        AttendanceType=1,
    )

    web2py.db.commit()

    url = '/reports/trialclasses?year=2014&month=1'
    client.get(url)
    assert client.status == 200

    location = web2py.db.school_locations(2).Name.split(' ')[0]
    assert location in client.text

    classtype = web2py.db.school_classtypes(2).Name.split(' ')[0]
    assert classtype in client.text
def test_classes(client, web2py):
    """
        Is the list of classes showing?
    """
    setup_profile_tests(web2py)
    populate_classes(web2py)

    d = datetime.date.today()
    next_monday = next_weekday(d, 0)

    # Insert changed location into classes_otc for next Monday
    web2py.db.classes_otc.insert(
        classes_id=1,
        ClassDate=next_monday,
        school_locations_id=2,
        school_classtypes_id=2,
    )

    web2py.db.classes_attendance.insert(
        classes_id = 1,
        ClassDate = '2014-01-06',
        auth_customer_id = 300,
        AttendanceType = 1
    )

    web2py.db.commit()

    url = '/profile/classes'
    client.get(url)
    assert client.status == 200

    # check regular class listing
    location = web2py.db.school_locations(1)
    location_name = location.Name.split(' ')[0]
    assert location_name in client.text

    # check otc class listing
    location = web2py.db.school_locations(1)
    location_name = location.Name.split(' ')[0]
    assert location_name in client.text