This file is indexed.

/usr/lib/python3/dist-packages/responses-0.5.1.egg-info/PKG-INFO is in python3-responses 0.5.1-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
Metadata-Version: 1.1
Name: responses
Version: 0.5.1
Summary: A utility library for mocking out the `requests` Python library.
Home-page: https://github.com/getsentry/responses
Author: David Cramer
Author-email: UNKNOWN
License: Apache 2.0
Description: Responses
        =========
        
        .. image:: https://travis-ci.org/getsentry/responses.png?branch=master
        	:target: https://travis-ci.org/getsentry/responses
        
        A utility library for mocking out the `requests` Python library.
        
        .. note:: Responses requires Requests >= 2.0
        
        Response body as string
        -----------------------
        
        .. code-block:: python
        
            import responses
            import requests
        
            @responses.activate
            def test_my_api():
                responses.add(responses.GET, 'http://twitter.com/api/1/foobar',
                              body='{"error": "not found"}', status=404,
                              content_type='application/json')
        
                resp = requests.get('http://twitter.com/api/1/foobar')
        
                assert resp.json() == {"error": "not found"}
        
                assert len(responses.calls) == 1
                assert responses.calls[0].request.url == 'http://twitter.com/api/1/foobar'
                assert responses.calls[0].response.text == '{"error": "not found"}'
        
        You can also specify a JSON object instead of a body string.
        
        .. code-block:: python
        
            import responses
            import requests
        
            @responses.activate
            def test_my_api():
                responses.add(responses.GET, 'http://twitter.com/api/1/foobar',
                              json={"error": "not found"}, status=404)
        
                resp = requests.get('http://twitter.com/api/1/foobar')
        
                assert resp.json() == {"error": "not found"}
        
                assert len(responses.calls) == 1
                assert responses.calls[0].request.url == 'http://twitter.com/api/1/foobar'
                assert responses.calls[0].response.text == '{"error": "not found"}'
        
        Request callback
        ----------------
        
        .. code-block:: python
        
            import json
        
            import responses
            import requests
        
            @responses.activate
            def test_calc_api():
        
                def request_callback(request):
                    payload = json.loads(request.body)
                    resp_body = {'value': sum(payload['numbers'])}
                    headers = {'request-id': '728d329e-0e86-11e4-a748-0c84dc037c13'}
                    return (200, headers, json.dumps(resp_body))
        
                responses.add_callback(
                    responses.POST, 'http://calc.com/sum',
                    callback=request_callback,
                    content_type='application/json',
                )
        
                resp = requests.post(
                    'http://calc.com/sum',
                    json.dumps({'numbers': [1, 2, 3]}),
                    headers={'content-type': 'application/json'},
                )
        
                assert resp.json() == {'value': 6}
        
                assert len(responses.calls) == 1
                assert responses.calls[0].request.url == 'http://calc.com/sum'
                assert responses.calls[0].response.text == '{"value": 6}'
                assert (
                    responses.calls[0].response.headers['request-id'] ==
                    '728d329e-0e86-11e4-a748-0c84dc037c13'
                )
        
        Instead of passing a string URL into `responses.add` or `responses.add_callback`
        you can also supply a compiled regular expression.
        
        .. code-block:: python
        
            import re
            import responses
            import requests
        
            # Instead of
            responses.add(responses.GET, 'http://twitter.com/api/1/foobar',
                          body='{"error": "not found"}', status=404,
                          content_type='application/json')
        
            # You can do the following
            url_re = re.compile(r'https?://twitter.com/api/\d+/foobar')
            responses.add(responses.GET, url_re,
                          body='{"error": "not found"}', status=404,
                          content_type='application/json')
        
        A response can also throw an exception as follows.
        
        .. code-block:: python
        
            import responses
            import requests
            from requests.exceptions import HTTPError
        
            exception = HTTPError('Something went wrong')
            responses.add(responses.GET, 'http://twitter.com/api/1/foobar',
                          body=exception)
            # All calls to 'http://twitter.com/api/1/foobar' will throw exception.
        
        
        Responses as a context manager
        ------------------------------
        
        .. code-block:: python
        
            import responses
            import requests
        
        
            def test_my_api():
                with responses.RequestsMock() as rsps:
                    rsps.add(responses.GET, 'http://twitter.com/api/1/foobar',
                             body='{}', status=200,
                             content_type='application/json')
                    resp = requests.get('http://twitter.com/api/1/foobar')
        
                    assert resp.status_code == 200
        
                # outside the context manager requests will hit the remote server
                resp = requests.get('http://twitter.com/api/1/foobar')
                resp.status_code == 404
        
        
        Assertions on declared responses
        --------------------------------
        
        By default Responses will raise an assertion error if a url was registered but not accessed. This
        can be disabled by passing the ``assert_all_requests_are_fired`` value:
        
        .. code-block:: python
        
            import responses
            import requests
        
        
            def test_my_api():
                with responses.RequestsMock(assert_all_requests_are_fired=False) as rsps:
                    rsps.add(responses.GET, 'http://twitter.com/api/1/foobar',
                             body='{}', status=200,
                             content_type='application/json')
        
Platform: UNKNOWN
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development