webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
Public Member Functions | Public Attributes | List of all members
mox.Mox Class Reference
Inheritance diagram for mox.Mox:

Public Member Functions

def __init__ (self)
 
def CreateMock (self, class_to_mock)
 
def CreateMockAnything (self)
 
def ReplayAll (self)
 
def VerifyAll (self)
 
def ResetAll (self)
 
def StubOutWithMock (self, obj, attr_name, use_mock_anything=False)
 
def UnsetStubs (self)
 

Public Attributes

 stubs
 

Detailed Description

Mox: a factory for creating mock objects.

Constructor & Destructor Documentation

◆ __init__()

def mox.Mox.__init__ (   self)
Initialize a new Mox.

Member Function Documentation

◆ CreateMock()

def mox.Mox.CreateMock (   self,
  class_to_mock 
)
Create a new mock object.

Args:
  # class_to_mock: the class to be mocked
  class_to_mock: class

Returns:
  MockObject that can be used as the class_to_mock would be.

◆ CreateMockAnything()

def mox.Mox.CreateMockAnything (   self)
Create a mock that will accept any method calls.

This does not enforce an interface.

◆ ReplayAll()

def mox.Mox.ReplayAll (   self)
Set all mock objects to replay mode.

◆ ResetAll()

def mox.Mox.ResetAll (   self)
Call reset on all mock objects.  This does not unset stubs.

◆ StubOutWithMock()

def mox.Mox.StubOutWithMock (   self,
  obj,
  attr_name,
  use_mock_anything = False 
)
Replace a method, attribute, etc. with a Mock.

This will replace a class or module with a MockObject, and everything else
(method, function, etc) with a MockAnything.  This can be overridden to
always use a MockAnything by setting use_mock_anything to True.

Args:
  obj: A Python object (class, module, instance, callable).
  attr_name: str.  The name of the attribute to replace with a mock.
  use_mock_anything: bool. True if a MockAnything should be used regardless
of the type of attribute.

◆ UnsetStubs()

def mox.Mox.UnsetStubs (   self)
Restore stubs to their original state.

◆ VerifyAll()

def mox.Mox.VerifyAll (   self)
Call verify on all mock objects created.

Member Data Documentation

◆ stubs

mox.Mox.stubs

The documentation for this class was generated from the following file: