diff --git a/doc/hitlist.rst b/doc/hitlist.rst index 4949285..44af397 100644 --- a/doc/hitlist.rst +++ b/doc/hitlist.rst @@ -48,11 +48,7 @@ Publish an event * Verify that events page shows that event as being published (ie, ready to announce) * Verify that events page does not show the other event as being published -Kinda-sorta-mostly done in :func:`usergroup.selenium_tests.create_and_manipulate_meetings_test.TestEventCreationAndPublication.testNewEventReadyToPublish`, although it only uses one event. - -* TODO: Switch to using a fixture instead of clicky-clicky to save time. -* TODO: Start with two unpublished events, not one -* TODO: Add verification that the second event is not published. +Implemented in :func:`usergroup.django_tests.event_manipulation_test.TestPublishSomeEvents.test_unpublished_events_show_as_unpublished` Normal users cannot see unpublished events ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/usergroup/django_tests/event_manipulation_test.py b/usergroup/django_tests/event_manipulation_test.py index 1271e08..8c710e9 100644 --- a/usergroup/django_tests/event_manipulation_test.py +++ b/usergroup/django_tests/event_manipulation_test.py @@ -56,3 +56,26 @@ def test_ready_to_publish(self): response = self.client.get('/events') self.assertContains(response, '') + +class TestPublishSomeEvents(django.test.TestCase): + """Test that only published events show as being published.""" + + fixtures = ['test_admin_user', 'two_unpublished_events'] + + def test_unpublished_events_show_as_unpublished(self): + """Test that only published events show as being published.""" + self.client.login(username="admin", password="admin") + response = self.client.get('/events') + #Two events, ready to publish + self.assertContains(response, '') + self.assertContains(response, '') + #Publish the first event + response = self.client.post('/event/1/publish', follow=True) + #First event should now be ready for announcement + self.assertContains(response, '') + #Second event should still be waiting to be published + self.assertContains(response, '') diff --git a/usergroup/fixtures/two_unpublished_events.json b/usergroup/fixtures/two_unpublished_events.json new file mode 100644 index 0000000..9024df0 --- /dev/null +++ b/usergroup/fixtures/two_unpublished_events.json @@ -0,0 +1,36 @@ +[ + { + "fields": { + "announcement": null, + "created_by": 1, + "created_on": "2012-02-25 23:26:18", + "emailed": false, + "end": "2012-03-30 20:00:00", + "html": "

\n

March 2012 SLUG Meeting

\n

\n

\n

Summary

\n

\n\n

\n

Details

\n

\n

Details TBA.

\n

\n

Location

\n

\n

Google Sydney\n Level 5, Workplace 6\n 48 Pirrama Road\n Pyrmont, NSW

\n

Map: http://localhost:8000/map

\n

\n

Getting there

\n

\n

The Google office is the big black building marked \"Accenture\" opposite\nStar City Pirrama Road facade.

\n

If using the trains, you can go either get off at;

\n\n

If using the buses, the route 443 stops right out front of the building.

\n

If using the light rail, get off at Star City station and walk across the\nstreet.

\n

If you drive, then you can look for parking on the suburban streets around\nthe office (or pay for parking at the Casino), and then walk from there.

\n

\n

Afterwards

\n

\n

We'll be aiming to finish by 8pm and will be heading to the Pyrmont Bridge\nHotel (PBH) afterwards to socalise and eat dinner. The PBH is marked on the\nmap.

", + "input": "====== {{event.start|date:\"F\"}} {{event.start.year}} SLUG Meeting ======\r\n\r\n====Summary====\r\n\r\n * Date: Friday, {{event.start}}\r\n * Start: Arrive at 6pm for a 6:30pm start\r\n * Format: TBA\r\n * RSVP: http://{{ request.get_host }}{{event.get_url}}\r\n * Suggest or sign up for a talk at http://{{ request.get_host }}/talks\r\n\r\n==== Details ====\r\n\r\n{% for item in agenda %}\r\n - {{ item.offer.displayname }} - {{ item.offer.title }}\r\n{% empty %}\r\nDetails TBA.\r\n{% endfor %}\r\n\r\n====Location====\r\n\r\n Google Sydney\r\n Level 5, Workplace 6\r\n 48 Pirrama Road\r\n Pyrmont, NSW\r\n\r\n Map: http://{{ request.get_host }}/map\r\n\r\n-- Getting there --\r\n\r\nThe Google office is the big black building marked \"Accenture\" opposite\r\nStar City Pirrama Road facade.\r\n\r\nIf using the trains, you can go either get off at;\r\n\r\n * Town Hall station, head towards Darling Harbour, walk across the Pyrmont\r\n footbridge and then follow Pirrama Road towards Star city.\r\n * Central station, then follow the light rail instructions.\r\n\r\nIf using the buses, the route 443 stops right out front of the building.\r\n\r\nIf using the light rail, get off at Star City station and walk across the\r\nstreet.\r\n\r\nIf you drive, then you can look for parking on the suburban streets around\r\nthe office (or pay for parking at the Casino), and then walk from there.\r\n\r\n=== Afterwards ===\r\n\r\nWe'll be aiming to finish by 8pm and will be heading to the Pyrmont Bridge\r\nHotel (PBH) afterwards to socalise and eat dinner. The PBH is marked on the\r\nmap.\r\n", + "name": "Monthly Meeting", + "plaintext": "====== March 2012 SLUG Meeting ======\r\n\r\n====Summary====\r\n\r\n * Date: Friday, March 30, 2012, 6 p.m.\r\n * Start: Arrive at 6pm for a 6:30pm start\r\n * Format: TBA\r\n * RSVP: http://localhost:8000/event/2\r\n * Suggest or sign up for a talk at http://localhost:8000/talks\r\n\r\n==== Details ====\r\n\r\n\r\nDetails TBA.\r\n\r\n\r\n====Location====\r\n\r\n Google Sydney\r\n Level 5, Workplace 6\r\n 48 Pirrama Road\r\n Pyrmont, NSW\r\n\r\n Map: http://localhost:8000/map\r\n\r\n-- Getting there --\r\n\r\nThe Google office is the big black building marked \"Accenture\" opposite\r\nStar City Pirrama Road facade.\r\n\r\nIf using the trains, you can go either get off at;\r\n\r\n * Town Hall station, head towards Darling Harbour, walk across the Pyrmont\r\n footbridge and then follow Pirrama Road towards Star city.\r\n * Central station, then follow the light rail instructions.\r\n\r\nIf using the buses, the route 443 stops right out front of the building.\r\n\r\nIf using the light rail, get off at Star City station and walk across the\r\nstreet.\r\n\r\nIf you drive, then you can look for parking on the suburban streets around\r\nthe office (or pay for parking at the Casino), and then walk from there.\r\n\r\n=== Afterwards ===\r\n\r\nWe'll be aiming to finish by 8pm and will be heading to the Pyrmont Bridge\r\nHotel (PBH) afterwards to socalise and eat dinner. The PBH is marked on the\r\nmap.\r\n", + "published": false, + "start": "2012-03-30 18:00:00" + }, + "model": "usergroup.event", + "pk": 1 + }, + { + "fields": { + "announcement": null, + "created_by": 2, + "created_on": "2012-03-20 12:21:05", + "emailed": false, + "end": "2012-03-30 20:00:00", + "html": "

\n

March 2012 SLUG Meeting

\n

\n

\n

Summary

\n

\n\n

\n

Details

\n

\n

Details TBA.

\n

\n

Location

\n

\n

Google Sydney\n Level 5, Workplace 6\n 48 Pirrama Road\n Pyrmont, NSW

\n

Map: http://localhost:8000/map

\n

\n

Getting there

\n

\n

The Google office is the big black building marked \"Accenture\" opposite\nStar City Pirrama Road facade.

\n

If using the trains, you can go either get off at;

\n\n

If using the buses, the route 443 stops right out front of the building.

\n

If using the light rail, get off at Star City station and walk across the\nstreet.

\n

If you drive, then you can look for parking on the suburban streets around\nthe office (or pay for parking at the Casino), and then walk from there.

\n

\n

Afterwards

\n

\n

We'll be aiming to finish by 8pm and will be heading to the Pyrmont Bridge\nHotel (PBH) afterwards to socalise and eat dinner. The PBH is marked on the\nmap.

", + "input": "====== {{event.start|date:\"F\"}} {{event.start.year}} SLUG Meeting ======\r\n\r\n====Summary====\r\n\r\n * Date: Friday, {{event.start}}\r\n * Start: Arrive at 6pm for a 6:30pm start\r\n * Format: TBA\r\n * RSVP: http://{{ request.get_host }}{{event.get_url}}\r\n * Suggest or sign up for a talk at http://{{ request.get_host }}/talks\r\n\r\n==== Details ====\r\n\r\n{% for item in agenda %}\r\n - {{ item.offer.displayname }} - {{ item.offer.title }}\r\n{% empty %}\r\nDetails TBA.\r\n{% endfor %}\r\n\r\n====Location====\r\n\r\n Google Sydney\r\n Level 5, Workplace 6\r\n 48 Pirrama Road\r\n Pyrmont, NSW\r\n\r\n Map: http://{{ request.get_host }}/map\r\n\r\n-- Getting there --\r\n\r\nThe Google office is the big black building marked \"Accenture\" opposite\r\nStar City Pirrama Road facade.\r\n\r\nIf using the trains, you can go either get off at;\r\n\r\n * Town Hall station, head towards Darling Harbour, walk across the Pyrmont\r\n footbridge and then follow Pirrama Road towards Star city.\r\n * Central station, then follow the light rail instructions.\r\n\r\nIf using the buses, the route 443 stops right out front of the building.\r\n\r\nIf using the light rail, get off at Star City station and walk across the\r\nstreet.\r\n\r\nIf you drive, then you can look for parking on the suburban streets around\r\nthe office (or pay for parking at the Casino), and then walk from there.\r\n\r\n=== Afterwards ===\r\n\r\nWe'll be aiming to finish by 8pm and will be heading to the Pyrmont Bridge\r\nHotel (PBH) afterwards to socalise and eat dinner. The PBH is marked on the\r\nmap.\r\n", + "name": "asfdadsf", + "plaintext": "====== March 2012 SLUG Meeting ======\r\n\r\n====Summary====\r\n\r\n * Date: Friday, March 30, 2012, 6 p.m.\r\n * Start: Arrive at 6pm for a 6:30pm start\r\n * Format: TBA\r\n * RSVP: http://localhost:8000/event/3\r\n * Suggest or sign up for a talk at http://localhost:8000/talks\r\n\r\n==== Details ====\r\n\r\n\r\nDetails TBA.\r\n\r\n\r\n====Location====\r\n\r\n Google Sydney\r\n Level 5, Workplace 6\r\n 48 Pirrama Road\r\n Pyrmont, NSW\r\n\r\n Map: http://localhost:8000/map\r\n\r\n-- Getting there --\r\n\r\nThe Google office is the big black building marked \"Accenture\" opposite\r\nStar City Pirrama Road facade.\r\n\r\nIf using the trains, you can go either get off at;\r\n\r\n * Town Hall station, head towards Darling Harbour, walk across the Pyrmont\r\n footbridge and then follow Pirrama Road towards Star city.\r\n * Central station, then follow the light rail instructions.\r\n\r\nIf using the buses, the route 443 stops right out front of the building.\r\n\r\nIf using the light rail, get off at Star City station and walk across the\r\nstreet.\r\n\r\nIf you drive, then you can look for parking on the suburban streets around\r\nthe office (or pay for parking at the Casino), and then walk from there.\r\n\r\n=== Afterwards ===\r\n\r\nWe'll be aiming to finish by 8pm and will be heading to the Pyrmont Bridge\r\nHotel (PBH) afterwards to socalise and eat dinner. The PBH is marked on the\r\nmap.\r\n", + "published": false, + "start": "2012-03-30 18:00:00" + }, + "model": "usergroup.event", + "pk": 2 + } +] diff --git a/usergroup/selenium_tests/create_and_manipulate_meetings_test.py b/usergroup/selenium_tests/create_and_manipulate_meetings_test.py index c032702..c67ae31 100755 --- a/usergroup/selenium_tests/create_and_manipulate_meetings_test.py +++ b/usergroup/selenium_tests/create_and_manipulate_meetings_test.py @@ -32,38 +32,6 @@ def get_id_and_action_from_url(self, event_url): event_action = event_url[2] return event_id, event_action - def do_two_events(self): - """Create two events; publish the first event. - - TODO: this should probably be replaced with a fixture.""" - self.doLogin() - #create first event - event_url = self.do_create_event() - first_event_id, _ = self.get_id_and_action_from_url(event_url) - #create second event - event_url = self.do_create_event(friday=2) - second_event_id, _ = self.get_id_and_action_from_url(event_url) - #Go to events page; publish first event - self.browser.find_element_by_id("events_link").click() - submit = self.browser.find_element_by_id("submit_%s" % first_event_id) - submit.click() - self.doLogout() - - return first_event_id, second_event_id - - def testPublishedEventReadyToAnnounce(self): - """Newly created events should be in the unpublished state.""" - #FIXME: Nothing being tested here is clientside, so use the test client - self.doLogin() - event_url = self.do_create_event() - event_id, _ = self.get_id_and_action_from_url(event_url) - self.browser.find_element_by_id("events_link").click() - submit = self.browser.find_element_by_id("submit_%s" % event_id) - submit.click() - submit = self.browser.find_element_by_id("submit_%s" % event_id) - submit_text = submit.get_attribute("value") - self.assertEqual(u"Announce event via email", submit_text, msg=submit) - def testUnpublishedEventInvisibleToAnonymousUsers(self): """Create two events; publish one; log out. Should only see one.""" #FIXME: Nothing being tested here is clientside, so use the test client