fudge-1.0.3/ 000755 000765 000024 00000000000 11536723452 013077 5 ustar 00kumar staff 000000 000000 fudge-1.0.3/docs/ 000755 000765 000024 00000000000 11536723452 014027 5 ustar 00kumar staff 000000 000000 fudge-1.0.3/fudge/ 000755 000765 000024 00000000000 11536723452 014171 5 ustar 00kumar staff 000000 000000 fudge-1.0.3/fudge.egg-info/ 000755 000765 000024 00000000000 11536723452 015663 5 ustar 00kumar staff 000000 000000 fudge-1.0.3/javascript/ 000755 000765 000024 00000000000 11536723452 015245 5 ustar 00kumar staff 000000 000000 fudge-1.0.3/LICENSE.txt 000644 000765 000024 00000002064 11456430705 014721 0 ustar 00kumar staff 000000 000000 The MIT License Copyright (c) 2009 Kumar McMillan Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. fudge-1.0.3/._MANIFEST.in 000644 000765 000024 00000000271 11456430705 015047 0 ustar 00kumar staff 000000 000000 Mac OS X 2 ¹ ATTR èŠ ¹ ! ! com.macromates.caret { column = 2; line = 3; } fudge-1.0.3/MANIFEST.in 000644 000765 000024 00000000341 11456430705 014630 0 ustar 00kumar staff 000000 000000 include *.txt recursive-include javascript/fudge *.js *.html *.txt *.py include run_tests.sh include javascript/README.txt include docs/Makefile recursive-include docs *.py *.rst include docs/_static/.hidden prune docs/_build fudge-1.0.3/PKG-INFO 000644 000765 000024 00000004072 11536723452 014177 0 ustar 00kumar staff 000000 000000 Metadata-Version: 1.0 Name: fudge Version: 1.0.3 Summary: Replace real objects with fakes (mocks, stubs, etc) while testing. Home-page: http://farmdev.com/projects/fudge/ Author: Kumar McMillan Author-email: kumar.mcmillan@gmail.com License: The MIT License Description: Complete documentation is available at http://farmdev.com/projects/fudge/ Fudge is a Python module for using fake objects (mocks and stubs) to test real ones. In readable Python code, you declare what methods are available on your fake and how they should be called. Then you inject that into your application and start testing. This declarative approach means you don't have to record and playback actions and you don't have to inspect your fakes after running code. If the fake object was used incorrectly then you'll see an informative exception message with a traceback that points to the culprit. Here is a quick preview of how you can test code that sends email without actually sending email:: @fudge.patch('smtplib.SMTP') def test_mailer(FakeSMTP): # Declare how the SMTP class should be used: (FakeSMTP.expects_call() .expects('connect') .expects('sendmail').with_arg_count(3)) # Run production code: send_mail() # ...expectations are verified automatically at the end of the test Platform: UNKNOWN Classifier: Intended Audience :: Developers Classifier: Natural Language :: English Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 2.5 Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3.1 Classifier: Programming Language :: Python :: 3.2 Classifier: Topic :: Software Development :: Testing fudge-1.0.3/._README.txt 000644 000765 000024 00000000273 11464552421 015010 0 ustar 00kumar staff 000000 000000 Mac OS X 2 » ATTR è§ » # # com.macromates.caret { column = 12; line = 16; } fudge-1.0.3/README.txt 000644 000765 000024 00000001011 11464552421 014562 0 ustar 00kumar staff 000000 000000 Fudge is a module for replacing real objects with fakes (mocks, stubs, etc) while testing. Documentation is available at http://farmdev.com/projects/fudge/ or else, you can build it from source like this:: $ easy_install Sphinx $ cd docs $ make html then open _build/html/index.html in your web browser. To run tests, you can use tox for all supported versions of Python. You can install it with pip:: $ pip install tox Then execute:: $ ./run_tests.sh Or simply:: $ tox fudge-1.0.3/._run_tests.sh 000755 000765 000024 00000000272 11464552003 015672 0 ustar 00kumar staff 000000 000000 Mac OS X 2 º ATTR ,G º " " com.macromates.caret { column = 43; line = 5; } fudge-1.0.3/run_tests.sh 000755 000765 000024 00000000202 11464552003 015446 0 ustar 00kumar staff 000000 000000 #!/bin/sh if [ -e "`which tox`" ]; then tox $@ else echo "**** install tox to run the tests http://codespeak.net/tox/" fi fudge-1.0.3/setup.cfg 000644 000765 000024 00000000073 11536723452 014720 0 ustar 00kumar staff 000000 000000 [egg_info] tag_build = tag_date = 0 tag_svn_revision = 0 fudge-1.0.3/._setup.py 000644 000765 000024 00000000273 11532310334 015013 0 ustar 00kumar staff 000000 000000 Mac OS X 2 » ATTR èå » # # com.macromates.caret { column = 27; line = 43; } fudge-1.0.3/setup.py 000644 000765 000024 00000004660 11532310334 014602 0 ustar 00kumar staff 000000 000000 import re import sys from setuptools import setup, find_packages version = None for line in open("./fudge/__init__.py"): m = re.search("__version__\s*=\s*(.*)", line) if m: version = m.group(1).strip()[1:-1] # quotes break assert version extra_setup = {} if sys.version_info >= (3,): extra_setup['use_2to3'] = True # extra_setup['use_2to3_fixers'] = ['your.fixers'] setup( name='fudge', version=version, description="Replace real objects with fakes (mocks, stubs, etc) while testing.", long_description=""" Complete documentation is available at http://farmdev.com/projects/fudge/ Fudge is a Python module for using fake objects (mocks and stubs) to test real ones. In readable Python code, you declare what methods are available on your fake and how they should be called. Then you inject that into your application and start testing. This declarative approach means you don't have to record and playback actions and you don't have to inspect your fakes after running code. If the fake object was used incorrectly then you'll see an informative exception message with a traceback that points to the culprit. Here is a quick preview of how you can test code that sends email without actually sending email:: @fudge.patch('smtplib.SMTP') def test_mailer(FakeSMTP): # Declare how the SMTP class should be used: (FakeSMTP.expects_call() .expects('connect') .expects('sendmail').with_arg_count(3)) # Run production code: send_mail() # ...expectations are verified automatically at the end of the test """, author='Kumar McMillan', author_email='kumar.mcmillan@gmail.com', license="The MIT License", packages=find_packages(exclude=['ez_setup']), install_requires=[], url='http://farmdev.com/projects/fudge/', include_package_data=True, classifiers = [ 'Intended Audience :: Developers', 'Natural Language :: English', 'Operating System :: OS Independent', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 2.5', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3.1', 'Programming Language :: Python :: 3.2', 'Topic :: Software Development :: Testing' ], **extra_setup ) fudge-1.0.3/javascript/fudge/ 000755 000765 000024 00000000000 11536723452 016337 5 ustar 00kumar staff 000000 000000 fudge-1.0.3/javascript/README.txt 000644 000765 000024 00000000727 11456430706 016747 0 ustar 00kumar staff 000000 000000 Copy ``javascript/fudge/`` to your webroot. To use it in your tests all you need is a script tag like this:: If you want to run Fudge's own tests, then cd into the ``javascript/`` directory, start a simple webserver:: $ python fudge/testserver.py and open http://localhost:8000/tests/test_fudge.html Take note that while Fudge's *tests* require jQuery, Fudge itself does not require jQuery. fudge-1.0.3/javascript/fudge/fudge.js 000644 000765 000024 00000041653 11456430706 017776 0 ustar 00kumar staff 000000 000000 /** * Fudge is a JavaScript module for using fake objects (mocks, stubs, etc) to test real ones. *
* The module is designed for two specific situations: *
*All calls return ``this`` so that you can chain them together to create readable code.
Arguments:
Short example:
var auth = new fudge.Fake('auth')
.expects('login')
.with_args('joe_username', 'joes_password');
fudge.clear_calls();
auth.login();
fudge.verify();
*
* @class Fake
* @namespace fudge
*/
var Fake = function(name, config) {
if (!config) {
config = {};
}
this._name = name;
if (config.object) {
this._object = config.object;
} else {
// object is a global by name
if (name) {
var parts = name.split(".");
if (parts.length === 0) {
// empty string?
throw new Error("Fake('" + name + "'): invalid name");
}
// descend into dot-separated object.
// i.e.
// foo.bar.baz
// window[foo]
// foo[bar]
// baz
var last_parent = window;
for (var i=0; iSet the last call to return a new :class:`fudge.Fake`.
Any given arguments are passed to the :class:`fudge.Fake` constructor
Take note that this is different from the cascading nature of other methods. This will return an instance of the *new* Fake, not self, so you should be careful to store its return value in a new variable.
* * @method returns_fake * @return Object */ Fake.prototype.returns_fake = function() { // make an anonymous object ... var return_val = {}; var fake = new Fake(this._name, { "object": return_val }); // ... then attach it to the return value of the last declared method this.returns(return_val); return fake; }; /** * Set the last call to expect specific arguments. * * @method with_args * @return Object */ Fake.prototype.with_args = function() { var exp = this._get_current_call(); exp.expected_arguments = arguments; return this; }; /** * Set the last call to expect an exact argument count. * * @method with_arg_count * @return Object */ Fake.prototype.with_arg_count = function(count) { /* def with_arg_count(self, count): """Expect an exact argument count.""" exp = self._get_current_call() exp.expected_arg_count = count return self */ }; /** * Set the last call to expect an exact count of keyword arguments. * * @method with_kwarg_count * @return Object */ Fake.prototype.with_kwarg_count = function(count) { /* def with_kwarg_count(self, count): """Expect an exact count of keyword arguments.""" exp = self._get_current_call() exp.expected_kwarg_count = count return self */ }; // fill fudge.* namespace : return { '__version__': '0.9.3', AssertionError: AssertionError, clear_expectations: function() { return registry.clear_expectations(); }, ExpectedCall: ExpectedCall, Fake: Fake, registry: registry, clear_calls: function() { return registry.clear_calls(); }, verify: function() { return registry.verify(); }, repr_call_args: repr_call_args }; }(); // end fudge namespace fudge-1.0.3/javascript/fudge/tests/ 000755 000765 000024 00000000000 11536723452 017501 5 ustar 00kumar staff 000000 000000 fudge-1.0.3/javascript/fudge/testserver.py 000644 000765 000024 00000003332 11456430706 021116 0 ustar 00kumar staff 000000 000000 import optparse import logging, time, os from wsgiref import simple_server log = logging.getLogger(__name__) document_root = os.path.dirname(__file__) def fileapp(environ, start_response): path_info = environ['PATH_INFO'] if path_info.startswith('/'): path_info = path_info[1:] # make relative full_path = os.path.join(document_root, path_info) if full_path == '': full_path = '.' # must be working dir if path_info=="" or path_info.endswith('/') or os.path.isdir(full_path): # directory listing: out = ['