from django.test import TestCase as DjangoTestCase


# TODO: pull into a common dev package so all armstrong code can use it
def concrete(klass):
    attrs = {'__module__': concrete.__module__, }
    return type("Concrete%s" % klass.__name__, (klass, ), attrs)


class TestCase(DjangoTestCase):
    def assertModelHasField(self, model, field_name, field_class=None):
        self.assertTrue(hasattr(model, field_name))
        field = model._meta.get_field_by_name(field_name)[0]
        if field_class is not None:
            self.assertTrue(isinstance(field, field_class))

@@ -9,46 +9,1081 @@
 ngo.
-test import TestCase as DjangoTestCase
+core.management.color import no_style%0Afrom django.db import connection%0Afrom django.test import TestCase as DjangoTestCase%0A%0A%0Adef create_concrete_table(func):%0A    style = no_style()%0A    seen_models = connection.introspection.installed_models(%0A            connection.introspection.table_names())%0A    def inner(self, *args, **kwargs):%0A        func(self, *args, **kwargs)%0A        sql, _references = connection.creation.sql_create_model(self.model,%0A                style, seen_models)%0A        cursor = connection.cursor()%0A        for statement in sql:%0A            cursor.execute(statement)%0A    return inner%0A%0A%0Adef destroy_concrete_table(func):%0A    style = no_style()%0A    # Assume that there are no references to destroy, these are supposed to be%0A    # simple models%0A    references = %7B%7D%0A    def inner(self, *args, **kwargs):%0A        func(self, *args, **kwargs)%0A        sql = connection.creation.sql_destroy_model(self.model, references,%0A                style)%0A        cursor = connection.cursor()%0A        for statement in sql:%0A            cursor.execute(statement)%0A    return inner
 %0A%0A%0A#

Add two new helpers for creating concrete model tables on the fly