def save_model(self, request, obj, form, change): if change: meeting = obj else: meeting = Meeting( date=form.cleaned_data['date'], start_time=form.cleaned_data['start_time'], end_time=form.cleaned_data['end_time'], country=form.cleaned_data['country'], short_name=form.cleaned_data['short_name'], description=form.cleaned_data['description'] ) meeting.save() self.meeting = meeting
def startCommand(self, meetingDB, meetingInProgress, usernames, shuffle, channel_id): if meetingInProgress: self.sendSlackMessage("Meeting already in progress") return HttpResponse() if shuffle: random.shuffle(usernames) meetingDB = Meeting(channel=channel_id, meetingOrder=json.dumps(usernames), questionNum=1, currentMember=usernames[0]) meetingDB.save() self.sendSlackMessage("Let's get this meeting started! The order today will be: " + ", ".join(usernames)) self.sendSlackMessage(usernames[0] + ": What did you do since your last standup?") return HttpResponse()
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()