This commit is contained in:
Gabriel Falcao 2013-10-10 18:59:25 -04:00
parent 7212f9db78
commit 74e4c364e6
9 changed files with 164 additions and 79 deletions

View File

@ -17,7 +17,7 @@ project:
zipball_download_url: https://github.com/gabrielfalcao/HTTPretty/archive/master.zip
documentation_url: http://falcao.it/HTTPretty
support_url: http://github.com/gabrielfalcao/HTTPretty/issues
logo_url: https://s3-us-west-2.amazonaws.com/s.cdpn.io/18885/httpretty-logo_1.svg
full_index: false
documentation:
index: intro.md
index: welcome.md

View File

@ -1,6 +1,6 @@
# Acknowledgements
## caveats with the [requests](http://docs.python-requests.org/en/latest/) library
## caveats
### `forcing_headers` + `Content-Length`
@ -9,7 +9,7 @@ if you use the `forcing_headers` options make sure to add the header
[requests](http://docs.python-requests.org/en/latest/) will try to
load the response endlessly
# Officially supported libraries
## supported libraries
Because HTTPretty works in the socket level it should work with any HTTP client libraries, although it is [battle tested](https://github.com/gabrielfalcao/HTTPretty/tree/master/tests/functional) against:

View File

@ -1,6 +1,6 @@
# Hacking on HTTPretty
#### create a virtual env
## creating a virtual env
you will need [virtualenvwrapper](http://www.doughellmann.com/projects/virtualenvwrapper/)
@ -9,13 +9,13 @@ you will need [virtualenvwrapper](http://www.doughellmann.com/projects/virtualen
mkvirtualenv --distribute --no-site-packages HTTPretty
```
#### install the dependencies
## installing the dependencies
```console
pip install -r requirements.pip
```
#### next steps:
## next steps
1. run the tests with make:
```bash

View File

@ -1,3 +1,5 @@
# Reference
## testing query strings
```python
@ -20,7 +22,7 @@ def test_one():
```
## ohhhh, really? can that be easier?
## Using the decorator
**YES** we've got a decorator
@ -41,7 +43,7 @@ the `@httpretty.activate` is a short-hand decorator that wraps the
decorated function with httpretty.enable() and then calls
httpretty.disable() right after.
## mocking the status code
## Providing status code
```python
import requests
@ -58,7 +60,7 @@ def test_github_access():
expect(response.status_code).to.equal(201)
```
## you can tell HTTPretty to return any HTTP headers you want
## Providing custom heades
**and all you need is to add keyword args in which the keys are always lower-cased and with underscores `_` instead of dashes `-`**

1
docs/welcome.md Normal file
View File

@ -0,0 +1 @@
# Welcome to HTTPretty

View File

@ -0,0 +1,61 @@
.hll { background-color: #ffffcc }
.c { color: #999988; font-style: italic } /* Comment */
.err { color: #a61717; background-color: #e3d2d2 } /* Error */
.k { color: #000000; font-weight: bold } /* Keyword */
.o { color: #000000; font-weight: bold } /* Operator */
.cm { color: #999988; font-style: italic } /* Comment.Multiline */
.cp { color: #999999; font-weight: bold; font-style: italic } /* Comment.Preproc */
.c1 { color: #999988; font-style: italic } /* Comment.Single */
.cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
.gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.ge { color: #000000; font-style: italic } /* Generic.Emph */
.gr { color: #aa0000 } /* Generic.Error */
.gh { color: #999999 } /* Generic.Heading */
.gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.go { color: #888888 } /* Generic.Output */
.gp { color: #555555 } /* Generic.Prompt */
.gs { font-weight: bold } /* Generic.Strong */
.gu { color: #aaaaaa } /* Generic.Subheading */
.gt { color: #aa0000 } /* Generic.Traceback */
.kc { color: #000000; font-weight: bold } /* Keyword.Constant */
.kd { color: #000000; font-weight: bold } /* Keyword.Declaration */
.kn { color: #000000; font-weight: bold } /* Keyword.Namespace */
.kp { color: #000000; font-weight: bold } /* Keyword.Pseudo */
.kr { color: #000000; font-weight: bold } /* Keyword.Reserved */
.kt { color: #445588; font-weight: bold } /* Keyword.Type */
.m { color: #009999 } /* Literal.Number */
.s { color: #d01040 } /* Literal.String */
.na { color: #008080 } /* Name.Attribute */
.nb { color: #0086B3 } /* Name.Builtin */
.nc { color: #445588; font-weight: bold } /* Name.Class */
.no { color: #008080 } /* Name.Constant */
.nd { color: #3c5d5d; font-weight: bold } /* Name.Decorator */
.ni { color: #800080 } /* Name.Entity */
.ne { color: #990000; font-weight: bold } /* Name.Exception */
.nf { color: #990000; font-weight: bold } /* Name.Function */
.nl { color: #990000; font-weight: bold } /* Name.Label */
.nn { color: #555555 } /* Name.Namespace */
.nt { color: #000080 } /* Name.Tag */
.nv { color: #008080 } /* Name.Variable */
.ow { color: #000000; font-weight: bold } /* Operator.Word */
.w { color: #bbbbbb } /* Text.Whitespace */
.mf { color: #009999 } /* Literal.Number.Float */
.mh { color: #009999 } /* Literal.Number.Hex */
.mi { color: #009999 } /* Literal.Number.Integer */
.mo { color: #009999 } /* Literal.Number.Oct */
.sb { color: #d01040 } /* Literal.String.Backtick */
.sc { color: #d01040 } /* Literal.String.Char */
.sd { color: #d01040 } /* Literal.String.Doc */
.s2 { color: #d01040 } /* Literal.String.Double */
.se { color: #d01040 } /* Literal.String.Escape */
.sh { color: #d01040 } /* Literal.String.Heredoc */
.si { color: #d01040 } /* Literal.String.Interpol */
.sx { color: #d01040 } /* Literal.String.Other */
.sr { color: #009926 } /* Literal.String.Regex */
.s1 { color: #d01040 } /* Literal.String.Single */
.ss { color: #990073 } /* Literal.String.Symbol */
.bp { color: #999999 } /* Name.Builtin.Pseudo */
.vc { color: #008080 } /* Name.Variable.Class */
.vg { color: #008080 } /* Name.Variable.Global */
.vi { color: #008080 } /* Name.Variable.Instance */
.il { color: #009999 } /* Literal.Number.Integer.Long */

View File

@ -48,3 +48,21 @@ nav {
a.uk-button-primary {
color: white;
}
a {
color: #3973A6;
}
code, code *, pre, pre * {
font-family: "Monaco", "Inconsolata", "monospace";
}
div.highlight pre {
box-shadow: inset 0px 1px 2px 1px rgba(80, 80, 80, .15);
}
#docs-body {
padding-top: 120px;
}

View File

@ -1,32 +1,67 @@
{% macro render_menu_item(header) -%}
<li><a href="{{ header.anchor }}">{{ header.text|safe }}</a></li>
{% if 'child' in header %}
{% for child in header['child'] %}
{{ render_menu_item(child) }}
{% endfor %}
{% endif %}
{%- endmacro %}
{% macro render_menu_item(header, relative_path) -%}
{% if header['level'] < 3 and header['level'] > 1 %}
<li><a href="{{ relative_path }}{{ header.anchor }}">{{ header.text|safe }}</a></li>
{% endif %}
{% if 'child' in header %}
{% for child in header['child'] %}
{{ render_menu_item(child) }}
{% endfor %}
{% endif %}
{%- endmacro %}
<div class="uk-container uk-container-center">
<div class="uk-grid" data-uk-grid-margin="">
<div class="tm-sidebar uk-width-medium-1-4 uk-hidden-small">
<ul class="tm-nav uk-nav" data-uk-nav="">
{% for page in master_index %}
<li class="uk-nav-header">{{ page.relative_path.split('/')[-1].split('.')[0].title() }}</li>
{% for item in page.indexes %}
{{ render_menu_item(item) }}
{% endfor %}
</ul>
<div class="uk-container uk-container-center" style="padding: 120px 0;">
<div class="uk-grid" data-uk-grid-margin="">
<div class="uk-width-medium-1-4 uk-hidden-small">
<div style="clear:both; padding-bottom: 50px;">
<img src="{{ project.logo_url }}" width="240" title="{{ project.name }}" alt="{{ project.name }}" />
<h2>{{ project.name }} v{{ project.version }}</h2>
<a class="uk-navbar-brand" href="#">Table of Contents</a>
</div>
<ul style="clear:both;" class="uk-nav">
{% for page in master_index %}
{% if page.relative_path.endswith("intro.md") %}
<li class="uk-nav-header">{{ page.indexes[0].text }}</li>
{% for item in page.indexes %}
{{ render_menu_item(item, page.relative_path) }}
{% endfor %}
{% endif %}
{% endfor %}
{% for page in master_index %}
{% if page.relative_path.endswith("docs.md") %}
<li class="uk-nav-header">{{ page.indexes[0].text }}</li>
{% for item in page.indexes %}
{{ render_menu_item(item, page.relative_path) }}
{% endfor %}
{% endif %}
{% endfor %}
{% for page in master_index %}
{% if page.relative_path.endswith("about.md") %}
<li class="uk-nav-header">{{ page.indexes[0].text }}</li>
{% for item in page.indexes %}
{{ render_menu_item(item, page.relative_path) }}
{% endfor %}
{% endif %}
{% endfor %}
{% for page in master_index %}
{% if page.relative_path.endswith("contributing.md") %}
<li class="uk-nav-header">{{ page.indexes[0].text }}</li>
{% for item in page.indexes %}
{{ render_menu_item(item, page.relative_path) }}
{% endfor %}
{% endif %}
{% endfor %}
</ul>
</div>
<div class="uk-width-medium-3-4">
<article class="uk-article">
<h1 class="uk-article-title">{{ project.name }}</h1>
<p class="uk-article-lead">{{ project.description }}</p>
<div class="uk-width-medium-1-1">
{{ documentation|safe }}
</div>
</div>
</article>
</div>
</div>
</div>
<div class="tm-main uk-width-medium-3-4">
<article class="uk-article">
<h1 class="uk-article-title">Components</h1>
<p class="uk-article-lead">All UIkit components at a glance.</p>
<div class="uk-width-medium-1-1">
{{ documentation|safe }}
</div>
</div>
</article>
</div>
</div>
</div>

View File

@ -5,53 +5,21 @@
<title>{{ project.name }} by {{ project.github_maintainer }}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Loading Bootstrap -->
<link rel='stylesheet prefetch' href='https://s3-us-west-2.amazonaws.com/s.cdpn.io/18885/uikit.min.css'>
<link rel='stylesheet prefetch' href='http://fonts.googleapis.com/css?family=Montserrat:400,700'>
<link rel='stylesheet prefetch' href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400,600,700,900,200italic,300italic,400italic,600italic,700italic,900italic'>
<link rel='stylesheet prefetch' href='//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css'>
<link href="{{ static_file('css/github.css') }}" rel="stylesheet">
<link href="{{ static_file('css/style.css') }}" rel="stylesheet">
<script src="{{ static_file('js/prefixfree.min.js') }}"></script>
</head>
<body>
{% macro render_menu_item(item, relative_path) -%}
<li><a href="{{ relative_path }}{{ item.anchor }}">{{ item.text|safe }}</a></li>
{% if 'child' in header %}
{% for child in header['child'] %}
{{ render_menu_item(child) }}
{% endfor %}
{% endif %}
{%- endmacro %}
<div class="uk-container uk-container-center" style="padding: 120px 0;">
<div class="uk-grid" data-uk-grid-margin="">
<div class="uk-width-medium-1-4 uk-hidden-small">
<div style="clear:both; padding-bottom: 50px;">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/18885/httpretty-logo_1.svg" width="240" title="HTTPretty" alt="HTTPretty" />
<a class="uk-navbar-brand" href="#">Table of Contents</a>
</div>
<ul style="clear:both;" class="uk-nav">
{% for page in master_index %}
<li class="uk-nav-header">{{ page.relative_path.split('/')[-1].split('.')[0].title() }}</li>
{% for item in page.indexes %}
{{ render_menu_item(item, page.relative_path) }}
{% endfor %}
{% endfor %}
</ul>
</div>
<div class="uk-width-medium-3-4">
<article class="uk-article">
<h1 class="uk-article-title">{{ project.name }}</h1>
<p class="uk-article-lead">{{ project.description }}</p>
<div class="uk-width-medium-1-1">
{{ documentation|safe }}
</div>
</div>
</article>
</div>
</div>
</div>
{% if info.relative_path.endswith("welcome.md") %}
{% include "./logo.html" %}
{% else %}
{% include "./content.html" %}
{% endif %}
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '{{ project.google_analytics_code }}']);