Ejemplo n.º 1
0
def setup_module():
    # Replace models.AppOutput with empty model to avoid dealing with
    # required fields and foreign keys. Replace it after tests run.
    global _AppOutput
    model = _AppOutput = models.AppOutput
    meta = type('Meta', (), {'db_table': 'appoutput_test'})
    del loading.cache.app_models[model._meta.app_label][model._meta.model_name]
    models.AppOutput = type('AppOutput', (models.models.Model,),
                            {'__module__': model.__module__, 'Meta': meta})
    dyn.create_table(models.AppOutput)
Ejemplo n.º 2
0
 def setUp(self):
     # Replace models.Analysis with empty model to avoid dealing with
     # required fields and foreign keys. Replace it after tests run.
     self._Analysis = models.Analysis
     #del loading.cache.app_models[models.Analysis._meta.app_label][models.Analysis._meta.model_name]
     loading.cache.app_models.get(models.Analysis._meta.app_label, {}).pop(models.Analysis._meta.model_name, None)
     class Analysis(models.models.Model):
         project = models.models.ForeignKey(models.Project)
         class Meta:
             app_label = 'projects'
             db_table = 'projects_analysis_test'
     dyn.create_table(Analysis)
     setup_test_environment()
     self.user = models.User.objects.create(username='dynamo')
Ejemplo n.º 3
0
 def test_create(model):
     self.assertFalse(dyn.table_exists(model))
     dyn.create_table(model)
     self.assertTrue(dyn.table_exists(model))