def test_listing_skips_planned(db_connection):
    today = date(2021, 5, 2)
    company1 = create_company('1', starts_at=date(2021, 5, 1), expires_at=None)
    company2 = create_company('2', starts_at=date(2021, 5, 2), expires_at=None)
    company3 = create_company('3', starts_at=date(2021, 5, 3), expires_at=None)  # noqa
    company4 = create_company('4', starts_at=None, expires_at=None)  # noqa

    assert set(Company.listing(today=today)) == {company1, company2}
def test_listing_skips_expired(db_connection):
    today = date(2021, 5, 2)
    company1 = create_company('1', starts_at=today, expires_at=date(2021, 4, 1))  # noqa
    company2 = create_company('2', starts_at=today, expires_at=date(2021, 5, 1))  # noqa
    company3 = create_company('3', starts_at=today, expires_at=date(2021, 5, 2))
    company4 = create_company('4', starts_at=today, expires_at=date(2021, 5, 3))

    assert set(Company.listing(today=today)) == {company3, company4}
예제 #3
0
def club():
    with db:
        members = ClubUser.avatars_listing()
        members_total_count = ClubUser.members_count()
        companies = Company.listing()
    return render_template('club.html',
                           nav_active='club',
                           subnav_tabs=CLUB_SUBNAV_TABS,
                           subnav_active='club',
                           companies=companies,
                           members=members,
                           members_total_count=members_total_count,
                           thumbnail=thumbnail(title='Klub, který tě nastartuje'))
def test_listing_includes_companies_without_expiration(db_connection):
    today = date(2021, 5, 1)
    company1 = create_company('1', starts_at=today, expires_at=date(2021, 5, 1))
    company2 = create_company('2', starts_at=today, expires_at=None)

    assert set(Company.listing(today=today)) == {company1, company2}
def test_listing_sorts_by_name_if_starting_date_is_the_same(db_connection):
    company1 = create_company('1', name='Banana', starts_at=date(2021, 4, 1))
    company2 = create_company('2', name='Apricot', starts_at=date(2021, 4, 1))

    assert list(Company.listing()) == [company2, company1]
def test_listing_sorts_by_starting_date(db_connection):
    company1 = create_company('1', starts_at=date(2021, 4, 3))
    company2 = create_company('2', starts_at=date(2021, 4, 2))
    company3 = create_company('3', starts_at=date(2021, 4, 1))

    assert list(Company.listing()) == [company3, company2, company1]