# Source code for factory.mogo

    # -*- coding: utf-8 -*-
    # Copyright: See the LICENSE file.

    """factory_boy extensions for use with the mogo library (pymongo wrapper)."""

    from __future__ import unicode_literals

    from . import base

    class MogoFactory(base.Factory):
        """Factory for mogo objects."""
        class Meta:
            abstract = True

        @classmethod
        def _build(cls, model_class, *args, **kwargs):
            return model_class(*args, **kwargs)

        @classmethod
        def _create(cls, model_class, *args, **kwargs):
            instance = model_class(*args, **kwargs)
            instance.save()
            return instance