552 mh.cmd_set_size_constraint('CWEType', 'description', 256) |
552 mh.cmd_set_size_constraint('CWEType', 'description', 256) |
553 finally: |
553 finally: |
554 mh.cmd_set_size_constraint('CWEType', 'description', None) |
554 mh.cmd_set_size_constraint('CWEType', 'description', None) |
555 |
555 |
556 @tag('longrun') |
556 @tag('longrun') |
557 def test_add_remove_cube_and_deps(self): |
557 def test_add_drop_cube_and_deps(self): |
558 with self.mh() as (cnx, mh): |
558 with self.mh() as (cnx, mh): |
559 schema = self.repo.schema |
559 schema = self.repo.schema |
560 self.assertEqual(sorted((str(s), str(o)) for s, o in schema['see_also'].rdefs.iterkeys()), |
560 self.assertEqual(sorted((str(s), str(o)) for s, o in schema['see_also'].rdefs.iterkeys()), |
561 sorted([('EmailThread', 'EmailThread'), ('Folder', 'Folder'), |
561 sorted([('EmailThread', 'EmailThread'), ('Folder', 'Folder'), |
562 ('Bookmark', 'Bookmark'), ('Bookmark', 'Note'), |
562 ('Bookmark', 'Bookmark'), ('Bookmark', 'Note'), |
563 ('Note', 'Note'), ('Note', 'Bookmark')])) |
563 ('Note', 'Note'), ('Note', 'Bookmark')])) |
564 try: |
564 try: |
565 mh.cmd_remove_cube('email', removedeps=True) |
565 mh.cmd_drop_cube('email', removedeps=True) |
566 # file was there because it's an email dependancy, should have been removed |
566 # file was there because it's an email dependancy, should have been removed |
567 self.assertNotIn('email', self.config.cubes()) |
567 self.assertNotIn('email', self.config.cubes()) |
568 self.assertNotIn(self.config.cube_dir('email'), self.config.cubes_path()) |
568 self.assertNotIn(self.config.cube_dir('email'), self.config.cubes_path()) |
569 self.assertNotIn('file', self.config.cubes()) |
569 self.assertNotIn('file', self.config.cubes()) |
570 self.assertNotIn(self.config.cube_dir('file'), self.config.cubes_path()) |
570 self.assertNotIn(self.config.cube_dir('file'), self.config.cubes_path()) |
611 # next test may fail complaining of missing tables |
611 # next test may fail complaining of missing tables |
612 cnx.commit() |
612 cnx.commit() |
613 |
613 |
614 |
614 |
615 @tag('longrun') |
615 @tag('longrun') |
616 def test_add_remove_cube_no_deps(self): |
616 def test_add_drop_cube_no_deps(self): |
617 with self.mh() as (cnx, mh): |
617 with self.mh() as (cnx, mh): |
618 cubes = set(self.config.cubes()) |
618 cubes = set(self.config.cubes()) |
619 schema = self.repo.schema |
619 schema = self.repo.schema |
620 try: |
620 try: |
621 mh.cmd_remove_cube('email') |
621 mh.cmd_drop_cube('email') |
622 cubes.remove('email') |
622 cubes.remove('email') |
623 self.assertNotIn('email', self.config.cubes()) |
623 self.assertNotIn('email', self.config.cubes()) |
624 self.assertIn('file', self.config.cubes()) |
624 self.assertIn('file', self.config.cubes()) |
625 for ertype in ('Email', 'EmailThread', 'EmailPart', |
625 for ertype in ('Email', 'EmailThread', 'EmailPart', |
626 'sender', 'in_thread', 'reply_to'): |
626 'sender', 'in_thread', 'reply_to'): |
633 self.maxeid = cnx.execute('Any MAX(X)')[0][0] # XXXXXXX KILL KENNY |
633 self.maxeid = cnx.execute('Any MAX(X)')[0][0] # XXXXXXX KILL KENNY |
634 # why this commit is necessary is unclear to me (though without it |
634 # why this commit is necessary is unclear to me (though without it |
635 # next test may fail complaining of missing tables |
635 # next test may fail complaining of missing tables |
636 cnx.commit() |
636 cnx.commit() |
637 |
637 |
638 def test_remove_dep_cube(self): |
638 def test_drop_dep_cube(self): |
639 with self.mh() as (cnx, mh): |
639 with self.mh() as (cnx, mh): |
640 with self.assertRaises(ConfigurationError) as cm: |
640 with self.assertRaises(ConfigurationError) as cm: |
641 mh.cmd_remove_cube('file') |
641 mh.cmd_drop_cube('file') |
642 self.assertEqual(str(cm.exception), "can't remove cube file, used as a dependency") |
642 self.assertEqual(str(cm.exception), "can't remove cube file, used as a dependency") |
643 |
643 |
644 @tag('longrun') |
644 @tag('longrun') |
645 def test_introduce_base_class(self): |
645 def test_introduce_base_class(self): |
646 with self.mh() as (cnx, mh): |
646 with self.mh() as (cnx, mh): |