Esempio n. 1
0
def create_mock_class(name, base, instance=None):
    instance = instance or MagicMock()
    mock_class = MagicMock(name=name,
                           return_value=instance)
    mock_class.__bases__ = (type, base)
    mock_class.__class__ = type
    return mock_class
Esempio n. 2
0
def create_mock_model():
    instance = MagicMock()
    model = MagicMock(name='MockModel')
    model.__bases__ = (type,)
    model.__class__ = type
    model._meta = MagicMock(**{
            'abstract': False,
        })
    return model
Esempio n. 3
0
def create_mock_model():
    instance = MagicMock()
    model = MagicMock(name='MockModel')
    model.__bases__ = (type, )
    model.__class__ = type
    model._meta = MagicMock(**{
        'abstract': False,
    })
    return model
Esempio n. 4
0
def create_mock_class(name, base, instance=None):
    instance = instance or MagicMock()
    mock_class = MagicMock(name=name, return_value=instance)
    mock_class.__bases__ = (type, base)
    mock_class.__class__ = type
    return mock_class