summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
...
| * | Fix Tests.randomIP*String() methods to enclose in brackets explicitly.Isis Lovecruft2013-12-20
| | | | | | | | | | | | | | | | | | This was causing problems for the parsers, some of which expect an IPv6 address without brackets, and others with brackets. It's easier if we're explicit about whether we're putting brackets around an address.
| * | Fix bridgedb.Tests.randomIP*() methods to return the correct IP type.Isis Lovecruft2013-12-20
| | |
| * | One tiny PEP8 fix in bridgedb.Tests.Isis Lovecruft2013-12-20
| | |
| * | Add test_Tests.TrialAdaptedDoctests class.Isis Lovecruft2013-12-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This class uses the dynamic doctest discovery mechanism, `test_Tests.generateTrialAdaptedDoctestSuite`, to run all discovered doctests. The generated methodnames in this `TestCase` correspond to location in the source code where the doctest was discovered. It also (somewhat) magically manages to print exception/failure tracebacks for failed doctests in a manner which is compatible with twisted.trial. The printed tracebacks will tell you: 1. Where the doctest is, and which line caused the exception. 2. What the expected result was supposed to be (according to the doctest), compared with what it actually was when the doctest code was run.
| * | Add test_Tests.MonkeypatchedOldUnittests class.Isis Lovecruft2013-12-20
| | | | | | | | | | | | | | | | | | This is precisely the same as `test_Tests.OldUnittests`, except that it re-runs all of the old unittests in lib/bridgedb/Tests.py with old code from `bridgedb.test.deprecated` to assist in finding regressions.
| * | Rewrite test_Tests.OldUnittests to use DynamicTestCaseMeta.Isis Lovecruft2013-12-20
| | |
| * | Add dynamic TestCase class generator.Isis Lovecruft2013-12-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is not *strictly* necessary; however, the previous manner that I had devised for running the old unittests in lib/bridgedb/Tests.py had a small problem: it ran *all* the tests in lib/bridgedb/Tests.py as a single trial test. This meant that if a single test from Tests.py failed, the whole test would fail, which doesn't give us very fine-grained reporting, especially if there were multiple failures (the whole thing would fail when the first one failed). To fix that, it would be necessary to create one `TestCase` "test_*" method per original unittest. Each individual unittest would also need to be wrapped with a `twisted.trial.unittest.PyUnitResultAdapter`, in order for twisted.trial to be able to capture tracebacks and `failure.Failures` correctly. Additionally, it would be nice if we could simply take each `TestCase` method from the original unittests and reuse their method names (so that we know exactly which one of the original unittests is being run); therefore, the methods need to be wrapped yet again to reassign dynamic instancemethod names. (Normally, dynamically mucking around with Python's namespace is a BadIdea™, but it turns out not only that this works, but that it *also* works with the dynamically discovered doctests from `test_Tests.generateTrialAdaptedDoctestSuite()` as well!) I mostly wanted to see if I could do it. Turns out, I can, and it seems to work well. This black-magic encrusted monster I've munged together, `DynamicTestCaseMeta`, works in the following manner: 1. It generates dynamic methodnames with a given `methodPrefix` 2. It generates corresponding methods for a `twisted.trial.unittest.TestCase` base class. 3. Next, it wraps the generated methods. Sometimes, depending on the base class, it wraps them multiple times. It also allows further layers of wrapping, i.e. the `MonkeyPatcher` returned from `monkeypatchTests()` still works. 4. Then, it assigns each generated methodname and method pair, using the special __new__() constructor, to the base class *when the base class is compiled* (i.e. when the test_Tests module is first imported into a Python interpreter). Therefore, each time you initialise a base class which uses `DynamicTestCaseMeta` as its __metaclass__, every initialised instance will have the *same* generated code, because the code which is generated is decided at compile time, not access time. * ADD the terrifying `test_Tests.DynamicTestCaseMeta` class generator. post scriptum: Take that, C++! :P
| * | Add test_Tests.monkeypatchTests() to setup regression tests.Isis Lovecruft2013-12-20
| | | | | | | | | | | | | | | | | | This function creates a `twisted.python.monkey.MonkeyPatcher` which will add deprecated code from `bridgedb.test.deprecated` back in, so that a TestCase class can run its tests on pre-refactored code to test for regressions.
| * | Add test_Tests.generateTrialAdaptedDoctestsSuite().Isis Lovecruft2013-12-20
| | | | | | | | | | | | | | | | | | This function discovers doctests within the directory that BridgeDB was installed within, and then it builds a `twisted.trial.unittest.TestSuite` from all discovered doctests.
| * | Rename `TrialAdaptedOldUnittests` → `OldUnittests`.Isis Lovecruft2013-12-20
| | |
| * | Remove imports for bridgedb.Tests classes; import whole module.Isis Lovecruft2013-12-20
| | |
| * | Add another __future__ import to test_Tests.py.Isis Lovecruft2013-12-20
| | |
| * | Add `_trial_temp.lock` to .gitignore.Isis Lovecruft2013-12-20
| | |
| * | Add test.deprecated module for regression testing with original code.Isis Lovecruft2013-12-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ADD `lib/bridgedb/test/deprecated.py` which contains old classes and functions (before refactoring), so that they can be `twisted.python.monkey.MonkeyPatched`ed into `bridgedb.test.test_Tests` (and perhaps other tests). This causes the unittests to function as regression tests when code is refactored, so that (hopefully) we can find regression bugs faster. In the future, we *should* be able to use `twisted.python.deprecate` to deprecate function and classes in place (i.e. without removing them from their original files). I didn't think to do this until long after these had been removed, and re-adding deprecated code back into BridgeDB's modules seems like it would be confusing. That said, it is *also* fine, in the future, to actually move deprecated code into `bridgedb.test.deprecated` (just make sure to change all references to the original in the codebase!). However, doing this *does* mean you'll need to do quite a bit more complicated monkeypatching in `bridgedb.test.test_Tests.py`, or any other future regression testsuites.
| * | Change `Bridges.parseORAddressLine`→`networkstatus.parseALine` in Tests.py.Isis Lovecruft2013-12-20
| | |
| * | Add trial runner/report class adapter for old unittests.Isis Lovecruft2013-12-20
|/ / | | | | | | | | | | | | | | | | | | | | This adds a new unittest file, `lib/bridgedb/test/test_Tests.py`, which runs the old unittests in `lib/bridgedb/Tests.py` with a unittest report adapter that is compatible with twisted.trial. It uses the underlying SynchronousTestCase wrapper for the stdlib `unittest.TestCase` (which the tests in `lib/bridgedb/Tests.py` use). * ADDS a trial runner for BridgeDB's old unittests. * FIXES #9873
* | Merge branch 'hotfix/9462B-netstatus-returns-None' into developIsis Lovecruft2013-12-20
|\ \
| * | Fix field names in ParseNetworkStatusALineTests.test_missingPrefix().hotfix/9462B-netstatus-returns-NoneIsis Lovecruft2013-12-20
| | |
* | | Merge branch 'hotfix/9462B-netstatus-returns-None' into developIsis Lovecruft2013-12-20
|\ \ \ | |/ /
| * | Fix ParseNetworkStatusALineTests.test_missingPrefix unittest.Isis Lovecruft2013-12-20
| | |
* | | Merge branch 'fix/10446-geoip-module' into developIsis Lovecruft2013-12-20
|\ \ \
| * | | Update README to reflect pygeoip module changes.fix/10446-geoip-moduleIsis Lovecruft2013-12-20
| | | |
| * | | Use pygeoip instead of GeoIP in HTTPServer.py.Isis Lovecruft2013-12-20
|/ / / | | | | | | | | | * FIXES #10446
* | | Merge branch 'hotfix/9462B-netstatus-returns-None' into developIsis Lovecruft2013-12-20
|\ \ \ | |/ /
| * | Handle case when (ip, portlist) from parseALine() is (None, None).Isis Lovecruft2013-12-20
| | | | | | | | | | | | | | | | | | * FIXES a bug where bridgedb.Bridges.parseStatusFile() doesn't handle the (None, None) for (ip, portlist) which is returned whenever bridgedb.parse.networkstatus.parseALine() couldn't parse the line.
| * | Change logged exception to error in parseALine().Isis Lovecruft2013-12-20
| | |
| * | Allow 'a'-lines which don't start with 'a' for backward compatibility.Isis Lovecruft2013-12-20
|/ / | | | | | | | | | | | | The removed bridgedb.Bridges.parseORAddressLine() function was able to take a networkstatus line which started with 'a' or didn't. It's a mess to change all the code, so for now just log a warning when we recieve a line in bridgedb.parse.networkstatus.parseALine() which doesn't start with 'a'.
* | Merge branch 'fix/1606-based-on_bug1606_spec_update_rebased_r1' into developIsis Lovecruft2013-12-13
|\ \
| * | Move specs and proposals into doc/ directory.Isis Lovecruft2013-12-13
| | |
| * | Update spec: PT args are comma-separated.fix/1606-based-on_bug1606_spec_update_rebased_r1Isis Lovecruft2013-12-13
| | |
| * | Update spec: We also parse the "published" line.Isis Lovecruft2013-12-13
| | |
| * | Add description about how we display bridge addressesMatthew Finkel2013-12-13
| | |
| * | Attempt to answer some old questions, ask a new one.Matthew Finkel2013-12-13
| | |
| * | We can sign all outgoing emails nowMatthew Finkel2013-12-13
| | |
| * | Describe how we decide the number of bridges we will returnMatthew Finkel2013-12-13
| | |
| * | Improve description of IP-based distributorMatthew Finkel2013-12-13
| | | | | | | | | | | | | | | We now use a CAPTCHA to weed out (most) scrapers. Also, improve description of how bridges are selected based on filters and rings.
| * | Reword and improve description of the distributorMatthew Finkel2013-12-13
| | |
| * | Clarify how we parse bridge descriptorsMatthew Finkel2013-12-13
| | | | | | | | | | | | | | | Bring the description inline with how the the implementation handles the descriptors and bridges.
| * | We use the "a" line of a bridge from the NS for its OR AddressMatthew Finkel2013-12-13
| | | | | | | | | | | | | | | | | | The "a" line in the network status is checked and signed by the bridge authority, so we prefer this over the "or-address" line in the bridge descriptor.
| * | We now support extra-info documents and pluggable transportsMatthew Finkel2013-12-13
| | | | | | | | | | | | | | | | | | BridgeDB supports parsing extra-info documents which allows it to retrieve information regarding the pluggable transports a bridge accepts.
| * | Minor grammatical and clarifying correctionsMatthew Finkel2013-12-13
| | |
| * | Clarify which bridges are used and which ones are skippedMatthew Finkel2013-12-13
|/ / | | | | | | | | | | If we receive a descriptor for a bridge which was not listed in the network status, then we should not use it. We do not use it, but this is not obvious without some investigation. Make this obvious.
* | Merge branch 'fix/9013_r1' into developIsis Lovecruft2013-12-13
|\ \
| * | Tor expects the PT argument separator to be a commafix/9013_r1Matthew Finkel2013-12-13
|/ /
* | Merge branch 'fix/9462-refactor-netstatus-parsers_r9462C_r2' into developIsis Lovecruft2013-12-12
|\ \
| * | Add three new unittests for parseRLine() base64 encoding issues.fix/9462-refactor-netstatus-parsers_r9462C_r2Isis Lovecruft2013-12-11
| | |
| * | Change parse.networkstatus unittest values to be clearer when decoded.Isis Lovecruft2013-12-11
| | | | | | | | | | | | | | | | | | Store the pre-base64-encoded value so that the checks are clearer if they fail. Also, remove a str() around a couple `nick` values, they do not make a difference now that the proper __future__ imports are in place.
| * | Move base64 re-padding logic into separate function.Isis Lovecruft2013-12-11
| | | | | | | | | | | | | | | | | | This logic is not specific to parsing networkstatus descriptors, so for now I've placed it in parse.parseUnpaddedBase64() ― though it could live somewhere else later.
| * | Only return the re-padded base64 string if no errors were raised.Isis Lovecruft2013-12-11
| | | | | | | | | | | | | | | * CHANGE parse.padBase64() to only return a value if no exceptions were raised during parsing.
| * | Raise ValueError rather than logging in parse.padBase64().Isis Lovecruft2013-12-11
| | |