12 Commits

Author SHA1 Message Date
Chris Dent
2b0df54fb8 Extract color output handling for reuse
Move the colorize stuff from the reporter to utils, use it in
VerboseHttp.

What's there now is merely a demonstration of capabilities, to be
resolved by further discussion.
2015-08-10 20:43:18 +01:00
Chris Dent
9e1172fc83 Class level PREFIX and BLACKLIST defaults
This makes the class extensible while containing the info in a
visible place.

Also, make sure that the prefix is being called wherever it is
actually used, not using static strings.

Renamed decode_content to decode_response_content for (ever so)
slightly more meaningful name.

More to come.
2015-08-10 20:23:50 +01:00
Chris Dent
b770462670 Proof of concept for increased verbosity
This add support for the verbose setting to take any single value from
the set: True, False, all, headers, body. "all" and "True" mean show
both headers and body (and anything else we might come up with later).

The code works by making the VerboseHttp class contain all the magic
for verbosity, rather than splitting it in different places. The logic
for making decisions is too messy and could do with some refactoring.

There's logic in place for adding future color and different output
locations (because that was how I made sure the class we encapsulating
well).

A start at getting #69 in shape, but some distance from done.
2015-08-09 18:13:05 +01:00
Chris Dent
7b0128648a Confirm additional json derived content types work
application/json-home sets a new form of derived media types, but we
should be aware of it. The code is now adjusted to accept it and
anything else that startswith application/json.

Also media types are case insensitive so JSON decoding should
account for that.
2015-08-04 18:34:10 +01:00
Chris Dent
27eb9b2d89 Make sure content_type is stripped of whitespace.
Otherwise the not_binary method will not match.

I considered stripping in not_binary but I think it is better that
it be strict in what it accepts.
2015-07-22 20:11:00 +01:00
Chris Dent
59ad05476a Be more robust in processing content-type charset
We can't rely on there being only one parameter in the content-type,
so we need to do some processing to extract exactly the charset.

Thanks to @ravichandrasadineni for pointing out the problem and
providing a possible solution. This solution differs slightly from
his, but is the same in spirit.

The simple_wsgi app has been updated to return a content-type which
will exercise this code.

Fixes #66
2015-07-22 20:01:03 +01:00
Chris Dent
1f0b1f7542 Be ambiguous about copyright
The part that matters is the license not who or what holds it.
2015-07-20 13:57:05 +01:00
Chris Dent
a0b8bea5ca Fix pep8 in ConnectionRefused changes
Make travis check pep8.
2015-07-14 11:01:36 +01:00
FND
7bb2cca716 Fix compatibility with Python 3.2 and below 2015-07-14 11:30:12 +02:00
Chris Dent
24c9071930 cleanup more author tags 2015-05-26 22:57:09 +01:00
Chris Dent
75394fbf61 Add verbose reporting of request and response
In normal testing setups it is not possible to see the requests and
responses being made. If a test is set to 'verbose: True' then the
test request info and the httplib2 request and response data will be
produced to STDOUT.
2015-04-27 14:07:17 +01:00
Chris Dent
753ab77a52 Cleanup case module for increased clarity.
* Functions moved to utils module
* http request moved to own method
* redundant data assignment of response and output rationalized
2015-03-08 15:01:09 +00:00