Ejemplo n.º 1
0
    def test_create_edit_spot_copy_expiry(self):
        dow = 1
        hour = 0
        slot = 0
        spot = models.Spot(
                        title='Legal ID',
                        type='Station ID')
        spot.put()
        constraint = models.SpotConstraint(dow=dow, hour=hour, slot=slot, spots=[spot.key()])
        constraint.put()

        now = time_util.chicago_now() + datetime.timedelta(hours=2)
        resp = self.client.post(reverse('traffic_log.views.addCopyForSpot', args=(spot.key(),)), {
            'spot_key': spot.key(),
            'body': 'You are listening to chirprario.odg',
            'underwriter': 'pretend this is an underwriter',
            'expire_on': now.strftime("%m/%d/%Y %H:%M:%S") # no timezone info
        })
        self.assertNoFormErrors(resp)

        spot_copy, is_logged = spot.get_spot_copy(dow, hour, slot)
        converted_expire_on = time_util.convert_utc_to_chicago(spot_copy.expire_on)
        self.assertEqual(converted_expire_on.timetuple(), now.timetuple())

        resp = self.client.post(reverse('traffic_log.editSpotCopy', args=(spot_copy.key(),)), {
            'spot_key': spot.key(),
            'body': 'You are listening to chirprario.odg',
            'underwriter': 'pretend this is an underwriter',
            'expire_on': spot_copy.expire_on.strftime("%m/%d/%Y %H:%M:%S") # no timezone info
        })
        self.assertNoFormErrors(resp)

        spot_copy, is_logged = spot.get_spot_copy(dow, hour, slot)
        converted_expire_on = time_util.convert_utc_to_chicago(spot_copy.expire_on)
        self.assertEqual(converted_expire_on.timetuple(), now.timetuple())
Ejemplo n.º 2
0
    def test_create_edit_spot_copy_expiry(self):
        dow = 1
        hour = 0
        slot = 0
        spot = models.Spot(title='Legal ID', type='Station ID')
        spot.put()
        constraint = models.SpotConstraint(dow=dow,
                                           hour=hour,
                                           slot=slot,
                                           spots=[spot.key()])
        constraint.put()

        now = time_util.chicago_now() + datetime.timedelta(hours=2)
        resp = self.client.post(
            reverse('traffic_log.views.addCopyForSpot', args=(spot.key(), )),
            {
                'spot_key': spot.key(),
                'body': 'You are listening to chirprario.odg',
                'underwriter': 'pretend this is an underwriter',
                'expire_on': now.strftime(
                    "%m/%d/%Y %H:%M:%S")  # no timezone info
            })
        self.assertNoFormErrors(resp)

        spot_copy, is_logged = spot.get_spot_copy(dow, hour, slot)
        converted_expire_on = time_util.convert_utc_to_chicago(
            spot_copy.expire_on)
        self.assertEqual(converted_expire_on.timetuple(), now.timetuple())

        resp = self.client.post(
            reverse('traffic_log.editSpotCopy', args=(spot_copy.key(), )),
            {
                'spot_key': spot.key(),
                'body': 'You are listening to chirprario.odg',
                'underwriter': 'pretend this is an underwriter',
                'expire_on': spot_copy.expire_on.strftime(
                    "%m/%d/%Y %H:%M:%S")  # no timezone info
            })
        self.assertNoFormErrors(resp)

        spot_copy, is_logged = spot.get_spot_copy(dow, hour, slot)
        converted_expire_on = time_util.convert_utc_to_chicago(
            spot_copy.expire_on)
        self.assertEqual(converted_expire_on.timetuple(), now.timetuple())
Ejemplo n.º 3
0
def report_entry_to_csv_dict(entry):
    return {    
        'readtime': time_util.convert_utc_to_chicago(entry.readtime),
        'dow': constants.DOW_DICT[entry.dow],                                       
        'underwriter': entry.spot_copy.underwriter,
        'slot_time': entry.scheduled.readable_slot_time,
        'title': entry.spot.title,
        'type': entry.spot.type,
        'excerpt': entry.spot_copy.body[:140]
    }
Ejemplo n.º 4
0
def report_entry_to_csv_dict(entry):
    return {
        'readtime': time_util.convert_utc_to_chicago(entry.readtime),
        'dow': constants.DOW_DICT[entry.dow],
        'underwriter': entry.spot_copy.underwriter,
        'slot_time': entry.scheduled.readable_slot_time,
        'title': entry.spot.title,
        'type': entry.spot.type,
        'excerpt': entry.spot_copy.body[:140]
    }
Ejemplo n.º 5
0
 def __init__(self, data):
     self._key = data['key']
     self.artist_name = data['artist_name']
     self.track_title = data['track_title']
     self.album_title_display = data['album_title_display']
     self.label_display = data['label_display']
     self.notes = data['notes']
     self.selector = CachedSelector(data['selector_key'])
     self.categories = data['categories']
     d = datetime(*data['established_display'])
     d = time_util.convert_utc_to_chicago(d)
     self.established_display = d
Ejemplo n.º 6
0
 def __init__(self, data):
     self._key = data['key']
     self.artist_name = data['artist_name']
     self.track_title = data['track_title']
     self.album_title_display = data['album_title_display']
     self.label_display = data['label_display']
     self.notes = data['notes']
     self.selector = CachedSelector(data['selector_key'])
     self.categories = data['categories']
     d = datetime(*data['established_display'])
     d = time_util.convert_utc_to_chicago(d)
     self.established_display = d
Ejemplo n.º 7
0
 def timestamp_display(self):
     """This is the time to show to users."""
     return time_util.convert_utc_to_chicago(self.timestamp)
Ejemplo n.º 8
0
 def created_display(self):
     """This is the time to show to users."""
     return time_util.convert_utc_to_chicago(self.created)
Ejemplo n.º 9
0
 def timestamp_display(self):
     """This is the time to show to users."""
     return time_util.convert_utc_to_chicago(self.timestamp)
Ejemplo n.º 10
0
 def created_display(self):
     """This is the time to show to users."""
     return time_util.convert_utc_to_chicago(self.created)
Ejemplo n.º 11
0
 def modified_display(self):
     return time_util.convert_utc_to_chicago(self.modified)
Ejemplo n.º 12
0
 def established_display(self):
     return time_util.convert_utc_to_chicago(self.established)
Ejemplo n.º 13
0
 def modified_display(self):
     return time_util.convert_utc_to_chicago(self.modified)
Ejemplo n.º 14
0
 def established_display(self):
     return time_util.convert_utc_to_chicago(self.established)