Remove unused imports and fix too long lines in soc.views.models.site module.
[Melange.git] / tests / pymox / README
blob5e1fe7827f5702027cc76508cf3a5dcf1ebade04
1 Mox is an open source mock object framework for Python, inspired by
2 the Java library EasyMock.
4 To install:
6   $ python setup.py install
8 To run Mox's internal tests:
10   $ python mox_test.py
12 Basic usage:
14   import unittest
15   import mox
17   class PersonTest(mox.MoxTestBase):
19     def testUsingMox(self):
20       # Create a mock Person
21       mock_person = self.mox.CreateMock(Person)
23       test_person = ...
24       test_primary_key = ...
25       unknown_person = ...
27       # Expect InsertPerson to be called with test_person; return
28       # test_primary_key at that point
29       mock_person.InsertPerson(test_person).AndReturn(test_primary_key)
31       # Raise an exception when this is called
32       mock_person.DeletePerson(unknown_person).AndRaise(UnknownPersonError())
34       # Switch from record mode to replay mode
35       self.mox.ReplayAll()
37       # Run the test
38       ret_pk = mock_person.InsertPerson(test_person)
39       self.assertEquals(test_primary_key, ret_pk)
40       self.assertRaises(UnknownPersonError, mock_person, unknown_person)
42 For more documentation, see:
44   http://code.google.com/p/pymox/wiki/MoxDocumentation
46 For more information, see:
48   http://code.google.com/p/pymox/
50 Our user and developer discussion group is:
52   http://groups.google.com/group/mox-discuss
54 Mox is Copyright 2008 Google Inc, and licensed under the Apache
55 License, Version 2.0; see the file COPYING for details.  If you would
56 like to help us improve Mox, join the group.