tests.TestIPReverseDNS

class tests.TestIPReverseDNS(methodName='runTest')[source]

Unit testing for the reverse DNS functions in privex.helpers.net

Covers:
  • positive resolution tests (generate standard rDNS domain from clean input)

  • positive boundary tests (confirm valid results with range of boundaries)

  • negative address tests (ensure errors thrown for invalid v4/v6 addresses)

  • negative boundary tests (ensure errors thrown for invalid v4/v6 rDNS boundaries)

__init__(methodName='runTest')

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

Methods

__init__([methodName])

Create an instance of the class that will use the named test method when executed.

addCleanup(function, *args, **kwargs)

Add a function, with arguments, to be called when the test is completed.

addTypeEqualityFunc(typeobj, function)

Add a type specific assertEqual style function to compare a type.

assertAlmostEqual(first, second[, places, …])

Fail if the two objects are unequal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero, or by comparing that the difference between the two objects is more than the given delta.

assertAlmostEquals(**kwargs)

assertCountEqual(first, second[, msg])

An unordered sequence comparison asserting that the same elements, regardless of order.

assertDictContainsSubset(subset, dictionary)

Checks whether dictionary is a superset of subset.

assertDictEqual(d1, d2[, msg])

assertEqual(first, second[, msg])

Fail if the two objects are unequal as determined by the ‘==’ operator.

assertEquals(**kwargs)

assertFalse(expr[, msg])

Check that the expression is false.

assertGreater(a, b[, msg])

Just like self.assertTrue(a > b), but with a nicer default message.

assertGreaterEqual(a, b[, msg])

Just like self.assertTrue(a >= b), but with a nicer default message.

assertIn(member, container[, msg])

Just like self.assertTrue(a in b), but with a nicer default message.

assertIs(expr1, expr2[, msg])

Just like self.assertTrue(a is b), but with a nicer default message.

assertIsInstance(obj, cls[, msg])

Same as self.assertTrue(isinstance(obj, cls)), with a nicer default message.

assertIsNone(obj[, msg])

Same as self.assertTrue(obj is None), with a nicer default message.

assertIsNot(expr1, expr2[, msg])

Just like self.assertTrue(a is not b), but with a nicer default message.

assertIsNotNone(obj[, msg])

Included for symmetry with assertIsNone.

assertLess(a, b[, msg])

Just like self.assertTrue(a < b), but with a nicer default message.

assertLessEqual(a, b[, msg])

Just like self.assertTrue(a <= b), but with a nicer default message.

assertListEqual(list1, list2[, msg])

A list-specific equality assertion.

assertLogs([logger, level])

Fail unless a log message of level level or higher is emitted on logger_name or its children.

assertMultiLineEqual(first, second[, msg])

Assert that two multi-line strings are equal.

assertNotAlmostEqual(first, second[, …])

Fail if the two objects are equal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero, or by comparing that the difference between the two objects is less than the given delta.

assertNotAlmostEquals(**kwargs)

assertNotEqual(first, second[, msg])

Fail if the two objects are equal as determined by the ‘!=’ operator.

assertNotEquals(**kwargs)

assertNotIn(member, container[, msg])

Just like self.assertTrue(a not in b), but with a nicer default message.

assertNotIsInstance(obj, cls[, msg])

Included for symmetry with assertIsInstance.

assertNotRegex(text, unexpected_regex[, msg])

Fail the test if the text matches the regular expression.

assertNotRegexpMatches(**kwargs)

assertRaises(expected_exception, *args, **kwargs)

Fail unless an exception of class expected_exception is raised by the callable when invoked with specified positional and keyword arguments.

assertRaisesRegex(expected_exception, …)

Asserts that the message in a raised exception matches a regex.

assertRaisesRegexp(**kwargs)

assertRegex(text, expected_regex[, msg])

Fail the test unless the text matches the regular expression.

assertRegexpMatches(**kwargs)

assertSequenceEqual(seq1, seq2[, msg, seq_type])

An equality assertion for ordered sequences (like lists and tuples).

assertSetEqual(set1, set2[, msg])

A set-specific equality assertion.

assertTrue(expr[, msg])

Check that the expression is true.

assertTupleEqual(tuple1, tuple2[, msg])

A tuple-specific equality assertion.

assertWarns(expected_warning, *args, **kwargs)

Fail unless a warning of class warnClass is triggered by the callable when invoked with specified positional and keyword arguments.

assertWarnsRegex(expected_warning, …)

Asserts that the message in a triggered warning matches a regexp.

assert_(**kwargs)

countTestCases()

debug()

Run the test without collecting errors in a TestResult

defaultTestResult()

doCleanups()

Execute all cleanup functions.

fail([msg])

Fail immediately, with the given message.

failIf(**kwargs)

failIfAlmostEqual(**kwargs)

failIfEqual(**kwargs)

failUnless(**kwargs)

failUnlessAlmostEqual(**kwargs)

failUnlessEqual(**kwargs)

failUnlessRaises(**kwargs)

id()

run([result])

setUp()

Hook method for setting up the test fixture before exercising it.

setUpClass()

Hook method for setting up class fixture before running tests in the class.

shortDescription()

Returns a one-line description of the test, or None if no description has been provided.

skipTest(reason)

Skip this test.

subTest([msg])

Return a context manager that will return the enclosed block of code in a subtest identified by the optional message and keyword parameters.

tearDown()

Hook method for deconstructing the test fixture after testing it.

tearDownClass()

Hook method for deconstructing the class fixture after running all tests in the class.

test_v4_arpa_boundary_16bit()

Test generating 16-bit v4 boundary

test_v4_arpa_boundary_24bit()

Test generating 24-bit v4 boundary

test_v4_inv_boundary()

Raise if IPv4 boundary isn’t divisable by 8

test_v4_inv_boundary_2()

Raise if IPv4 boundary is too short

test_v4_invalid()

Raise if IPv4 address has < 4 octets

test_v4_invalid_2()

Raise if IPv4 address has octet out of range

test_v4_to_arpa()

Test generating rDNS for standard v4

test_v6_arpa_boundary_16bit()

Test generating 16-bit v6 boundary

test_v6_arpa_boundary_32bit()

Test generating 32-bit v6 boundary

test_v6_inv_boundary()

Raise if IPv6 boundary isn’t dividable by 4

test_v6_inv_boundary_2()

Raise if IPv6 boundary is too short

test_v6_invalid()

Raise if IPv6 address has invalid block formatting

test_v6_invalid_2()

Raise if v6 address has invalid chars

test_v6_to_arpa()

Test generating rDNS for standard v6

Attributes

longMessage

maxDiff

test_v4_arpa_boundary_16bit()[source]

Test generating 16-bit v4 boundary

test_v4_arpa_boundary_24bit()[source]

Test generating 24-bit v4 boundary

test_v4_inv_boundary()[source]

Raise if IPv4 boundary isn’t divisable by 8

test_v4_inv_boundary_2()[source]

Raise if IPv4 boundary is too short

test_v4_invalid()[source]

Raise if IPv4 address has < 4 octets

test_v4_invalid_2()[source]

Raise if IPv4 address has octet out of range

test_v4_to_arpa()[source]

Test generating rDNS for standard v4

test_v6_arpa_boundary_16bit()[source]

Test generating 16-bit v6 boundary

test_v6_arpa_boundary_32bit()[source]

Test generating 32-bit v6 boundary

test_v6_inv_boundary()[source]

Raise if IPv6 boundary isn’t dividable by 4

test_v6_inv_boundary_2()[source]

Raise if IPv6 boundary is too short

test_v6_invalid()[source]

Raise if IPv6 address has invalid block formatting

test_v6_invalid_2()[source]

Raise if v6 address has invalid chars

test_v6_to_arpa()[source]

Test generating rDNS for standard v6