Exemplo n.º 1
0
 def load_descriptor(self):
     """
     Set fields from descriptor file
     """
     descriptor = ReadDescriptor(self.Meta.descriptor, self.Meta.descriptor_model)
     self.fields = descriptor.get_fields()
     self.exclude_fields()
Exemplo n.º 2
0
 def load_descriptor(self):
     """
     Set fields from descriptor file
     """
     descriptor = ReadDescriptor(self.Meta.descriptor,
                                 self.Meta.descriptor_model)
     self.fields = descriptor.get_fields()
     self.exclude_fields()
Exemplo n.º 3
0
class ReadDescriptorTestCase(TestCase):

    def setUp(self):
        self.descriptor = ReadDescriptor(file_name=JSON_FILE, model_name='Contact')

    def test_readed_file(self):
        self.assertTrue(self.descriptor.source)

    def test_get_fields(self):
        self.assertEquals(self.descriptor.get_fields(), ["name", "year", "last"])

    def test_invalid_model(self):
        descriptor = ReadDescriptor(file_name=JSON_FILE, model_name='TestInvalidModel')
        self.assertRaises(InvalidModel, lambda: descriptor.get_model())

    def test_invalid_file(self):
        self.assertRaises(InvalidDescriptor, lambda: ReadDescriptor(file_name='invalid_file.er',
                          model_name='TestInvalidModel'))
Exemplo n.º 4
0
class ReadDescriptorTestCase(TestCase):

    def setUp(self):
        self.descriptor = ReadDescriptor(file_name=JSON_FILE, model_name='Contact')

    def test_readed_file(self):
        self.assertTrue(self.descriptor.source)

    def test_get_fields(self):
        self.assertEquals(self.descriptor.get_fields(), ["name", "year", "last"])

    def test_invalid_model(self):
        descriptor = ReadDescriptor(file_name=JSON_FILE, model_name='TestInvalidModel')
        self.assertRaises(InvalidModel, lambda: descriptor.get_model())

    def test_invalid_file(self):
        self.assertRaises(InvalidDescriptor, lambda: ReadDescriptor(file_name='invalid_file.er',
                          model_name='TestInvalidModel'))
Exemplo n.º 5
0
 def test_invalid_model(self):
     descriptor = ReadDescriptor(file_name=JSON_FILE, model_name='TestInvalidModel')
     self.assertRaises(InvalidModel, lambda: descriptor.get_model())
Exemplo n.º 6
0
 def setUp(self):
     self.descriptor = ReadDescriptor(file_name=JSON_FILE, model_name='Contact')
Exemplo n.º 7
0
 def test_invalid_file(self):
     self.assertRaises(
         InvalidDescriptor,
         lambda: ReadDescriptor(file_name='invalid_file.er',
                                model_name='TestInvalidModel'))
Exemplo n.º 8
0
 def test_invalid_model(self):
     descriptor = ReadDescriptor(file_name=JSON_FILE,
                                 model_name='TestInvalidModel')
     self.assertRaises(InvalidModel, lambda: descriptor.get_model())
Exemplo n.º 9
0
 def setUp(self):
     self.descriptor = ReadDescriptor(file_name=JSON_FILE,
                                      model_name='Contact')