Ejemplo n.º 1
0
    def test_init_no_id(self):
        processor = PreProcessor(classname="test.processorclass")

        self.assertIsNotNone(processor)
        self.assertIsNone(processor.id)
        self.assertEqual("test.processorclass", processor.classname)
        self.assertEqual({'classname': 'test.processorclass'}, processor.to_document())
Ejemplo n.º 2
0
    def test_init_with_id(self):
        processor = PreProcessor(classname="test.processorclass")
        processor.id = '666'

        self.assertIsNotNone(processor)
        self.assertIsNotNone(processor.id)
        self.assertEqual('666', processor.id)
        self.assertEqual("test.processorclass", processor.classname)
        self.assertEqual({'_id': '666', 'classname': 'test.processorclass'}, processor.to_document())
Ejemplo n.º 3
0
    def test_from_document(self):
        processor1 = PreProcessor.from_document(
            {'classname': 'test.processorclass'})
        self.assertIsNotNone(processor1)
        self.assertIsNone(processor1.id)
        self.assertEqual("test.processorclass", processor1.classname)

        processor2 = PreProcessor.from_document({
            '_id':
            '666',
            'classname':
            'test.processorclass'
        })
        self.assertIsNotNone(processor2)
        self.assertIsNotNone(processor2.id)
        self.assertEqual('666', processor2.id)
        self.assertEqual("test.processorclass", processor2.classname)
Ejemplo n.º 4
0
 def _get_entity(self, classname):
     return PreProcessor(classname)
Ejemplo n.º 5
0
 def test_repr_with_id(self):
     processor2 = PreProcessor.from_document({'_id': '666', 'classname': 'test.processorclass'})
     self.assertEquals("<PreProcessor(id='666', classname='test.processorclass')>", str(processor2))
Ejemplo n.º 6
0
 def test_repr_no_id(self):
     processor1 = PreProcessor.from_document({'classname': 'test.processorclass'})
     self.assertEquals("<PreProcessor(id='n/a', classname='test.processorclass')>", str(processor1))
Ejemplo n.º 7
0
 def test_from_document_no_id(self):
     processor1 = PreProcessor.from_document({'classname': 'test.processorclass'})
     self.assertIsNotNone(processor1)
     self.assertIsNone(processor1.id)
     self.assertEqual("test.processorclass", processor1.classname)