def setUpClass(cls): db = current.db # Define tables for test db.define_table("tuid_type_1", Field("name"), *s3_meta_fields()) db.define_table("tuid_type_2", Field("name"), *s3_meta_fields()) db.define_table("tuid_master", Field("name"), Field("type1_id", "reference tuid_type_1"), Field("type2_id", "reference tuid_type_2"), *s3_meta_fields())
def setUpClass(cls): db = current.db # Define tables for test db.define_table("ort_master", Field("jsontest", "json"), *s3_meta_fields()) db.define_table("ort_referenced", Field("name"), *s3_meta_fields()) # Enable feature current.s3db.configure( "ort_master", json_references="jsontest", )
def setUpClass(cls): db = current.db s3db = current.s3db s3db.define_table("fotest_lookup_table", Field("name"), Field("parent", "reference fotest_lookup_table"), *s3_meta_fields()) data = ( { "name": "option1", "uuid": cls.uuids[0] }, { "name": "option2", "uuid": cls.uuids[1] }, ) table = db.fotest_lookup_table for item in data: table.insert(**item) options = cls.options represent = S3Represent(lookup="fotest_lookup_table") s3db.define_table( "fotest_table", Field( "fixed_set", "integer", requires=IS_EMPTY_OR(IS_IN_SET(options)), represent=S3Represent(options=options), ), Field( "lookup", "reference fotest_lookup_table", requires=IS_EMPTY_OR( IS_ONE_OF( db, "fotest_lookup_table.id", represent, )), represent=represent, ), Field("noopts"), *s3_meta_fields()) db.commit()
def setUpClass(cls): db = current.db s3db = current.s3db s3db.define_table("fotest_lookup_table", Field("name"), Field("parent", "reference fotest_lookup_table"), *s3_meta_fields()) data = ({"name": "option1", "uuid": cls.uuids[0]}, {"name": "option2", "uuid": cls.uuids[1]}, ) table = db.fotest_lookup_table for item in data: table.insert(**item) options = cls.options represent = S3Represent(lookup="fotest_lookup_table") s3db.define_table("fotest_table", Field("fixed_set", "integer", requires = IS_EMPTY_OR(IS_IN_SET(options)), represent = S3Represent(options=options), ), Field("lookup", "reference fotest_lookup_table", requires = IS_EMPTY_OR( IS_ONE_OF(db, "fotest_lookup_table.id", represent, )), represent = represent, ), Field("noopts"), *s3_meta_fields()) db.commit()
def setUpClass(cls): db = current.db # Define test table db.define_table("dedup_test", Field("name"), Field("secondary"), *s3_meta_fields()) # Create sample records samples = ( { "uuid": "TEST0", "name": "Test0", "secondary": "SecondaryX" }, { "uuid": "TEST1", "name": "test1", "secondary": "Secondary1" }, { "uuid": "TEST2", "name": "Test2", "secondary": "seCondaryX" }, { "uuid": "TEST3", "name": "Test3", "secondary": "Secondary3" }, { "uuid": "TEST4", "name": "test4", "secondary": "Secondary4" }, ) table = db.dedup_test for data in samples: table.insert(**data) current.db.commit()
def setUpClass(cls): db = current.db # Define test table db.define_table("dedup_test", Field("name"), Field("secondary"), *s3_meta_fields()) # Create sample records samples = ( {"uuid": "TEST0", "name": "Test0", "secondary": "SecondaryX"}, {"uuid": "TEST1", "name": "test1", "secondary": "Secondary1"}, {"uuid": "TEST2", "name": "Test2", "secondary": "seCondaryX"}, {"uuid": "TEST3", "name": "Test3", "secondary": "Secondary3"}, {"uuid": "TEST4", "name": "test4", "secondary": "Secondary4"}, ) table = db.dedup_test for data in samples: table.insert(**data) current.db.commit()