Skip to content

andymckay/nose-blockage

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

An experimental nose plugin to block access to external services that you really should not be accessing in your unit tests.

To use:

pip install nose-blockage

Then add the following to your tests:

--with-blockage

If you use django-nose then add this to your Django settings to activate it:

NOSE_PLUGINS = [
    'blockage.plugins.NoseBlockage',
]
NOSE_ARGS = [
    '--with-blockage',
    # ...
]

Blocking HTTP

By default it whitelists localhost and 127.0.0.1. To change the whitelist:

--http-whitelist=some.site,some.other.site

If the code hits a http connection then instead of completing it will raise a MockHTTPCall exception. Please go and mock your tests appropriately.

Blocking SMTP

By default it whitelists no domains. To change the whitelist:

--smtp-whitelist=some.site

It will raise a MockSMTPCall exception.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages