def test_truncator_should_handle_NoneType_content(self):
        with patch.dict('dasdocc.aggregator.lib.updaters.feed_updater.FEED_FIELDS', self.FIELDS):
            test_data = self.test_data
            test_data['field1'] = None
            result = truncate(self.test_data)

            assert_equals(result['field1'], None)
    def test_truncation_does_not_happen_on_unspecified_fields(self):
        with patch.dict('dasdocc.aggregator.lib.updaters.feed_updater.FEED_FIELDS', self.FIELDS):
            test_data = self.test_data
            test_data['unspecified_field'] = 'a'
            result = truncate(self.test_data)

            assert_equals(result['unspecified_field'], 'a')
    def test_truncation_of_fields_works_properly(self):
        with patch.dict('dasdocc.aggregator.lib.updaters.feed_updater.FEED_FIELDS', self.FIELDS):
            result = truncate(self.test_data)

            assert_equals(len(result['field1']), 10)
            assert_equals(len(result['field2']), 10)
            assert_equals(len(result['field3']), 15)
 def test_proper_use_of_truncator(self):
     with patch.dict('dasdocc.aggregator.lib.updaters.feed_updater.FEED_FIELDS', self.FIELDS):
         result = truncate(self.test_data)
         assert_true(result['field1'].endswith('...'))