Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Commit

Permalink
Merge djmitche/build-fwunit:issue30 (PR #30)
Browse files Browse the repository at this point in the history
  • Loading branch information
djmitche committed Mar 15, 2015
2 parents 98affa7 + 95f7b2d commit 329fa59
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/implementation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ IP Objects
This tool uses `IPy <https://pypi.python.org/pypi/IPy/>`_ to handle IP addresses, ranges, and sets.
However, it extends that functionality to include some additional methods for ``IPSet``\s as well as an ``IPPairs`` class to efficiently represent sets of IP pairs.

All of these classes can be imported from ``fwunit.ip``.
All of these classes can be imported directly from ``fwunit``.

Rules
-----
Expand Down
6 changes: 3 additions & 3 deletions docs/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The following might be in a file named `test_puppet.py`.
.. code-block:: python
from fwunit import TestContext
from fwunit.ip import IP, IPSet
from fwunit import IP, IPSet
tc = TestContext('my-network')
Expand Down Expand Up @@ -76,14 +76,14 @@ The ``IP`` and ``IPSet`` classes come from `IPy <https://pypi.python.org/pypi/IP

The ``IP`` class represents a single IP or CIDR range::

from fwunit.ip import IP
from fwunit import IP
server = IP('10.11.12.33')
subnet = IP('10.11.12.0/23')

When you need to reason about a non-contiguous set of addresses, you need an ``IPSet``.
This is really just a list of ``IP`` instances, but it will remove duplicates, collapse adjacent IPs, and so on. ::

from fwunit.ip import IP, IPSet
from fwunit import IP, IPSet
db_subnets = IPSet([IP('10.11.12.0/23'), IP('10.12.12.0/23')])

In general, tests expeect ``IPSet``\s, but you can pass ``IP`` instances or even bare strings and they will be converted appropriately.
Expand Down
2 changes: 1 addition & 1 deletion example/test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from fwunit import TestContext
from fwunit.ip import IP, IPSet
from fwunit import IP, IPSet

rules = TestContext('my-network')

Expand Down
4 changes: 4 additions & 0 deletions fwunit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

# import the user-facing interface
from fwunit.analysis.testcontext import TestContext
from fwunit.ip import IP
from fwunit.ip import IPSet
from fwunit.ip import IPPairs
_hush_pyflakes = [TestContext, IP, IPSet, IPPairs]

# create a "fake" fwunit.tests.Rules
class tests(object):
Expand Down

0 comments on commit 329fa59

Please sign in to comment.