Skip to content

Commit 3005212

Browse files
committed
use vcrpy to mock HTTP interactions
1 parent 86b0eba commit 3005212

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+934
-116
lines changed

fixtures/analytics_autoselects.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
- request: !!python/object:vcr.request.Request
2+
body: ''
3+
headers: !!python/object/apply:__builtin__.frozenset
4+
- - !!python/tuple [User-Agent, Swiftype-Python/1.0.0]
5+
- !!python/tuple [Content-Type, application/json]
6+
host: localhost
7+
method: GET
8+
path: /api/v1/engines/api-test/analytics/autoselects.json?auth_token=a-test-api-key
9+
port: 3000
10+
protocol: http
11+
response:
12+
body: {string: '[["2014-01-06",0],["2014-01-05",0],["2014-01-04",0],["2014-01-03",0],["2014-01-02",0],["2014-01-01",0],["2013-12-31",0],["2013-12-30",0],["2013-12-29",0],["2013-12-28",0],["2013-12-27",0],["2013-12-26",0],["2013-12-25",0],["2013-12-24",0],["2013-12-23",0]]'}
13+
headers: {cache-control: 'max-age=0, private, must-revalidate', connection: close,
14+
content-type: application/json; charset=utf-8, etag: '"d4e02fbdbba3a819f576e328f1a08201"',
15+
server: thin 1.5.0 codename Knife, x-request-id: e9796df35b44951f138f20e31a1ef70e,
16+
x-runtime: '0.017000', x-ua-compatible: IE=Edge}
17+
status: {code: 200, message: OK}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
- request: !!python/object:vcr.request.Request
2+
body: ''
3+
headers: !!python/object/apply:__builtin__.frozenset
4+
- - !!python/tuple [User-Agent, Swiftype-Python/1.0.0]
5+
- !!python/tuple [Content-Type, application/json]
6+
host: localhost
7+
method: GET
8+
path: /api/v1/engines/api-test/analytics/autoselects.json?auth_token=a-test-api-key&start_date=2013-12-31&end_date=2014-01-01
9+
port: 3000
10+
protocol: http
11+
response:
12+
body: {string: '[["2014-01-01",0],["2013-12-31",0]]'}
13+
headers: {cache-control: 'max-age=0, private, must-revalidate', connection: close,
14+
content-type: application/json; charset=utf-8, etag: '"0fcfc6befc63f00afcd764be995a341a"',
15+
server: thin 1.5.0 codename Knife, x-request-id: f4eec152cb66eec412b1b501ed65a650,
16+
x-runtime: '0.018431', x-ua-compatible: IE=Edge}
17+
status: {code: 200, message: OK}

fixtures/analytics_searches.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
- request: !!python/object:vcr.request.Request
2+
body: ''
3+
headers: !!python/object/apply:__builtin__.frozenset
4+
- - !!python/tuple [User-Agent, Swiftype-Python/1.0.0]
5+
- !!python/tuple [Content-Type, application/json]
6+
host: localhost
7+
method: GET
8+
path: /api/v1/engines/api-test/analytics/searches.json?auth_token=a-test-api-key
9+
port: 3000
10+
protocol: http
11+
response:
12+
body: {string: '[["2014-01-06",0],["2014-01-05",0],["2014-01-04",0],["2014-01-03",0],["2014-01-02",0],["2014-01-01",0],["2013-12-31",0],["2013-12-30",0],["2013-12-29",0],["2013-12-28",0],["2013-12-27",0],["2013-12-26",0],["2013-12-25",0],["2013-12-24",0],["2013-12-23",0]]'}
13+
headers: {cache-control: 'max-age=0, private, must-revalidate', connection: close,
14+
content-type: application/json; charset=utf-8, etag: '"d4e02fbdbba3a819f576e328f1a08201"',
15+
server: thin 1.5.0 codename Knife, x-request-id: 135751460e794fb220b4219bc1ce3ad0,
16+
x-runtime: '0.047857', x-ua-compatible: IE=Edge}
17+
status: {code: 200, message: OK}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
- request: !!python/object:vcr.request.Request
2+
body: ''
3+
headers: !!python/object/apply:__builtin__.frozenset
4+
- - !!python/tuple [User-Agent, Swiftype-Python/1.0.0]
5+
- !!python/tuple [Content-Type, application/json]
6+
host: localhost
7+
method: GET
8+
path: /api/v1/engines/api-test/analytics/searches.json?auth_token=a-test-api-key&start_date=2013-12-31&end_date=2014-01-01
9+
port: 3000
10+
protocol: http
11+
response:
12+
body: {string: '[["2014-01-01",0],["2013-12-31",0]]'}
13+
headers: {cache-control: 'max-age=0, private, must-revalidate', connection: close,
14+
content-type: application/json; charset=utf-8, etag: '"0fcfc6befc63f00afcd764be995a341a"',
15+
server: thin 1.5.0 codename Knife, x-request-id: b39c5688e2b0e601eb4a3199eaecab58,
16+
x-runtime: '0.018621', x-ua-compatible: IE=Edge}
17+
status: {code: 200, message: OK}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
- request: !!python/object:vcr.request.Request
2+
body: ''
3+
headers: !!python/object/apply:__builtin__.frozenset
4+
- - !!python/tuple [User-Agent, Swiftype-Python/1.0.0]
5+
- !!python/tuple [Content-Type, application/json]
6+
host: localhost
7+
method: GET
8+
path: /api/v1/engines/api-test/analytics/top_no_result_queries_in_range.json?auth_token=a-test-api-key
9+
port: 3000
10+
protocol: http
11+
response:
12+
body: {string: '[["foo",2],["bar",1]]'}
13+
headers: {cache-control: 'max-age=0, private, must-revalidate', connection: close,
14+
content-type: application/json; charset=utf-8, etag: '"d751713988987e9331980363e24189ce"',
15+
server: thin 1.5.0 codename Knife, x-request-id: 4ba743d24f32e8bf5f2c24bc091ae320,
16+
x-runtime: '0.022363', x-ua-compatible: IE=Edge}
17+
status: {code: 200, message: OK}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
- request: !!python/object:vcr.request.Request
2+
body: ''
3+
headers: !!python/object/apply:__builtin__.frozenset
4+
- - !!python/tuple [User-Agent, Swiftype-Python/1.0.0]
5+
- !!python/tuple [Content-Type, application/json]
6+
host: localhost
7+
method: GET
8+
path: /api/v1/engines/api-test/analytics/top_no_result_queries_in_range.json?auth_token=a-test-api-key&start_date=2013-12-31&end_date=2014-01-01
9+
port: 3000
10+
protocol: http
11+
response:
12+
body: {string: '[["foo",2],["bar",1]]'}
13+
headers: {cache-control: 'max-age=0, private, must-revalidate', connection: close,
14+
content-type: application/json; charset=utf-8, etag: '"d751713988987e9331980363e24189ce"',
15+
server: thin 1.5.0 codename Knife, x-request-id: 404ac03a546269759b387b3d20558581,
16+
x-runtime: '0.018528', x-ua-compatible: IE=Edge}
17+
status: {code: 200, message: OK}

fixtures/analytics_top_queries.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
- request: !!python/object:vcr.request.Request
2+
body: ''
3+
headers: !!python/object/apply:__builtin__.frozenset
4+
- - !!python/tuple [User-Agent, Swiftype-Python/1.0.0]
5+
- !!python/tuple [Content-Type, application/json]
6+
host: localhost
7+
method: GET
8+
path: /api/v1/engines/api-test/analytics/top_queries.json?auth_token=a-test-api-key
9+
port: 3000
10+
protocol: http
11+
response:
12+
body: {string: '[["dostoyevsky",2],["gatsby",1]]'}
13+
headers: {cache-control: 'max-age=0, private, must-revalidate', connection: close,
14+
content-type: application/json; charset=utf-8, etag: '"d751713988987e9331980363e24189ce"',
15+
server: thin 1.5.0 codename Knife, x-request-id: aad1a371b3b319c586ba9f1e47512d0e,
16+
x-runtime: '0.148543', x-ua-compatible: IE=Edge}
17+
status: {code: 200, message: OK}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
- request: !!python/object:vcr.request.Request
2+
body: ''
3+
headers: !!python/object/apply:__builtin__.frozenset
4+
- - !!python/tuple [User-Agent, Swiftype-Python/1.0.0]
5+
- !!python/tuple [Content-Type, application/json]
6+
host: localhost
7+
method: GET
8+
path: /api/v1/engines/api-test/analytics/top_queries_in_range.json?auth_token=a-test-api-key&start_date=2013-12-31&end_date=2014-01-01
9+
port: 3000
10+
protocol: http
11+
response:
12+
body: {string: '[["dostoyevsky",2],["gatsby",1]]'}
13+
headers: {cache-control: 'max-age=0, private, must-revalidate', connection: close,
14+
content-type: application/json; charset=utf-8, etag: '"d751713988987e9331980363e24189ce"',
15+
server: thin 1.5.0 codename Knife, x-request-id: 235629bc196d3670614a343c86968f37,
16+
x-runtime: '0.015943', x-ua-compatible: IE=Edge}
17+
status: {code: 200, message: OK}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
- request: !!python/object:vcr.request.Request
2+
body: ''
3+
headers: !!python/object/apply:__builtin__.frozenset
4+
- - !!python/tuple [User-Agent, Swiftype-Python/1.0.0]
5+
- !!python/tuple [Content-Type, application/json]
6+
host: localhost
7+
method: GET
8+
path: /api/v1/engines/api-test/analytics/top_queries.json?per_page=10&auth_token=a-test-api-key&page=2
9+
port: 3000
10+
protocol: http
11+
response:
12+
body: {string: '[["dostoyevsky",2],["gatsby",1]]'}
13+
headers: {cache-control: 'max-age=0, private, must-revalidate', connection: close,
14+
content-type: application/json; charset=utf-8, etag: '"d751713988987e9331980363e24189ce"',
15+
server: thin 1.5.0 codename Knife, x-request-id: 038ab193a41ca1d0f67e7dd676a5192d,
16+
x-runtime: '0.022563', x-ua-compatible: IE=Edge}
17+
status: {code: 200, message: OK}

fixtures/crawl_domain.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
- request: !!python/object:vcr.request.Request
2+
body: '{"url": "http://crawler-demo-site.herokuapp.com/2012/01/01/first-post.html"}'
3+
headers: !!python/object/apply:__builtin__.frozenset
4+
- - !!python/tuple [User-Agent, Swiftype-Python/1.0.0]
5+
- !!python/tuple [Content-Type, application/json]
6+
host: localhost
7+
method: PUT
8+
path: /api/v1/engines/crawler-demo/domains/52c754fb3ae7406fd3000001/crawl_url.json?auth_token=a-test-api-key
9+
port: 3000
10+
protocol: http
11+
response:
12+
body: {string: '{"external_id":"9508ace2e1ba669854eb49fbe9429952ff1a6d4c","url":"http://crawler-demo-site.herokuapp.com/2012/01/01/first-post.html"}'}
13+
headers: {cache-control: 'max-age=0, private, must-revalidate', connection: close,
14+
content-type: application/json; charset=utf-8, etag: '"dc3e7df6ad36f807472e018fd1e7baeb"',
15+
server: thin 1.5.0 codename Knife, x-request-id: b47b431d9d6c55cbaa30a6daa98ed593,
16+
x-runtime: '0.023079', x-ua-compatible: IE=Edge}
17+
status: {code: 200, message: OK}

0 commit comments

Comments
 (0)