def test_fields_io(): """ Verfies that is possible to create and delete a Fields instance. """ custom_type = Types(name='sometype', enabled=0) custom_type.save() field = Fields(name='myfield', type=custom_type.id, field_type='string') field.save() assert getattr(field, 'id') != None field.delete_instance() custom_type.delete_instance()
def nullable_field(request, complex_data): ships = Types.get(Types.name == 'ships') sails = Fields(name='sails', type=ships.id, field_type='string', nullable=False) sails.save() def teardown(): sails.delete_instance() request.addfinalizer(teardown)
def simple_data(request, blueprint_file): bands = Types(name='bands', enabled=0) bands.save() name = Fields(name='band_name', type=bands.id, field_type='string') name.save() def teardown(): name.delete_instance() bands.delete_instance() os.remove(blueprint_file) request.addfinalizer(teardown)
def build_field(request, name, type_id, field_type, unique=None, nullable=None): custom_field = Fields(name=name, type=type_id, field_type=field_type, unique=unique, nullable=nullable) custom_field.save() def teardown(): custom_field.delete_instance() request.addfinalizer(teardown) return custom_field
def complex_data(request, blueprint_file): builders = Types(name='builders', enabled=0) builders.save() ships = Types(name='ships', enabled=0) ships.save() tonnage = Fields(name='tonnage', type=ships.id, field_type='int') tonnage.save() flag = Fields(name='flag', type=ships.id, field_type='string') flag.save() launch_date = Fields(name='launch_date', type=ships.id, field_type='date') launch_date.save() builder = Fields(name='builder', type=ships.id, field_type='builders') builder.save() def teardown(): tonnage.delete_instance() flag.delete_instance() launch_date.delete_instance() builder.delete_instance() ships.delete_instance() builders.delete_instance() os.remove(blueprint_file) request.addfinalizer(teardown)