'Ensure that a collection with a specified name may be used.'

def test_collection_naming(self):

    class DefaultNamingTest(Document, ):
        pass
    self.assertEqual('default_naming_test', DefaultNamingTest._get_collection_name())
    class CustomNamingTest(Document, ):
        meta = {'collection': 'pimp_my_collection'}
    self.assertEqual('pimp_my_collection', CustomNamingTest._get_collection_name())
    class DynamicNamingTest(Document, ):
        meta = {'collection': (lambda c: 'DYNAMO')}
    self.assertEqual('DYNAMO', DynamicNamingTest._get_collection_name())
    class BaseDocument(Document, ):
        meta = {'abstract': True, 'collection': (lambda c: c.__name__.lower())}
    class OldNamingConvention(BaseDocument, ):
        pass
    self.assertEqual('oldnamingconvention', OldNamingConvention._get_collection_name())
    class InheritedAbstractNamingTest(BaseDocument, ):
        meta = {'collection': 'wibble'}
    self.assertEqual('wibble', InheritedAbstractNamingTest._get_collection_name())
    class BaseMixin(object, ):
        meta = {'collection': (lambda c: c.__name__.lower())}
    class OldMixinNamingConvention(Document, BaseMixin, ):
        pass
    self.assertEqual('oldmixinnamingconvention', OldMixinNamingConvention._get_collection_name())
    class BaseMixin(object, ):
        meta = {'collection': (lambda c: c.__name__.lower())}
    class BaseDocument(Document, BaseMixin, ):
        meta = {'allow_inheritance': True}
    class MyDocument(BaseDocument, ):
        pass
    self.assertEqual('basedocument', MyDocument._get_collection_name())
