示例#1
0
 def test_meetings_select_group(self):
     make_meeting_test_data()
     url = reverse('meetings_select_group',kwargs={'meeting_id':42,'schedule_name':'test-agenda'})
     self.client.login(username="******", password="******")
     response = self.client.get(url)
     self.assertEqual(response.status_code, 200)
     q = PyQuery(response.content)
     self.assertEqual(len(q("#id_scheduled_sessions")),1)
示例#2
0
文件: tests_api.py 项目: algby/ietfdb
    def test_person_json(self):
        make_meeting_test_data()
        person = Person.objects.get(user__username="******")

        url = urlreverse("ietf.person.ajax.person_json", kwargs=dict(personid=person.pk))
        r = self.client.get(url)
        self.assertEqual(r.status_code, 200)
        info = json.loads(r.content)
        self.assertEqual(info["name"], person.name)
示例#3
0
文件: tests_api.py 项目: algby/ietfdb
    def test_group_json(self):
        make_meeting_test_data()
        group = Group.objects.get(acronym="mars")

        url = urlreverse("ietf.group.ajax.group_json", kwargs=dict(acronym=group.acronym))
        r = self.client.get(url)
        self.assertEqual(r.status_code, 200)
        info = json.loads(r.content)
        self.assertEqual(info["name"], group.name)
示例#4
0
 def test_meetings_nonsession(self):
     make_meeting_test_data()
     url = reverse('ietf.secr.meetings.views.non_session',
                   kwargs={
                       'meeting_id': 42,
                       'schedule_name': 'test-agenda'
                   })
     self.client.login(username="******", password="******")
     response = self.client.get(url)
     self.assertEqual(response.status_code, 200)
示例#5
0
文件: tests.py 项目: ekr/ietfdb
 def test_main(self):
     make_meeting_test_data()
     url = reverse('ietf.secr.sreq.views.main')
     self.client.login(username="******", password="******")
     r = self.client.get(url)
     self.assertEqual(r.status_code, 200)
     sched = r.context['scheduled_groups']
     unsched = r.context['unscheduled_groups']
     self.assertEqual(len(unsched),3)
     self.assertEqual(len(sched),2)
示例#6
0
    def test_person_json(self):
        make_meeting_test_data()
        person = Person.objects.get(user__username="******")

        url = urlreverse("ietf.person.ajax.person_json",
                         kwargs=dict(personid=person.pk))
        r = self.client.get(url)
        self.assertEqual(r.status_code, 200)
        info = json.loads(r.content)
        self.assertEqual(info["name"], person.name)
示例#7
0
    def test_group_json(self):
        make_meeting_test_data()
        group = Group.objects.get(acronym="mars")

        url = urlreverse("ietf.group.views.group_json",
                         kwargs=dict(acronym=group.acronym))
        r = self.client.get(url)
        self.assertEqual(r.status_code, 200)
        info = json.loads(r.content)
        self.assertEqual(info["name"], group.name)
示例#8
0
 def test_meetings_select_group(self):
     make_meeting_test_data()
     url = reverse('ietf.secr.meetings.views.select_group',
                   kwargs={
                       'meeting_id': 42,
                       'schedule_name': 'test-agenda'
                   })
     self.client.login(username="******", password="******")
     response = self.client.get(url)
     self.assertEqual(response.status_code, 200)
     q = PyQuery(response.content)
     self.assertEqual(len(q("#id_scheduled_sessions")), 1)
示例#9
0
文件: tests.py 项目: ekr/ietfdb
    def test_urls(self):
        make_meeting_test_data()

        self.client.login(username="******", password="******")

        r = self.client.get("/secr/")
        self.assertEqual(r.status_code, 200)

        r = self.client.get("/secr/sreq/")
        self.assertEqual(r.status_code, 200)

        testgroup=Group.objects.filter(type_id='wg').first()
        r = self.client.get("/secr/sreq/%s/new/" % testgroup.acronym)
        self.assertEqual(r.status_code, 200)
示例#10
0
    def test_meetings_rooms(self):
        meeting = make_meeting_test_data()
        url = reverse('ietf.secr.meetings.views.rooms',
                      kwargs={
                          'meeting_id': 42,
                          'schedule_name': 'test-agenda'
                      })
        self.client.login(username="******", password="******")
        response = self.client.get(url)
        self.assertEqual(response.status_code, 200)
        q = PyQuery(response.content)
        self.assertEqual(len(q("#id_rooms_table tr input[type='checkbox']")),
                         meeting.room_set.count())

        # test delete
        # first unschedule sessions so we can delete
        SchedTimeSessAssignment.objects.filter(
            schedule=meeting.agenda).delete()
        SchedTimeSessAssignment.objects.filter(
            schedule=meeting.unofficial_schedule).delete()
        self.client.login(username="******", password="******")
        post_dict = {
            'room-TOTAL_FORMS': q('input[name="room-TOTAL_FORMS"]').val(),
            'room-INITIAL_FORMS': q('input[name="room-INITIAL_FORMS"]').val(),
        }
        for i in range(meeting.room_set.count()):
            for attr in ['meeting', 'id', 'name', 'capacity', 'DELETE']:
                key = 'room-%d-%s' % (i, attr)
                post_dict[key] = q('input[name="%s"]' % key).val()
        response = self.client.post(url, post_dict)
        self.assertEqual(response.status_code, 302)
        self.assertEqual(Room.objects.filter(meeting=meeting).count(), 0)
示例#11
0
    def test_read_only(self):
        meeting = make_meeting_test_data()

        # Secretariat
        self.client.login(username="******", password="******")
        url = '/meeting/%s/agenda/%s/%s/permissions' % (
            meeting.number, meeting.agenda.owner.email_address(),
            meeting.agenda.name)
        r = self.client.get(url)
        self.assertEqual(r.status_code, 200)

        info = json.loads(r.content)
        self.assertEqual(info['secretariat'], True)
        self.assertEqual(
            urlsplit(info['owner_href'])[2],
            "/person/%s.json" % meeting.agenda.owner_id)
        self.assertEqual(info['read_only'], True)
        self.assertEqual(info['save_perm'], True)

        # owner
        self.client.login(username=meeting.agenda.owner.user.username,
                          password=meeting.agenda.owner.user.username +
                          "+password")
        url = '/meeting/%s/agenda/%s/%s/permissions' % (
            meeting.number, meeting.agenda.owner.email_address(),
            meeting.agenda.name)
        r = self.client.get(url)
        self.assertEqual(r.status_code, 200)

        info = json.loads(r.content)
        self.assertEqual(info['secretariat'], False)
        self.assertEqual(info['read_only'], False)
        self.assertEqual(info['save_perm'], False)
示例#12
0
    def test_update_schedule(self):
        meeting = make_meeting_test_data()

        self.assertTrue(meeting.agenda.visible)

        url = urlreverse("ietf.meeting.ajax.agenda_infourl",
                         kwargs=dict(num=meeting.number,
                                     owner=meeting.agenda.owner_email(),
                                     name=meeting.agenda.name))

        post_data = {
            'visible': 'false',
            'name': 'new-test-name',
        }

        # unauthorized posts
        self.client.logout()
        r = self.client.post(url, post_data)
        self.assertEqual(r.status_code, 403)
        self.client.login(username="******", password="******")
        r = self.client.post(url, post_data)
        self.assertEqual(r.status_code, 403)

        # change agenda
        self.client.login(username="******", password="******")
        r = self.client.post(url, post_data)
        self.assertEqual(r.status_code, 302)
        changed_schedule = Schedule.objects.get(pk=meeting.agenda.pk)
        self.assertTrue(not changed_schedule.visible)
        self.assertEqual(changed_schedule.name, "new-test-name")
示例#13
0
    def test_create_new_slot(self):
        meeting = make_meeting_test_data()

        slot_time = datetime.date.today()

        url = urlreverse("ietf.meeting.ajax.timeslot_slotsurl",
                         kwargs=dict(num=meeting.number))
        post_data = {
            'type': 'plenary',
            'time': slot_time.strftime("%Y-%m-%d"),
            'duration': '08:00:00',
        }

        # unauthorized post
        prior_slotcount = meeting.timeslot_set.count()
        self.client.login(username="******", password="******")
        r = self.client.post(url, post_data)
        self.assertEqual(r.status_code, 403)
        self.assertEqual(meeting.timeslot_set.count(), prior_slotcount)

        # create slot
        self.client.login(username="******", password="******")
        r = self.client.post(url, post_data)
        self.assertEqual(r.status_code, 201)
        self.assertTrue(meeting.timeslot_set.filter(time=slot_time))
        self.assertEqual(meeting.timeslot_set.count(), prior_slotcount + 1)
示例#14
0
    def test_sessions_json(self):
        meeting = make_meeting_test_data()

        url = urlreverse("ietf.meeting.ajax.sessions_json",
                         kwargs=dict(num=meeting.number))
        r = self.client.get(url)
        self.assertEqual(r.status_code, 200)
        info = json.loads(r.content)
        self.assertEqual(
            set([x['short_name'] for x in info]),
            set([
                s.session.short_name
                for s in meeting.agenda.assignments.filter(
                    session__type_id='session')
            ]))

        schedule = meeting.agenda
        url = urlreverse("ietf.meeting.ajax.assignments_json",
                         kwargs=dict(num=meeting.number,
                                     owner=schedule.owner_email(),
                                     name=schedule.name))
        r = self.client.get(url)
        self.assertEqual(r.status_code, 200)
        info = json.loads(r.content)
        self.assertEqual(len(info), schedule.assignments.count())
示例#15
0
    def test_create_new_room(self):
        meeting = make_meeting_test_data()
        timeslots_before = meeting.timeslot_set.filter(type='session').count()
        url = urlreverse("ietf.meeting.ajax.timeslot_roomsurl",
                         kwargs=dict(num=meeting.number))

        post_data = {
            "name": "new room",
            "capacity": "50",
            "resources": [],
            "session_types": ["session"]
        }

        # unauthorized post
        r = self.client.post(url, post_data)
        self.assertEqual(r.status_code, 302)
        self.assertTrue(not meeting.room_set.filter(name="new room"))

        # create room
        self.client.login(username="******", password="******")
        r = self.client.post(url, post_data)
        self.assertEqual(r.status_code, 302)
        self.assertTrue(meeting.room_set.filter(name="new room"))

        timeslots_after = meeting.timeslot_set.filter(type='session').count()
        # It's not clear that what that ajax function is doing is the right thing to do,
        # but it currently makes a new timeslot for any existing timeslot.
        # The condition tested below relies on the timeslots before this test all having different start and end times
        self.assertEqual(timeslots_after, 2 * timeslots_before)
示例#16
0
 def test_meetings_nonsession_edit(self):
     meeting = make_meeting_test_data()
     session = meeting.session_set.exclude(
         name='').first()  # get first non-session session
     timeslot = session.official_timeslotassignment().timeslot
     url = reverse('ietf.secr.meetings.views.non_session_edit',
                   kwargs={
                       'meeting_id': 42,
                       'schedule_name': meeting.agenda.name,
                       'slot_id': timeslot.pk
                   })
     redirect_url = reverse('ietf.secr.meetings.views.non_session',
                            kwargs={
                                'meeting_id': 42,
                                'schedule_name': 'test-agenda'
                            })
     new_time = timeslot.time + datetime.timedelta(days=1)
     self.client.login(username="******", password="******")
     response = self.client.get(url)
     self.assertEqual(response.status_code, 200)
     response = self.client.post(
         url, {
             'name': 'IETF Hackathon',
             'short': 'hackathon',
             'location': timeslot.location.id,
             'group': session.group.id,
             'time': new_time.strftime('%H:%M'),
             'duration': '01:00',
             'day': '2',
             'type': 'other',
         })
     self.assertRedirects(response, redirect_url)
     timeslot = session.official_timeslotassignment().timeslot
     self.assertEqual(timeslot.time, new_time)
示例#17
0
文件: tests_api.py 项目: algby/ietfdb
    def test_update_timeslot_pinned(self):
        meeting = make_meeting_test_data()
        scheduled = ScheduledSession.objects.filter(
            session__meeting=meeting, session__group__acronym="mars").first()

        url = '/meeting/%s/agenda/%s/%s/session/%u.json' % (meeting.number, meeting.agenda.owner_email(), meeting.agenda.name, scheduled.pk)

        post_data = {
            "pinned": True
            }

        # unauthorized post gets failure (no redirect)
        r = self.client.put(url, post_data)
        self.assertEqual(r.status_code, 403,
                         "post to %s should have failed, no permission, got: %u/%s" %
                         (url, r.status_code, r.content))
        self.assertTrue(not ScheduledSession.objects.get(pk=scheduled.pk).pinned)

        # set pinned
        meeting.agenda.owner = Person.objects.get(user__username="******")
        meeting.agenda.save()

        # need to rebuild URL, since the agenda owner has changed.
        url = '/meeting/%s/agenda/%s/%s/session/%u.json' % (meeting.number, meeting.agenda.owner_email(), meeting.agenda.name, scheduled.pk)

        self.client.login(username="******", password="******")
        r = self.client.put(url, post_data)
        self.assertEqual(r.status_code, 200,
                         "post to %s should have worked, but got: %u/%s" %
                         (url, r.status_code, r.content))
        self.assertTrue(ScheduledSession.objects.get(pk=scheduled.pk).pinned)
示例#18
0
 def test_meetings_session_edit(self):
     meeting = make_meeting_test_data()
     session = Session.objects.filter(meeting=meeting,
                                      group__acronym='mars').first()
     url = reverse('ietf.secr.meetings.views.session_edit',
                   kwargs={
                       'meeting_id': meeting.number,
                       'schedule_name': meeting.agenda.name,
                       'session_id': session.id
                   })
     redirect_url = reverse('ietf.secr.meetings.views.select_group',
                            kwargs={
                                'meeting_id': meeting.number,
                                'schedule_name': meeting.agenda.name
                            })
     self.client.login(username="******", password="******")
     response = self.client.get(url)
     self.assertEqual(response.status_code, 200)
     response = self.client.post(url, {'agenda_note': 'TEST'})
     self.assertRedirects(response, redirect_url)
     session = Session.objects.get(id=session.id)
     self.assertEqual(session.agenda_note, 'TEST')
     response = self.client.post(url, {
         'agenda_note': 'TEST',
         'submit': 'Cancel'
     })
     self.assertRedirects(response, redirect_url)
     session = Session.objects.get(id=session.id)
     self.assertEqual(session.status.slug, 'canceled')
示例#19
0
文件: tests_api.py 项目: algby/ietfdb
    def test_read_only(self):
        meeting = make_meeting_test_data()

        # Secretariat
        self.client.login(username="******", password="******")
        url = '/meeting/%s/agenda/%s/%s/permissions' % (meeting.number, meeting.agenda.owner.email_address(), meeting.agenda.name);
        r = self.client.get(url)
        self.assertEqual(r.status_code, 200)

        info = json.loads(r.content)
        self.assertEqual(info['secretariat'], True)
        self.assertEqual(urlsplit(info['owner_href'])[2], "/person/%s.json" % meeting.agenda.owner_id)
        self.assertEqual(info['read_only'], True)
        self.assertEqual(info['save_perm'], True)

        # owner
        self.client.login(username=meeting.agenda.owner.user.username,
                          password=meeting.agenda.owner.user.username+"+password")
        url = '/meeting/%s/agenda/%s/%s/permissions' % (meeting.number, meeting.agenda.owner.email_address(), meeting.agenda.name);
        r = self.client.get(url)
        self.assertEqual(r.status_code, 200)

        info = json.loads(r.content)
        self.assertEqual(info['secretariat'], False)
        self.assertEqual(info['read_only'], False)
        self.assertEqual(info['save_perm'], False)
示例#20
0
    def test_edit_material_presentations(self):
        doc = self.create_slides()
        meeting = make_meeting_test_data()
        meeting.session_set.filter(group__acronym='mars').update(group=doc.group)

        session = meeting.agenda.assignments.filter(session__group__acronym='testteam').first().session

        url = urlreverse(edit_material_presentations,kwargs=dict(name=doc.name,acronym='testteam',seq=1))
        login_testing_unauthorized(self, "secretary", url)
        r = self.client.get(url)
        self.assertEqual(r.status_code, 200)
        
        self.assertEqual(doc.sessionpresentation_set.count(),0)

        # add the materials to a session
        r = self.client.post(url, dict(action="Save",version="00"))
        self.assertEqual(r.status_code, 302)
        self.assertEqual(doc.sessionpresentation_set.first().session , session) 

        # change the version
        r = self.client.post(url, dict(action="Save",version="01"))
        self.assertEqual(r.status_code, 302)
        self.assertEqual(doc.sessionpresentation_set.first().session , session) 

        # take the slides back off that meeting
        r = self.client.post(url, dict(action="Save",version="notpresented"))
        self.assertEqual(r.status_code, 302)
        self.assertEqual(doc.sessionpresentation_set.count(),0)
示例#21
0
 def test_page(self):
     meeting = make_meeting_test_data()
     url = reverse('ietf.secr.proceedings.views.recording',
                   kwargs={'meeting_num': meeting.number})
     self.client.login(username="******", password="******")
     response = self.client.get(url)
     self.assertEqual(response.status_code, 200)
示例#22
0
    def test_edit_timeslots(self):
        meeting = make_meeting_test_data()

        self.client.login(username="******", password="******")
        r = self.client.get(urlreverse("ietf.meeting.views.edit_timeslots", kwargs=dict(num=meeting.number)))
        self.assertEqual(r.status_code, 200)
        self.assertTrue(meeting.room_set.all().first().name in r.content)
示例#23
0
 def test_blue_sheets_generate(self):
     meeting = make_meeting_test_data()
     url = reverse('meetings_blue_sheet_generate',kwargs={'meeting_id':meeting.number})
     self.client.login(username="******", password="******")
     response = self.client.get(url)
     self.assertEqual(response.status_code, 302)
     self.assertTrue(os.path.exists(self.bluesheet_path))
示例#24
0
 def test_notifications(self):
     "Test Notifications"
     meeting = make_meeting_test_data()
     url = reverse('meetings_notifications',kwargs={'meeting_id':42})
     self.client.login(username="******", password="******")
     response = self.client.get(url)
     self.assertEqual(response.status_code, 200)
     q = PyQuery(response.content)
     self.assertEqual(q('#id_notification_list').html(),'ames, mars')
     
     # test that only changes since last notification show up
     mars_group = Group.objects.get(acronym='mars')
     ames_group = Group.objects.get(acronym='ames')
     now = datetime.datetime.now()
     then = datetime.datetime.now()+datetime.timedelta(hours=1)
     person = Person.objects.get(name="(System)")
     GroupEvent.objects.create(group=mars_group,time=now,type='sent_notification',
                               by=person,desc='sent scheduled notification for %s' % meeting)
     ss = meeting.agenda.assignments.get(session__group=ames_group)
     ss.modified = then
     ss.save()
     self.client.login(username="******", password="******")
     response = self.client.get(url)
     self.assertEqual(response.status_code, 200)
     q = PyQuery(response.content)
     self.assertEqual(q('#id_notification_list').html(),'ames')
     
     # test that email goes out
     mailbox_before = len(outbox)
     self.client.login(username="******", password="******")
     response = self.client.post(url)
     self.assertEqual(response.status_code, 302)
     self.assertEqual(len(outbox), mailbox_before + 1)
示例#25
0
文件: tests_api.py 项目: algby/ietfdb
    def test_update_schedule(self):
        meeting = make_meeting_test_data()

        self.assertTrue(meeting.agenda.visible)

        url = urlreverse("ietf.meeting.ajax.agenda_infourl",
                         kwargs=dict(num=meeting.number,
                                     owner=meeting.agenda.owner_email(),
                                     name=meeting.agenda.name))

        post_data = {
            'visible': 'false',
            'name': 'new-test-name',
        }

        # unauthorized posts
        self.client.logout()
        r = self.client.post(url, post_data)
        self.assertEqual(r.status_code, 403)
        self.client.login(username="******", password="******")
        r = self.client.post(url, post_data)
        self.assertEqual(r.status_code, 403)

        # change agenda
        self.client.login(username="******", password="******")
        r = self.client.post(url, post_data)
        self.assertEqual(r.status_code, 302)
        changed_schedule = Schedule.objects.get(pk=meeting.agenda.pk)
        self.assertTrue(not changed_schedule.visible)
        self.assertEqual(changed_schedule.name, "new-test-name")
示例#26
0
    def test_post(self):
        meeting = make_meeting_test_data()
        group = Group.objects.get(acronym='mars')
        session = Session.objects.filter(meeting=meeting, group=group).first()
        # explicitly set to scheduled for this test
        status = SessionStatusName.objects.get(slug='sched')
        session.status = status
        session.save()
        url = reverse('ietf.secr.proceedings.views.recording',
                      kwargs={'meeting_num': meeting.number})
        data = dict(group=group.acronym,
                    external_url='http://youtube.com/xyz',
                    session=session.pk)
        self.client.login(username="******", password="******")
        response = self.client.post(url, data, follow=True)
        self.assertEqual(response.status_code, 200)
        self.assertTrue(group.acronym in response.content)

        # now test edit
        doc = session.materials.filter(type='recording').first()
        external_url = 'http://youtube.com/aaa'
        url = reverse('ietf.secr.proceedings.views.recording_edit',
                      kwargs={
                          'meeting_num': meeting.number,
                          'name': doc.name
                      })
        response = self.client.post(url,
                                    dict(external_url=external_url),
                                    follow=True)
        self.assertEqual(response.status_code, 200)
        self.assertTrue(external_url in response.content)
示例#27
0
文件: tests_api.py 项目: algby/ietfdb
    def test_meeting_json(self):
        meeting = make_meeting_test_data()

        r = self.client.get(urlreverse("ietf.meeting.ajax.meeting_json", kwargs=dict(num=meeting.number)))
        self.assertEqual(r.status_code, 200)
        info = json.loads(r.content)
        self.assertEqual(info["name"], meeting.number)
示例#28
0
    def test_save_agenda_broken_names(self):
        meeting = make_meeting_test_data()

        # save as new name (requires valid existing agenda)
        url = urlreverse("ietf.meeting.views.edit_agenda", kwargs=dict(num=meeting.number,
                                                                       owner=meeting.agenda.owner_email(),
                                                                       name=meeting.agenda.name))
        self.client.login(username="******", password="******")
        r = self.client.post(url, {
            'savename': "/no/this/should/not/work/it/is/too/long",
            'saveas': "saveas",
            })
        self.assertEqual(r.status_code, 302)
        self.assertEqual(urlparse.urlparse(r.url).path, url)
        # TODO: Verify that an error message was in fact returned.

        r = self.client.post(url, {
            'savename': "/invalid/chars/",
            'saveas': "saveas",
            })
        # TODO: Verify that an error message was in fact returned.
        self.assertEqual(r.status_code, 302)
        self.assertEqual(urlparse.urlparse(r.url).path, url)

        # Non-ASCII alphanumeric characters
        r = self.client.post(url, {
            'savename': u"f\u00E9ling",
            'saveas': "saveas",
            })
        # TODO: Verify that an error message was in fact returned.
        self.assertEqual(r.status_code, 302)
        self.assertEqual(urlparse.urlparse(r.url).path, url)
示例#29
0
    def test_material_presentations(self):
        doc = self.create_slides()
        meeting = make_meeting_test_data()
        meeting.session_set.filter(group__acronym='mars').update(group=doc.group)

        url = urlreverse(material_presentations,kwargs=dict(name=doc.name))
        login_testing_unauthorized(self, "secretary", url)

        r = self.client.get(url)
        self.assertEqual(r.status_code, 200)

        url = urlreverse(material_presentations,kwargs=dict(name=doc.name,seq=1))
        r = self.client.get(url)
        self.assertEqual(r.status_code, 200)

        when = meeting.agenda.assignments.filter(session__group__acronym='testteam').first().timeslot.time
        mdw = when.date().isoformat()
        dow = ['mon','tue','wed','thu','fri','sat','sun'][when.weekday()]

        for kw in [ dict(),
                    dict(seq=1),
                    dict(week_day=dow),
                    dict(week_day=dow,seq=1),
                    dict(date=mdw),
                    dict(date=mdw,seq=1),
                    dict(date=mdw+'-0930'),
                    dict(date=mdw+'-0930',seq=1),
                   ]:
            kw['name'] = doc.name
            kw['acronym'] = 'testteam'
            url = urlreverse(material_presentations,kwargs=kw)
            r = self.client.get(url)
            self.assertEqual(r.status_code, 200)
示例#30
0
文件: tests_api.py 项目: algby/ietfdb
    def test_create_new_slot(self):
        meeting = make_meeting_test_data()

        slot_time = datetime.date.today()

        url = urlreverse("ietf.meeting.ajax.timeslot_slotsurl",
                         kwargs=dict(num=meeting.number))
        post_data = {
            'type' : 'plenary',
            'time' : slot_time.strftime("%Y-%m-%d"),
            'duration': '08:00:00',
        }

        # unauthorized post
        prior_slotcount = meeting.timeslot_set.count()
        self.client.login(username="******", password="******")
        r = self.client.post(url, post_data)
        self.assertEqual(r.status_code, 403)
        self.assertEqual(meeting.timeslot_set.count(),prior_slotcount)

        # create slot
        self.client.login(username="******", password="******")
        r = self.client.post(url, post_data)
        self.assertEqual(r.status_code, 201)
        self.assertTrue(meeting.timeslot_set.filter(time=slot_time))
        self.assertEqual(meeting.timeslot_set.count(),prior_slotcount+1)
示例#31
0
    def test_materials(self):
        meeting = make_meeting_test_data()
        session = Session.objects.filter(meeting=meeting, group__acronym="mars").first()

        self.write_materials_files(meeting, session)
        
        # session agenda
        r = self.client.get(urlreverse("ietf.meeting.views.session_agenda",
                                       kwargs=dict(num=meeting.number, session=session.group.acronym)))
        self.assertEqual(r.status_code, 200)
        self.assertTrue("1. WG status" in unicontent(r))

        # early materials page
        r = self.client.get(urlreverse("ietf.meeting.views.current_materials"))
        self.assertEqual(r.status_code, 302)
        self.assertTrue(meeting.number in r["Location"])

        r = self.client.get(urlreverse("ietf.meeting.views.materials", kwargs=dict(meeting_num=meeting.number)))
        self.assertEqual(r.status_code, 200)
        q = PyQuery(r.content)
        row = q('#content td div:contains("%s")' % str(session.group.acronym)).closest("tr")
        self.assertTrue(row.find('a:contains("Agenda")'))
        self.assertTrue(row.find('a:contains("Minutes")'))
        self.assertTrue(row.find('a:contains("Slideshow")'))
        self.assertFalse(row.find("a:contains(\"Bad Slideshow\")"))
示例#32
0
    def test_edit_agenda(self):
        meeting = make_meeting_test_data()

        self.client.login(username="******", password="******")
        r = self.client.get(urlreverse("ietf.meeting.views.edit_agenda", kwargs=dict(num=meeting.number)))
        self.assertEqual(r.status_code, 200)
        self.assertTrue("load_scheduledsessions" in r.content)
示例#33
0
    def test_materials(self):
        meeting = make_meeting_test_data()
        session = Session.objects.filter(meeting=meeting, group__acronym="mars").first()
        draft = Document.objects.filter(type="draft", group=session.group).first()

        self.write_materials_file(meeting, session.materials.get(type="agenda"),
                                  "1. WG status (15 minutes)\n\n2. Status of %s\n\n" % draft.name)

        self.write_materials_file(meeting, session.materials.get(type="minutes"),
                                  "1. More work items underway\n\n2. The draft will be finished before next meeting\n\n")

        self.write_materials_file(meeting, session.materials.get(type="slides"),
                                  "This is a slideshow")
        
        # session agenda
        r = self.client.get(urlreverse("ietf.meeting.views.session_agenda",
                                       kwargs=dict(num=meeting.number, session=session.group.acronym)))
        self.assertEqual(r.status_code, 200)
        self.assertTrue("1. WG status" in r.content)

        # early materials page
        r = self.client.get(urlreverse("ietf.meeting.views.current_materials"))
        self.assertEqual(r.status_code, 302)
        self.assertTrue(meeting.number in r["Location"])

        r = self.client.get(urlreverse("ietf.meeting.views.materials", kwargs=dict(meeting_num=meeting.number)))
        self.assertEqual(r.status_code, 200)
        #debug.show('r.content')
        q = PyQuery(r.content)
        row = q('.ietf-materials b:contains("%s")' % str(session.group.acronym.upper())).closest("tr")
        self.assertTrue(row.find("a:contains(\"Agenda\")"))
        self.assertTrue(row.find("a:contains(\"Minutes\")"))
        self.assertTrue(row.find("a:contains(\"Slideshow\")"))
示例#34
0
 def test_get_times(self):
     meeting = make_meeting_test_data()
     timeslot = meeting.timeslot_set.filter(type='session').first()
     day = (timeslot.time.weekday() + 1) % 7 + 1  # fix up to match django __week_day filter
     times = get_times(meeting,day)
     values = [ x[0] for x in times ]
     self.assertTrue(times)
     self.assertTrue(timeslot.time.strftime('%H%M') in values)
示例#35
0
 def test_blue_sheets_generate(self):
     meeting = make_meeting_test_data()
     url = reverse('ietf.secr.meetings.views.blue_sheet_generate',
                   kwargs={'meeting_id': meeting.number})
     self.client.login(username="******", password="******")
     response = self.client.post(url)
     self.assertEqual(response.status_code, 302)
     self.assertTrue(os.path.exists(self.bluesheet_path))
示例#36
0
文件: tests_api.py 项目: algby/ietfdb
    def test_get_room_json(self):
        meeting = make_meeting_test_data()
        room = meeting.room_set.first()

        r = self.client.get(urlreverse("ietf.meeting.ajax.timeslot_roomurl", kwargs=dict(num=meeting.number, roomid=room.pk)))
        self.assertEqual(r.status_code, 200)
        info = json.loads(r.content)
        self.assertEqual(info["name"], room.name)
示例#37
0
    def test_feed(self):
        meeting = make_meeting_test_data()
        session = Session.objects.filter(meeting=meeting, group__acronym="mars").first()

        r = self.client.get("/feed/wg-proceedings/")
        self.assertEqual(r.status_code, 200)
        self.assertTrue("agenda" in r.content)
        self.assertTrue(session.group.acronym in r.content)
示例#38
0
 def test_get_times(self):
     meeting = make_meeting_test_data()
     timeslot = meeting.timeslot_set.filter(type='session').first()
     day = (timeslot.time.weekday() +
            1) % 7 + 1  # fix up to match django __week_day filter
     times = get_times(meeting, day)
     values = [x[0] for x in times]
     self.assertTrue(times)
     self.assertTrue(timeslot.time.strftime('%H%M') in values)
示例#39
0
 def test_view(self):
     "View Test"
     meeting = make_meeting_test_data()
     url = reverse('meetings_view', kwargs={'meeting_id':meeting.number})
     self.client.login(username="******", password="******")
     response = self.client.get(url)
     self.assertEqual(response.status_code, 200)
     q = PyQuery(response.content)
     self.assertEqual(len(q('#id_schedule_selector option')),2)
示例#40
0
    def test_meeting_json(self):
        meeting = make_meeting_test_data()

        r = self.client.get(
            urlreverse("ietf.meeting.ajax.meeting_json",
                       kwargs=dict(num=meeting.number)))
        self.assertEqual(r.status_code, 200)
        info = json.loads(r.content)
        self.assertEqual(info["name"], meeting.number)
示例#41
0
    def test_slot_json(self):
        meeting = make_meeting_test_data()
        slot = meeting.timeslot_set.all()[0]

        url = urlreverse("ietf.meeting.ajax.timeslot_sloturl",
                         kwargs=dict(num=meeting.number, slotid=slot.pk))
        r = self.client.get(url)
        self.assertEqual(r.status_code, 200)
        info = json.loads(r.content)
        self.assertEqual(info["timeslot_id"], slot.pk)
示例#42
0
 def test_meetings_times(self):
     make_meeting_test_data()
     url = reverse('ietf.secr.meetings.views.times',
                   kwargs={
                       'meeting_id': 42,
                       'schedule_name': 'test-agenda'
                   })
     self.client.login(username="******", password="******")
     response = self.client.get(url)
     self.assertEqual(response.status_code, 200)
     response = self.client.post(url, {
         'day': 0,
         'time': '08:00',
         'duration': '01:00',
         'name': 'Test Morning Session'
     },
                                 follow=True)
     self.assertRedirects(response, url)
     self.assertTrue('Test Morning Session' in response.content)
示例#43
0
文件: tests_api.py 项目: algby/ietfdb
    def test_slot_json(self):
        meeting = make_meeting_test_data()
        slot = meeting.timeslot_set.all()[0]

        url = urlreverse("ietf.meeting.ajax.timeslot_sloturl",
                         kwargs=dict(num=meeting.number, slotid=slot.pk))
        r = self.client.get(url)
        self.assertEqual(r.status_code, 200)
        info = json.loads(r.content)
        self.assertEqual(info["timeslot_id"], slot.pk)
示例#44
0
    def test_get_room_json(self):
        meeting = make_meeting_test_data()
        room = meeting.room_set.first()

        r = self.client.get(
            urlreverse("ietf.meeting.ajax.timeslot_roomurl",
                       kwargs=dict(num=meeting.number, roomid=room.pk)))
        self.assertEqual(r.status_code, 200)
        info = json.loads(r.content)
        self.assertEqual(info["name"], room.name)
示例#45
0
 def test_view(self):
     "View Test"
     meeting = make_meeting_test_data()
     url = reverse('ietf.secr.meetings.views.view',
                   kwargs={'meeting_id': meeting.number})
     self.client.login(username="******", password="******")
     response = self.client.get(url)
     self.assertEqual(response.status_code, 200)
     q = PyQuery(response.content)
     self.assertEqual(len(q('#id_schedule_selector option')), 3)
示例#46
0
文件: tests.py 项目: ekr/ietfdb
 def test_view_request(self):
     meeting = make_meeting_test_data()
     meeting.session_request_lock_message='locked'
     meeting.save()
     group = Group.objects.get(acronym='mars')
     url = reverse('ietf.secr.sreq.views.view',kwargs={'acronym':group.acronym})
     self.client.login(username="******", password="******")
     r = self.client.get(url,follow=True)
     self.assertEqual(r.status_code, 200)
     q = PyQuery(r.content)
     self.assertEqual(len(q(':disabled[name="edit"]')), 1)
示例#47
0
 def test_import_audio_files(self):
     meeting = make_meeting_test_data()
     group = Group.objects.get(acronym='mars')
     session = Session.objects.filter(meeting=meeting, group=group).first()
     status = SessionStatusName.objects.get(slug='sched')
     session.status = status
     session.save()
     timeslot = session.official_timeslotassignment().timeslot
     self.create_audio_file_for_timeslot(timeslot)
     import_audio_files(meeting)
     self.assertEqual(session.materials.filter(type='recording').count(), 1)
示例#48
0
 def test_meetings_schedule(self):
     meeting = make_meeting_test_data()
     url = reverse('ietf.secr.meetings.views.schedule',
                   kwargs={
                       'meeting_id': meeting.number,
                       'schedule_name': meeting.agenda.name,
                       'acronym': 'mars'
                   })
     self.client.login(username="******", password="******")
     response = self.client.get(url)
     self.assertEqual(response.status_code, 200)
示例#49
0
文件: tests_api.py 项目: algby/ietfdb
    def test_schedule_json(self):
        meeting = make_meeting_test_data()

        url = urlreverse("ietf.meeting.ajax.agenda_infourl",
                         kwargs=dict(num=meeting.number,
                                     owner=meeting.agenda.owner_email(),
                                     name=meeting.agenda.name))

        r = self.client.get(url)
        info = json.loads(r.content)
        self.assertEqual(info["schedule_id"], meeting.agenda.pk)
示例#50
0
 def test_main(self):
     "Main Test"
     meeting = make_meeting_test_data()
     url = reverse('ietf.secr.meetings.views.main')
     self.client.login(username="******", password="******")
     response = self.client.get(url)
     self.assertEqual(response.status_code, 200)
     response = self.client.post(url, {'meeting': meeting.number})
     url = reverse('ietf.secr.meetings.views.view',
                   kwargs={'meeting_id': meeting.number})
     self.assertRedirects(response, url)
示例#51
0
 def test_get_session(self):
     meeting = make_meeting_test_data()
     session = Session.objects.filter(meeting=meeting,
                                      group__acronym='mars').first()
     number = meeting.number
     name = session.group.acronym
     date = session.official_timeslotassignment().timeslot.time.strftime(
         '%Y%m%d')
     time = session.official_timeslotassignment().timeslot.time.strftime(
         '%H%M')
     self.assertEqual(_get_session(number, name, date, time), session)
示例#52
0
    def test_schedule_json(self):
        meeting = make_meeting_test_data()

        url = urlreverse("ietf.meeting.ajax.agenda_infourl",
                         kwargs=dict(num=meeting.number,
                                     owner=meeting.agenda.owner_email(),
                                     name=meeting.agenda.name))

        r = self.client.get(url)
        info = json.loads(r.content)
        self.assertEqual(info["schedule_id"], meeting.agenda.pk)
示例#53
0
    def test_save_agenda_as_and_read_permissions(self):
        meeting = make_meeting_test_data()

        # try to get non-existing agenda
        url = urlreverse("ietf.meeting.views.edit_agenda", kwargs=dict(num=meeting.number,
                                                                       owner=meeting.agenda.owner_email(),
                                                                       name="foo"))
        r = self.client.get(url)
        self.assertEqual(r.status_code, 404)

        # save as new name (requires valid existing agenda)
        url = urlreverse("ietf.meeting.views.edit_agenda", kwargs=dict(num=meeting.number,
                                                                       owner=meeting.agenda.owner_email(),
                                                                       name=meeting.agenda.name))
        self.client.login(username="******", password="******")
        r = self.client.post(url, {
            'savename': "foo",
            'saveas': "saveas",
            })
        self.assertEqual(r.status_code, 302)
        # Verify that we actually got redirected to a new place.
        self.assertNotEqual(urlparse.urlparse(r.url).path, url)

        # get
        schedule = meeting.get_schedule_by_name("foo")
        url = urlreverse("ietf.meeting.views.edit_agenda", kwargs=dict(num=meeting.number,
                                                                       owner=schedule.owner_email(),
                                                                       name="foo"))
        r = self.client.get(url)
        self.assertEqual(r.status_code, 200)

        schedule.visible = True
        schedule.public = False
        schedule.save()

        # get as anonymous doesn't work
        self.client.logout()
        r = self.client.get(url)
        self.assertEqual(r.status_code, 403)

        # public, now anonymous works
        schedule.public = True
        schedule.save()
        r = self.client.get(url)
        self.assertEqual(r.status_code, 200)

        # Secretariat can always see it
        schedule.visible = False
        schedule.public = False
        schedule.save()
        self.client.login(username="******", password="******")
        r = self.client.get(url)
        self.assertEqual(r.status_code, 200)
示例#54
0
 def test_create_recording(self):
     meeting = make_meeting_test_data()
     group = Group.objects.get(acronym='mars')
     session = Session.objects.filter(meeting=meeting, group=group).first()
     filename = 'ietf42-testroomt-20000101-0800.mp3'
     url = settings.IETF_AUDIO_URL + 'ietf{}/{}'.format(
         meeting.number, filename)
     doc = create_recording(session, url)
     self.assertEqual(doc.name, 'recording-42-mars-1')
     self.assertEqual(doc.group, group)
     self.assertEqual(doc.external_url, url)
     self.assertTrue(doc in session.materials.all())
示例#55
0
文件: tests.py 项目: algby/ietfdb
 def test_meetings_times_delete(self):
     meeting = make_meeting_test_data()
     qs = TimeSlot.objects.filter(meeting=meeting,type='session')
     before = qs.count()
     url = reverse('meetings_times_delete',kwargs={
         'meeting_id':42,
         'schedule_name':'test-agenda',
         'time':qs.first().time.strftime("%Y:%m:%d:%H:%M")
     })
     self.client.login(username="******", password="******")
     response = self.client.get(url)
     self.assertEqual(response.status_code, 302)
     after = TimeSlot.objects.filter(meeting=meeting,type='session').count()
     self.assertEqual(after,before - (Room.objects.filter(meeting=meeting).count()))
示例#56
0
文件: tests_api.py 项目: algby/ietfdb
    def test_constraints_json(self):
        meeting = make_meeting_test_data()
        session = Session.objects.filter(meeting=meeting, group__acronym="mars").select_related("group").first()
        c_ames = Constraint.objects.create(meeting=meeting, source=session.group,
                                           target=Group.objects.get(acronym="ames"),
                                           name_id="conflict")

        c_person = Constraint.objects.create(meeting=meeting, source=session.group,
                                             person=Person.objects.get(user__username="******"),
                                             name_id="bethere")

        r = self.client.get(urlreverse("ietf.meeting.ajax.session_constraints", kwargs=dict(num=meeting.number, sessionid=session.pk)))
        self.assertEqual(r.status_code, 200)
        constraints = json.loads(r.content)
        self.assertEqual(set([c_ames.pk, c_person.pk]), set(c["constraint_id"] for c in constraints))
示例#57
0
文件: tests_api.py 项目: algby/ietfdb
    def test_sessions_json(self):
        meeting = make_meeting_test_data()
 
        url = urlreverse("ietf.meeting.ajax.sessions_json",kwargs=dict(num=meeting.number))
        r = self.client.get(url)
        self.assertEqual(r.status_code, 200)
        info = json.loads(r.content)
        self.assertEqual(set([x['short_name'] for x in info]),set(['mars','ames']))

        schedule = meeting.agenda
        url = urlreverse("ietf.meeting.ajax.scheduledsessions_json",
                         kwargs=dict(num=meeting.number,owner=schedule.owner_email(),name=schedule.name))
        r = self.client.get(url)
        self.assertEqual(r.status_code, 200)
        info = json.loads(r.content)
        self.assertEqual(len(info),2)
示例#58
0
    def test_sessions_json(self):
        meeting = make_meeting_test_data()
 
        url = urlreverse("ietf.meeting.ajax.sessions_json",kwargs=dict(num=meeting.number))
        r = self.client.get(url)
        self.assertEqual(r.status_code, 200)
        info = json.loads(r.content)
        self.assertEqual(set([x['short_name'] for x in info]),set([s.session.short_name for s in meeting.agenda.assignments.filter(session__type_id='session')]))

        schedule = meeting.agenda
        url = urlreverse("ietf.meeting.ajax.assignments_json",
                         kwargs=dict(num=meeting.number,owner=schedule.owner_email(),name=schedule.name))
        r = self.client.get(url)
        self.assertEqual(r.status_code, 200)
        info = json.loads(r.content)
        self.assertEqual(len(info),schedule.assignments.count())
示例#59
0
文件: tests_api.py 项目: algby/ietfdb
    def test_delete_slot(self):
        meeting = make_meeting_test_data()
        slot = meeting.timeslot_set.all()[0]

        url = urlreverse("ietf.meeting.ajax.timeslot_sloturl",
                         kwargs=dict(num=meeting.number, slotid=slot.pk))

        # unauthorized delete
        self.client.login(username="******", password="******")
        r = self.client.delete(url)
        self.assertEqual(r.status_code, 403)

        # delete
        self.client.login(username="******", password="******")
        self.client.delete(url)
        self.assertTrue(not meeting.timeslot_set.filter(pk=slot.pk))
示例#60
0
文件: tests_api.py 项目: algby/ietfdb
    def test_delete_schedule(self):
        meeting = make_meeting_test_data()

        url = urlreverse("ietf.meeting.ajax.agenda_infourl",
                         kwargs=dict(num=meeting.number,
                                     owner=meeting.agenda.owner_email(),
                                     name=meeting.agenda.name))
        # unauthorized delete
        self.client.login(username="******", password="******")
        r = self.client.delete(url)
        self.assertEqual(r.status_code, 403)

        # delete
        self.client.login(username="******", password="******")
        r = self.client.delete(url)
        self.assertEqual(r.status_code, 200)
        self.assertTrue(not Schedule.objects.filter(pk=meeting.agenda.pk))