def test_index_to_dictionary(self):
     """
     Test the conversion of an Index object into a dictionary representation
     of that object.
     """
     index = Index(self.db, 'ddoc-id', 'index-name', foo={'bar': 'baz'})
     self.assertEqual(index.as_a_dict(), {
         'ddoc': 'ddoc-id',
         'name': 'index-name',
         'type': 'json',
         'def': {'foo': {'bar': 'baz'}}
     })
 def test_index_as_a_dict_with_none_attributes(self):
     """
     Test the conversion of an Index object that contains attributes set to
     None into a dictionary representation of that object.
     """
     index = Index(self.db)
     self.assertEqual(index.as_a_dict(), {
         'ddoc': None,
         'name': None,
         'type': 'json',
         'def': {}
     })