def test_meeting_has_detail_method(self): """ Tests the has_detail method """ # Create a meeting calgary_2014 = Meeting(year=2014, title='Calgary 2014', location='Calgary', associated_with='AAPA') calgary_2014.save() # Create a default page tree create_django_page_tree() # IF no fiber page then has_detail should be false self.assertEqual(calgary_2014.has_detail(), False) # Call page constructor method calgary_2014.create_fiber_page() # If fiber page then has_detail should be true self.assertEqual(calgary_2014.has_detail(), True) cfp = Page.objects.get(url__exact=2014) # get tha page instance cfp.is_public = False # set to not public cfp.save() # save the change self.assertEqual(calgary_2014.has_detail(), False) # Now has detail should return false
def test_meeting_create_fiber_page_method(self): """ Tests the fiber page constructor method. The fiber page method get_absolute_url does not work as expected. Not sure why.... """ # Create a meeting calgary_2014 = Meeting(year=2014, title='Calgary 2014', location='Calgary', associated_with='AAPA') calgary_2014.save() # Create a default page tree create_django_page_tree() # Call page constructor method calgary_2014.create_fiber_page() # Fetch the fiber page we just created calgary_2014_fiber_page = Page.objects.get(url__exact='2014') # Test the attributes of the fiber page self.assertEqual(calgary_2014_fiber_page.parent, Page.objects.get(url__exact='meetings')) self.assertEqual(calgary_2014_fiber_page.url, '2014') self.assertEqual(calgary_2014_fiber_page.title, 'Calgary 2014') #self.assertEqual(calgary_2014_fiber_page.get_absolute_url, '/meetings/2014/') TODO Whys does this test fail? # Test that the page renders response = self.client.get('/meetings/2014/') self.assertEqual(response.status_code, 200)
def create_three_meetings_with_pages(): # Create home fiber tree create_django_page_tree() # Create meeting instances calgary = Meeting(year=2014, title='Calgary 2014', location='Calgary, AB', associated_with='AAPA') calgary.create_fiber_page() calgary.save() san_francisco = Meeting(year=2015, title='San Francisco 2015', location='San Francisco, CA', associated_with='SAA') san_francisco.create_fiber_page() san_francisco.save() atlanta = Meeting(year=2016, title='Atlanta 2016', location='Atlanta, GA', associated_with='AAPA') atlanta.create_fiber_page() atlanta.save()