def test_delete_disabled(self): """ Test that the SpecialIndex delete method is disabled. """ index = SpecialIndex(self.db, fields=[{'_id': 'asc'}]) with self.assertRaises(CloudantIndexException) as cm: index.delete() err = cm.exception self.assertEqual(str(err), 'Deleting the \"special\" index is not allowed.')
def test_constructor(self): """ Test that the constructor instantiates a SpecialIndex object. """ index = SpecialIndex(self.db, fields=[{'_id': 'asc'}]) self.assertIsInstance(index, SpecialIndex) self.assertEqual(index.as_a_dict(), { 'ddoc': None, 'name': '_all_docs', 'type': 'special', 'def': {'fields': [{'_id': 'asc'}]}})