Beispiel #1
0
def barcamp_with_event(request):
    """example barcamp"""
    bc = Barcamp(
        name = "Barcamp",
        description = "cool barcamp",
        slug = "barcamp",
        start_date = datetime.date(2012,7,13),
        end_date = datetime.date(2012,7,15)
    )

    event = {
        'name'              : 'Day 1',
        'description'       : 'Description 1',
        'date'              : datetime.date(2012,7,13),
        'start_time'        : '10:00',
        'end_time'          : '18:00',
        'size'              : 10,
        'own_location'      : False,
        'timetable'         : {
            'rooms'         : [],
            'timeslots'     : [],
            'sessions'      : {}
        }
    }
    event = bc.add_event(Event(event))
    return bc
Beispiel #2
0
def test_event(barcamps):

    barcamp = Barcamp(name="Barcamp",
                      description="cool barcamp",
                      slug="barcamp",
                      location={
                          'name': "Example City",
                      },
                      start_date=datetime.date(2012, 7, 13),
                      end_date=datetime.date(2012, 7, 15))

    bc = barcamps.save(barcamp)
    bc = barcamps.get(bc._id)

    event = {
        'name': 'Day 1',
        'description': 'Description 1',
        'date': datetime.date(2012, 7, 13),
        'start_time': '10:00',
        'end_time': '18:00',
        'size': 10,
        'own_location': False,
    }
    event = barcamp.add_event(Event(event))
    eid = event['_id']

    bc = barcamps.save(barcamp)
    bc = barcamps.get(bc._id)

    assert bc.events[eid]['name'] == "Day 1"
Beispiel #3
0
def test_event(barcamps):

    barcamp = Barcamp(
        name = "Barcamp",
        description = "cool barcamp",
        slug = "barcamp",
        location = {
            'name' : "Example City",
        },
        start_date = datetime.date(2012,7,13),
        end_date = datetime.date(2012,7,15)
    )

    bc = barcamps.save(barcamp)
    bc = barcamps.get(bc._id)


    event = {
        'name'              : 'Day 1',
        'description'       : 'Description 1',
        'date'              : datetime.date(2012,7,13),
        'start_time'        : '10:00',
        'end_time'          : '18:00',
        'size'              : 10,
        'own_location'      : False,
    }
    event = barcamp.add_event(Event(event))
    eid = event['_id']

    bc = barcamps.save(barcamp)
    bc = barcamps.get(bc._id)

    assert bc.events[eid]['name'] == "Day 1"
Beispiel #4
0
def barcamp(request):
    """example barcamp"""
    return Barcamp(name="Barcamp",
                   description="cool barcamp",
                   slug="barcamp",
                   start_date=datetime.date(2012, 7, 13),
                   end_date=datetime.date(2012, 7, 15))
Beispiel #5
0
def test_for_user(barcamps):
    """test if we return all the barcamps for a given user id"""
    barcamp = Barcamp(name="Barcamp 1",
                      description="foobar",
                      slug="barcamp1",
                      start_date=datetime.date(2012, 7, 13),
                      end_date=datetime.date(2012, 7, 15))
    barcamps.save(barcamp)

    barcamp = Barcamp(name="Barcamp 1",
                      description="foobar",
                      slug="barcamp2",
                      start_date=datetime.date(2012, 7, 13),
                      end_date=datetime.date(2012, 7, 15))
    barcamps.save(barcamp)

    barcamp = barcamps.by_slug("barcamp1")
    assert barcamp.slug == "barcamp1"
Beispiel #6
0
def test_add_with_barcamps(pages, barcamps):
    barcamp1 = Barcamp(name="Barcamp 1",
                       description="cool barcamp",
                       slug="barcamp",
                       start_date=datetime.date(2012, 7, 13),
                       end_date=datetime.date(2012, 7, 15))
    barcamp2 = Barcamp(name="Barcamp 2",
                       description="cool barcamp",
                       slug="barcamp",
                       start_date=datetime.date(2012, 7, 13),
                       end_date=datetime.date(2012, 7, 15))

    barcamp1 = barcamps.save(barcamp1)
    barcamp2 = barcamps.save(barcamp2)

    page1 = Page(
        title=u"Test Page for BC 1",
        menu_title=u"BC TP 1",
        slug=u"test_page_1",
        content=u"Hello 1 for BC 1",
    )

    page2 = Page(
        title=u"Test Page 2 for BC 2",
        menu_title=u"BC TP 2",
        slug=u"test_page_2",
        content=u"Hello 2 for BC 2",
    )

    pages.add_to_slot("slot1", page1, barcamp=barcamp1)
    pages.add_to_slot("slot1", page2, barcamp=barcamp2)

    p = list(pages.for_slot("slot1"))
    assert len(p) == 0  # no barcamp given

    p = list(pages.for_slot("slot1", barcamp=barcamp1))
    assert len(p) == 1
    assert p[0].title == u"Test Page for BC 1"

    p = list(pages.for_slot("slot1", barcamp=barcamp2))
    assert len(p) == 1
    assert p[0].title == u"Test Page 2 for BC 2"
Beispiel #7
0
def test_simple(barcamps):
    barcamp = Barcamp(name="Barcamp",
                      description="cool barcamp",
                      slug="barcamp",
                      start_date=datetime.date(2012, 7, 13),
                      end_date=datetime.date(2012, 7, 15))
    barcamps.save(barcamp)

    barcamp = barcamps.by_slug("barcamp")
    assert barcamp.name == "Barcamp"
    assert barcamp.registration_date == None
Beispiel #8
0
def test_no_event_on_bc_creation(barcamps):
    barcamp = Barcamp(name="Barcamp",
                      description="cool barcamp",
                      slug="barcamp",
                      location={
                          'name': "Example City",
                      },
                      start_date=datetime.date(2012, 7, 13),
                      end_date=datetime.date(2012, 7, 15))
    bc = barcamps.save(barcamp)

    bc = barcamps.get(bc._id)

    # there should be no events automatically anymore
    assert len(bc.events) == 0
Beispiel #9
0
def barcamp_with_event(request):
    """example barcamp"""
    bc = Barcamp(name="Barcamp",
                 description="cool barcamp",
                 slug="barcamp",
                 start_date=datetime.date(2012, 7, 13),
                 end_date=datetime.date(2012, 7, 15))

    event = {
        'name': 'Day 1',
        'description': 'Description 1',
        'date': datetime.date(2012, 7, 13),
        'start_time': '10:00',
        'end_time': '18:00',
        'size': 10,
        'own_location': False,
        'timetable': {
            'rooms': [],
            'timeslots': [],
            'sessions': {}
        }
    }
    event = bc.add_event(Event(event))
    return bc
Beispiel #10
0
def test_event(barcamps):
    barcamp = Barcamp(name="Barcamp",
                      description="cool barcamp",
                      slug="barcamp",
                      location={
                          'name': "Example City",
                      },
                      start_date=datetime.date(2012, 7, 13),
                      end_date=datetime.date(2012, 7, 15))
    bc = barcamps.save(barcamp)

    bc = barcamps.get(bc._id)

    assert len(bc.events) == 1
    assert bc.events[0]['name'] == "Barcamp"