def get_data_for_bluetooth(self): """ Prepare OutputData for voice. Generate the message for a Notification. Return BluetoothOutputData for sending. """ logger.info("starting get_data_for_bluetooth() in Notification") data = BluetoothOutputData() data.bluetooth_mac_address = self.bluetooth_mac_address data.server_address = self.bluetooth_server_address logger.info("Sending to Bluetooth Mac Address " + data.bluetooth_mac_address + " and Bluetooth Server " + data.server_address) try: self.hospital except Hospital.DoesNotExist: self.hospital = Hospital.get_current_hospital() content = self.reminder_text() uid = vcal.get_uid() data.data = vcal.create_vcal_string(self.date, self.hospital, content, uid) logger.info("Created vCal with uid %s" % str(uid)) logger.debug("Created vCal: " + data.data) return data
def test_create_vcal_string(self): start_date = datetime(2010, 04, 04, 12, 00, 00) location = Hospital(name = "aHospital") content = "aContent in some language" uid = "43" vcal.settings.REMINDER_TIME_BEFORE_APPOINTMENT \ = timedelta(days = 1) vcal.datetime = self.FakeDatetime() vcal_data = vcal.create_vcal_string(start_date, location, content, uid) self.assertEquals(vcal_data, """BEGIN:VCALENDAR VERSION:1.0 BEGIN:VEVENT UID:43 DTSTART:20100404T120000 DTEND:20100404T130000 DESCRIPTION:aContent in some language SUMMARY:aContent in some language DTSTAMP:20100404T000000 LOCATION:aHospital DALARM:20100403T120000 AALARM:20100403T120000 END:VEVENT END:VCALENDAR""") vcal.settings = settings vcal.datetime = datetime