rsolr 0.9.6 → 0.9.7.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,40 +0,0 @@
1
- module HTTPClientTestMethods
2
-
3
- URL = 'http://localhost:8983/solr/'
4
-
5
- def test_raise_unknown_adapter
6
- assert_raise RSolr::HTTPClient::UnkownAdapterError do
7
- c = RSolr::HTTPClient.connect(:blah, URL)
8
- end
9
- end
10
-
11
- # the responses from the HTTPClient adapter should return the same hash structure
12
- def test_get_response
13
- headers = {}
14
- data = nil
15
- response = @c.get('select', :q=>'*:*')
16
- assert_equal data, response[:data]
17
- assert_equal 200, response[:status_code]
18
- expected_params = {:q=>'*:*'}
19
- assert_equal expected_params, response[:params]
20
- assert_equal 'select', response[:path]
21
- assert response[:body] =~ /name="responseHeader"/
22
- assert_equal 'http://localhost:8983/solr/select?q=%2A%3A%2A', response[:url]
23
- assert_equal headers, response[:headers]
24
- end
25
-
26
- def test_post_response
27
- headers = {"Content-Type" => 'text/xml; charset=utf-8'}
28
- data = '<add><doc><field name="id">1</field></doc></add>'
29
- response = @c.post('update', data, {}, headers)
30
- assert_equal data, response[:data]
31
- assert_equal 200, response[:status_code]
32
- expected_params = {}
33
- assert_equal expected_params, response[:params]
34
- assert_equal 'update', response[:path]
35
- assert response[:body] =~ /name="responseHeader"/
36
- assert_equal 'http://localhost:8983/solr/update', response[:url]
37
- assert_equal headers, response[:headers]
38
- end
39
-
40
- end