72 (u'Date',), (u'Datetime',), |
72 (u'Date',), (u'Datetime',), |
73 (u'Decimal',),(u'Float',), |
73 (u'Decimal',),(u'Float',), |
74 (u'Int',), |
74 (u'Int',), |
75 (u'Interval',), (u'Password',), |
75 (u'Interval',), (u'Password',), |
76 (u'String',), (u'Time',)]) |
76 (u'String',), (u'Time',)]) |
|
77 sql = ("SELECT etype.cw_eid, etype.cw_name, cstr.cw_eid, rel.eid_to " |
|
78 "FROM cw_CWUniqueTogetherConstraint as cstr, " |
|
79 " relations_relation as rel, " |
|
80 " cw_CWEType as etype " |
|
81 "WHERE cstr.cw_eid = rel.eid_from " |
|
82 " AND cstr.cw_constraint_of = etype.cw_eid " |
|
83 " AND etype.cw_name = 'Personne' " |
|
84 ";") |
|
85 cu = self.session.system_sql(sql) |
|
86 rows = cu.fetchall() |
|
87 self.assertEquals(len(rows), 3) |
|
88 self.test_unique_together() |
77 finally: |
89 finally: |
78 self.repo.set_schema(origshema) |
90 self.repo.set_schema(origshema) |
|
91 |
|
92 def test_unique_together(self): |
|
93 person = self.repo.schema.eschema('Personne') |
|
94 self.assertEquals(len(person._unique_together), 1) |
|
95 self.assertUnorderedIterableEquals(person._unique_together[0], |
|
96 ('nom', 'prenom', 'inline2')) |
79 |
97 |
80 def test_schema_has_owner(self): |
98 def test_schema_has_owner(self): |
81 repo = self.repo |
99 repo = self.repo |
82 cnxid = repo.connect(self.admlogin, password=self.admpassword) |
100 cnxid = repo.connect(self.admlogin, password=self.admpassword) |
83 self.failIf(repo.execute(cnxid, 'CWEType X WHERE NOT X owned_by U')) |
101 self.failIf(repo.execute(cnxid, 'CWEType X WHERE NOT X owned_by U')) |