86 Commits

Author SHA1 Message Date
Chris Dent
08cb8ac1bd Allowing forcing SSL in build_tests and gabbi-run
build_tests gains a require_ssl argument which, if set to True,
makes all the loaded test suites default to 'ssl: True'.

gabbi-run will interpret a target containing 'https' as meaning
that the tests in the provided yaml should default to 'ssl: True'.

Fixes: #50
Fixes: #105
Fixes: #138

The changes here are the naive basics to get the desired behavior.
There's an existing cleanup branch on which we can clean this up
later.
2016-06-02 09:15:57 +01:00
Chris Dent
f6eb64fe05 Merge pull request #135 from cdent/cookie-substitution
Cookie substitution
2016-06-01 17:00:31 +01:00
Chris Dent
3d04e979c2 Get gabbi working with IPv6 addresses
According to rfc 2732 an IPv6 address in a url needs to be enclosed
in [] (e.g. http://[::1]/foobar). Gabbi was not doing this. Instead
it was passing host information directly to its URL generation
routine and just using it. When doing tests against real servers
running on ipv6, this results in failures.

The changes here try to do the bare minumum to get the right results
without changing the create_url method too much. It's likely that in
some future version of gabbi we will want to change a lot here (the
current orientation towards hosts and ports instead of URLs is the
result of the wsgi-intercept integration) but for now we want to
keep the change limited.

I hate myself for the mocks in test_runner. A clear sign of bad
abstraction in runner.py, however this is not the place to be
changing that. Another item for the later list.

Fixes #136
2016-06-01 13:35:26 +01:00
Chris Dent
1947ce952a Add a docs for $COOKIE
There's only a very small amount here. In part this is because
the feature is small but also because the use cases are not
super clear.
2016-05-31 16:55:53 +01:00
Chris Dent
01aa81d42e Adjust the definition of LAST_URL
Instead of being the full url used in the last tast, LAST_URL
now means the URL defined in the last test, with substitutions
performed.

Just that.
2016-05-06 16:04:01 +01:00
Chris Dent
7987a89ff6 First pass at implementing $LAST_URL feature
If $LAST_URL is used anywhere a replacer is accepted, it will
be replaced with the URL from the previous test.

At the moment the URL is the full url that is passed into the http
client. Thus it includes the scheme, the netloc and any query
parameters that may have been added by the use of the
`query_parameters` test key.

It's not certain that this is the right choice. The other option is
to use the value of `url` that is in the test input. The is what's
actually the value of the url or {GET,POST,..} key in the test.
This is problematic though as there are at least two ways this could
be interpreted:

* the literal string that is in test['url'] in the test data
  structure
* that string after replacers have been run

Using the final full URL seems to suit the use cases I can think of
and feels somehow less ambiguous so that's what I implemented, but
it too has some issues:

* If $LAST_URL has query parameters in it, trying to _replace_ (not
  extend) those parametes via `query_parameters` doesn't really work.
  There's a failing test to demonstrate this problem.

(there may be others I haven't thought of yet)

Input desired from @FND and others please.
2016-05-06 00:40:06 +01:00
Chris Dent
d3351ec2e9 Update docs to points to readthedocs.io
Also add a YAML sample in README and front page of docs.
2016-04-29 12:34:53 +01:00
Chris Dent
8f95bd5692 release 1.17.1
- fix pytest failure  handling
2016-04-16 10:46:01 +01:00
Chris Dent
03938351d7 Update pytest docs
To remove warning about missing functionality.
2016-04-16 03:01:21 +01:00
Chris Dent
d3b76d231c Make slight improvements to pytest related docs.
This is based on commentary from @FND. There's still plenty of
room for improvement but iteration is good.
2016-04-08 10:40:15 +01:00
Chris Dent
748eac9d8a Add docs about the pytest situation
This may not be fully adequate but is a reasonable start. The main
point was to indicate the different loader method and the need
to yield the generated tests.
2016-04-06 14:20:30 +01:00
Chris Dent
60719215b8 Support testing of full json responses
This feature was effectively already there but not fleshed out in
tests nor documentation. Now there are some tests and a short
piece of documentation with a light warning about avoiding overuse.

A slight adjustment was required in data handling to deal with
empty lists and empty objects.

Fixes #113
2016-03-16 17:32:59 +00:00
FND
26daaae3ef Fix JSON formatting in docs
to avoid controversial idiosyncrasies
2016-03-11 21:39:41 +01:00
FND
56081d354a Simplify and clarify JSONPath docs
seems more concise and easier to digest this way
2016-03-11 21:38:41 +01:00
FND
20be204512 Improve internal reference in docs 2016-03-11 21:09:11 +01:00
Chris Dent
26132c0fb5 Fix punctuation problem in jsonpath docs
Because everyone is their own worst editor.
2016-03-11 19:29:53 +00:00
Chris Dent
ded89e8b43 Adjust jsonpath documentation
To be more clear about the sort, len and filter features.
2016-03-11 19:24:36 +00:00
Chris Dent
088b4cd71f Add small amount of docs for json extensions
These could probably be better but need to use it a bit to clear
on how to document it.
2016-03-05 15:17:00 +00:00
FND
e73050f2b3 Fix typo 2016-02-18 16:33:24 +01:00
FND
ffedc8b1e4 Switch to mdash where appropriate
not asserting comprehensive coverage though
2016-02-18 16:32:46 +01:00
Chris Dent
7a5b61c2d5 Add response_forbidden_headers handler
After much discussion this was determined to be the easiest and
cleanest way to accomplish a test which asserts "this header must
not be present". The ResponseHandler framework is used to good
effect to make short code.

The value of the response_forbidden_headers is a list of headers.
Case will be normalized to lower, which matches the internal
representation of the response headers dictionary.

Fixes #108
2015-12-09 18:11:53 +00:00
Chris Dent
bc11457101 Make table names headings for navigation ease
Fixes #57

This isn't great from a semantic standpoint but provides a better UX.
2015-11-03 06:37:01 +00:00
Chris Dent
db8c63b3e6 Move gabbiit tests into the tests dir
Originally there was no tests dir. When unit-like tests were added
they were put in a newly created tests directory. Since it is there
may as well use it.
2015-10-10 15:21:07 +01:00
FND
de5d869876 Tweak documentation markup to improve readability 2015-10-01 15:58:28 +02:00
FND
47baa650fa Replace func with meth references in docs
not exactly sure what this means, but @cdent suggests these should be
linked now
2015-10-01 15:18:17 +02:00
FND
4ac8d8e602 Document custom response handlers with gabbi-run 2015-10-01 14:47:32 +02:00
FND
b307a23110 Fix inconsistent font size within tables 2015-09-28 18:59:57 +02:00
Chris Dent
734ae9abab hack to override rtd back table formatting 2015-09-28 17:09:01 +01:00
Chris Dent
aa028c5bc1 hack to override rtd back table formatting 2015-09-28 17:06:56 +01:00
FND
4a8ff280ba Reorganize test format documentation
previously keys were documented as a lengthy list in seemingly arbitrary
order - in contrast, this structure promises to be more comprehensible
(and less daunting), plus table layout should improve readability and
scannability by providing some visual consistency

note that this inevitably led to various editorial changes
2015-09-28 17:49:41 +02:00
FND
4c1e1991c1 Add method shortcut documentation
I resisted adding a heading as that wouldn't fit into the existing
structure
2015-09-22 19:20:35 +02:00
FND
c8fd86638c Simplify phrasing 2015-09-03 16:56:49 +02:00
Chris Dent
1b46dcd3fc Allow the gabbi-run target to be a full URL
So instead of host[:port] [/prefix] it is also possible to do
http://host[:port][/prefix].

Docs updated accordingly.
2015-09-03 15:33:10 +01:00
Chris Dent
400c9ec3e4 Be explict about 'all' working with verbose flag. 2015-08-21 13:47:36 +01:00
Chris Dent
da9ff1e75e Add docs for verbose http client
Format is updated with a reference to the class docs, which
themselves explain the availalbe environment variables.
2015-08-21 13:44:58 +01:00
FND
7b4370e7ee Clarify query_parameters documentation 2015-08-07 16:45:39 +02:00
Chris Dent
ed0735b9a1 Add a bit more doc on query_parameters
This can always be improved later, based on feedback.
2015-08-06 10:47:30 +01:00
Chris Dent
063f00a7a6 Add query_parameters field
This adds a query_parameters field which can be used to add query
parameters to the url of the test in which it is used. It is a dict in
a form suitable for being passed to the urlencode() method.

This change is cumbersome because urlencoded in python2 and 3 have
different behaviors: In python2 a utf-8 encoded string is required.
In 3 it will figure out the right thing. So we here we just encode.

We also need to deal with the fact that a numeral in YAML will be
provided to Python as a numeric value and we need to stringify that in
a version independent fashion.
2015-08-06 10:41:40 +01:00
Chris Dent
b12a6a1672 Starts tests and docs on JSONPath len extension
I'm not entirely happy with the docs page, but decided something was
better than nothing.
2015-08-04 19:01:06 +01:00
Chris Dent
541eeb3662 Make sure all response content marked as JSON is decoded
Until this change only response bodies with a content-type of
'application/json' were decoded from JSON and stored in the
json_data attribute. Now '+json' style content-types also get the
same treatment.

json_data is the attribute later used when checking
response_json_paths. An expectation of a correct content type has
always been present but the docs have been update to make this
clear.

In the future when other content types will have handling similar to
JSON, this processing will need to be encapsulated in the
implementations of each content type handler. This fix is short
term.
2015-07-31 15:38:41 +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
4c76b5db35 Document availability of ' or " in replacers
Current text is a bit clunky but better than nothing.
2015-07-16 12:41:06 +01:00
Chris Dent
f2a32ad31b prep 1.1.0 release 2015-07-14 20:56:10 +01:00
Chris Dent
76c39194bc Introduction documentation improvements
The hope is that this makes gabbi-run a bit more visible
and points to the way tests can be loaded more clearly.

thanks to @FND for the prompting
2015-07-14 10:14:05 +01:00
Chris Dent
832b02ed59 Documentation improvements
Changes inspired by a recent read-through.
2015-07-07 09:39:02 +01:00
Chris Dent
ecd122b397 Fix typos in prefix feature docs 2015-06-17 12:16:24 +01:00
Chris Dent
702710be94 Add the concept of a 'prefix'
A prefix is applied to all the unqualifed URLs in a suite of tests.
This is useful for testing live applications that are mounted at
different points under a wsgi server.

Fixes #46
2015-06-17 12:05:32 +01:00
Chris Dent
e6eb54fe54 Add documentation for poll test key
This could be a good deal more verbose, but as is a useful start.
2015-06-12 10:34:36 +01:00
Chris Dent
91c568ba5f Merge branch 'master' of github.com:cdent/gabbi 2015-06-11 14:19:09 +01:00
Chris Dent
97b1ff2656 Special case "True" and "False" environment variables
The assumption is that when using those strings we actually want
booleans, additional there are a few BASE_TEST keys for which the
value is expected to be boolean and using an environment value
(which would always be a string if used directly) will not work (as
there is no way to indicate False).

Fixes #40
2015-06-11 14:16:20 +01:00