Ejemplo n.º 1
0
 def test_patterns(self):
     v = {'comments' : 'from lame collection, ripped by eac',
          'year' : 2012}
     i=Item(v)
     z = ZeroPlugin()
     z.debug = False
     z.fields = ['comments', 'year']
     z.patterns = {'comments': 'eac lame'.split(),
                   'year': '2098 2099'.split()}
     z.write_event(i)
     self.assertEqual(i.comments, '')
     self.assertEqual(i.year, 2012)
Ejemplo n.º 2
0
 def test_no_patterns(self):
     v = {'comments': 'test comment', 'day': 13, 'month': 3, 'year': 2012}
     i = Item(v)
     z = ZeroPlugin()
     z.debug = False
     z.fields = ['comments', 'month', 'day']
     z.patterns = {'comments': ['.'], 'month': ['.'], 'day': ['.']}
     z.write_event(i)
     self.assertEqual(i.comments, '')
     self.assertEqual(i.day, 0)
     self.assertEqual(i.month, 0)
     self.assertEqual(i.year, 2012)
Ejemplo n.º 3
0
 def test_patterns(self):
     v = {'comments': 'from lame collection, ripped by eac', 'year': 2012}
     i = Item(v)
     z = ZeroPlugin()
     z.debug = False
     z.fields = ['comments', 'year']
     z.patterns = {
         'comments': 'eac lame'.split(),
         'year': '2098 2099'.split()
     }
     z.write_event(i)
     self.assertEqual(i.comments, '')
     self.assertEqual(i.year, 2012)
Ejemplo n.º 4
0
    def test_patterns(self):
        z = ZeroPlugin()
        z.debug = False
        z.fields = ['comments', 'year']
        z.patterns = {'comments': u'eac lame'.split(),
                      'year': u'2098 2099'.split()}

        tags = {
            'comments': u'from lame collection, ripped by eac',
            'year': 2012,
        }
        z.write_event(None, None, tags)
        self.assertEqual(tags['comments'], None)
        self.assertEqual(tags['year'], 2012)
Ejemplo n.º 5
0
    def test_patterns(self):
        z = ZeroPlugin()
        z.debug = False
        z.fields = ['comments', 'year']
        z.patterns = {'comments': u'eac lame'.split(),
                      'year': u'2098 2099'.split()}

        tags = {
            'comments': u'from lame collection, ripped by eac',
            'year': 2012,
        }
        z.write_event(None, None, tags)
        self.assertEqual(tags['comments'], None)
        self.assertEqual(tags['year'], 2012)
Ejemplo n.º 6
0
 def test_no_patterns(self):
     i = Item(
         comments='test comment',
         day=13,
         month=3,
         year=2012,
     )
     z = ZeroPlugin()
     z.debug = False
     z.fields = ['comments', 'month', 'day']
     z.patterns = {'comments': ['.'], 'month': ['.'], 'day': ['.']}
     z.write_event(i)
     self.assertEqual(i.comments, '')
     self.assertEqual(i.day, 0)
     self.assertEqual(i.month, 0)
     self.assertEqual(i.year, 2012)
Ejemplo n.º 7
0
 def test_no_patterns(self):
     tags = {
         'comments': 'test comment',
         'day': 13,
         'month': 3,
         'year': 2012,
     }
     z = ZeroPlugin()
     z.debug = False
     z.fields = ['comments', 'month', 'day']
     z.patterns = {'comments': ['.'], 'month': ['.'], 'day': ['.']}
     z.write_event(None, None, tags)
     self.assertEqual(tags['comments'], None)
     self.assertEqual(tags['day'], None)
     self.assertEqual(tags['month'], None)
     self.assertEqual(tags['year'], 2012)
Ejemplo n.º 8
0
    def test_keep_fields(self):
        item = self.add_item_fixture(year=2016, comments=u'test comment')
        self.config['zero']['keep_fields'] = [u'year']
        self.config['zero']['fields'] = None
        self.config['zero']['update_database'] = True

        tags = {
            'comments': u'test comment',
            'year': 2016,
        }
        self.load_plugins('zero')

        z = ZeroPlugin()
        z.write_event(item, item.path, tags)
        self.assertEqual(tags['comments'], None)
        self.assertEqual(tags['year'], 2016)
Ejemplo n.º 9
0
    def test_keep_fields(self):
        item = self.add_item_fixture(year=2016, comments=u'test comment')
        self.config['zero']['keep_fields'] = [u'year']
        self.config['zero']['fields'] = None
        self.config['zero']['update_database'] = True

        tags = {
            'comments': u'test comment',
            'year': 2016,
        }
        self.load_plugins('zero')

        z = ZeroPlugin()
        z.write_event(item, item.path, tags)
        self.assertEqual(tags['comments'], None)
        self.assertEqual(tags['year'], 2016)
Ejemplo n.º 10
0
 def test_no_patterns(self):
     v = {'comments' : 'test comment',
          'day' : 13,
          'month' : 3,
          'year' : 2012}
     i=Item(v)
     z = ZeroPlugin()
     z.debug = False
     z.fields = ['comments', 'month', 'day']
     z.patterns = {'comments': ['.'],
                   'month': ['.'],
                   'day': ['.']}
     z.write_event(i)
     self.assertEqual(i.comments, '')
     self.assertEqual(i.day, 0)
     self.assertEqual(i.month, 0)
     self.assertEqual(i.year, 2012)
Ejemplo n.º 11
0
 def test_no_patterns(self):
     tags = {
         'comments': u'test comment',
         'day': 13,
         'month': 3,
         'year': 2012,
     }
     z = ZeroPlugin()
     z.debug = False
     z.fields = ['comments', 'month', 'day']
     z.patterns = {'comments': [u'.'],
                   'month': [u'.'],
                   'day': [u'.']}
     z.write_event(None, None, tags)
     self.assertEqual(tags['comments'], None)
     self.assertEqual(tags['day'], None)
     self.assertEqual(tags['month'], None)
     self.assertEqual(tags['year'], 2012)
Ejemplo n.º 12
0
 def test_no_patterns(self):
     i = Item(
         comments='test comment',
         day=13,
         month=3,
         year=2012,
     )
     z = ZeroPlugin()
     z.debug = False
     z.fields = ['comments', 'month', 'day']
     z.patterns = {'comments': ['.'],
                   'month': ['.'],
                   'day': ['.']}
     z.write_event(i)
     self.assertEqual(i.comments, '')
     self.assertEqual(i.day, 0)
     self.assertEqual(i.month, 0)
     self.assertEqual(i.year, 2012)