Skip to content

Commit d5b14f3

Browse files
committed
Rewrite meeting tests: add fake data generator, rewrite the
SimpleUrlTest tests to work with fake data and expand them a bit (they are still pretty basic), rewrite the agenda editing tests to work with the small generated fake data, delete those tests that are trivial or only testing fixture facts as opposed to actually exercising the code, combine some of them, expand most to actually check the returned JSON and generally clean up the copy-paste mess of incorrect comments and incorrect POST data. At this point, no tests are using the real data base test machinery, so one can run the full test suite with just python manage.py test --settings=settings_sqlitetest This takes about 72 seconds one a 2.4 GHz Intel Core 2. The test-crawler and other real data tests take somewhat longer, though. - Legacy-Id: 7069
1 parent 3408b73 commit d5b14f3

18 files changed

Lines changed: 658 additions & 26152 deletions

ietf/meeting/test_data.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import datetime
2+
3+
from ietf.utils.test_data import make_test_data
4+
from ietf.meeting.models import Meeting, Room, TimeSlot, Session, Schedule, ScheduledSession
5+
from ietf.person.models import Person
6+
from ietf.doc.models import Document, State
7+
from ietf.group.models import Group
8+
9+
10+
def make_meeting_test_data():
11+
make_test_data()
12+
system_person = Person.objects.get(name="(System)")
13+
plainman = Person.objects.get(user__username="plain")
14+
15+
meeting = Meeting.objects.get(number="42", type="ietf")
16+
schedule = Schedule.objects.create(meeting=meeting, owner=plainman, name="test-agenda", visible=True, public=True)
17+
room = Room.objects.create(meeting=meeting, name="Test Room", capacity=123)
18+
19+
# mars WG
20+
slot = TimeSlot.objects.create(meeting=meeting, type_id="session", duration=30 * 60, location=room,
21+
time=datetime.datetime.combine(datetime.date.today(), datetime.time(9, 30)))
22+
mars_session = Session.objects.create(meeting=meeting, group=Group.objects.get(acronym="mars"),
23+
attendees=10, requested_by=system_person,
24+
requested_duration=20, status_id="sched",
25+
scheduled=datetime.datetime.now())
26+
ScheduledSession.objects.create(timeslot=slot, session=mars_session, schedule=schedule)
27+
28+
# ames WG
29+
slot = TimeSlot.objects.create(meeting=meeting, type_id="session", duration=30 * 60, location=room,
30+
time=datetime.datetime.combine(datetime.date.today(), datetime.time(10, 30)))
31+
ames_session = Session.objects.create(meeting=meeting, group=Group.objects.get(acronym="ames"),
32+
attendees=10, requested_by=system_person,
33+
requested_duration=20, status_id="sched",
34+
scheduled=datetime.datetime.now())
35+
ScheduledSession.objects.create(timeslot=slot, session=ames_session, schedule=schedule)
36+
37+
meeting.agenda = schedule
38+
meeting.save()
39+
40+
doc = Document.objects.create(name='agenda-mars-ietf-42', type_id='agenda', title="Agenda", external_url="agenda-mars")
41+
doc.set_state(State.objects.get(type=doc.type_id, slug="active"))
42+
mars_session.materials.add(doc)
43+
44+
doc = Document.objects.create(name='minutes-mars-ietf-42', type_id='minutes', title="Minutes", external_url="minutes-mars")
45+
doc.set_state(State.objects.get(type=doc.type_id, slug="active"))
46+
mars_session.materials.add(doc)
47+
48+
doc = Document.objects.create(name='slides-mars-ietf-42', type_id='slides', title="Slideshow", external_url="slides-mars")
49+
doc.set_state(State.objects.get(type=doc.type_id, slug="active"))
50+
mars_session.materials.add(doc)
51+
52+
return meeting
53+
54+
55+

ietf/meeting/tests/__init__.py

Lines changed: 0 additions & 16 deletions
This file was deleted.

ietf/meeting/tests/agenda-83-utc.html.good

Lines changed: 0 additions & 12146 deletions
This file was deleted.

ietf/meeting/tests/agenda-83.csv.good

Lines changed: 0 additions & 172 deletions
This file was deleted.

ietf/meeting/tests/agenda-83.html.good

Lines changed: 0 additions & 12081 deletions
This file was deleted.

0 commit comments

Comments
 (0)