activeforce 1.10.5 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -24,7 +24,7 @@ class Salesforce::ColumnTest < ActiveSupport::TestCase
24
24
  assert_equal :string, col.type
25
25
  assert_equal false, col.editable?
26
26
  end
27
-
27
+
28
28
  def test_initializer__editable
29
29
  col = Salesforce::Column.new("name" => "Name__c", "type" => "string", "updateable" => true, "createable" => false)
30
30
  assert_equal "name", col.name
@@ -39,35 +39,35 @@ class Salesforce::ColumnTest < ActiveSupport::TestCase
39
39
  assert col.createable?
40
40
  assert_equal false, col.updateable?
41
41
  end
42
-
42
+
43
43
  def test_to_soql_value
44
- assert_equal "'string'", Salesforce::Column.to_soql_value('string')
45
- assert_equal "TRUE", Salesforce::Column.to_soql_value(true)
46
- assert_equal "FALSE", Salesforce::Column.to_soql_value(false)
47
- assert_equal "NULL", Salesforce::Column.to_soql_value(nil)
48
- assert_equal "2012-01-02", Salesforce::Column.to_soql_value(Date.parse('2012-01-02'))
49
- assert_equal "2012-01-02T18:40:00-08:00", Salesforce::Column.to_soql_value(Time.zone.parse('2012-01-02 06:40PM'))
50
- assert_equal "1", Salesforce::Column.to_soql_value(1)
51
- assert_equal "1.0", Salesforce::Column.to_soql_value(1.0)
52
- assert_equal "1.04", Salesforce::Column.to_soql_value(BigDecimal("1.04"))
53
- assert_equal "'col'", Salesforce::Column.to_soql_value(:col)
44
+ assert_equal "'string'", Salesforce::Column.to_soql_value('string')
45
+ assert_equal "TRUE", Salesforce::Column.to_soql_value(true)
46
+ assert_equal "FALSE", Salesforce::Column.to_soql_value(false)
47
+ assert_equal "NULL", Salesforce::Column.to_soql_value(nil)
48
+ assert_equal "2012-01-02", Salesforce::Column.to_soql_value(Date.parse('2012-01-02'))
49
+ assert_equal "2012-01-02T18:40:00-08:00", Salesforce::Column.to_soql_value(Time.zone.parse('2012-01-02 06:40PM'))
50
+ assert_equal "1", Salesforce::Column.to_soql_value(1)
51
+ assert_equal "1.0", Salesforce::Column.to_soql_value(1.0)
52
+ assert_equal "1.04", Salesforce::Column.to_soql_value(BigDecimal.new("1.04"))
53
+ assert_equal "'col'", Salesforce::Column.to_soql_value(:col)
54
54
  assert_equal "('string1','string2','string3')", Salesforce::Column.to_soql_value(['string1','string2','string3'])
55
55
  assert_equal "('string1',1,2012-01-02)", Salesforce::Column.to_soql_value(['string1',1,Date.parse("2012-01-02")])
56
56
  end
57
-
57
+
58
58
  def test_to_csv_value
59
- assert_equal "string", Salesforce::Column.to_csv_value('string')
60
- assert_equal "TRUE", Salesforce::Column.to_csv_value(true)
61
- assert_equal "FALSE", Salesforce::Column.to_csv_value(false)
62
- assert_equal '#N/A', Salesforce::Column.to_csv_value(nil)
63
- assert_equal "2012-01-02", Salesforce::Column.to_csv_value(Date.parse('2012-01-02'))
64
- assert_equal "2012-01-02T18:40:00-08:00", Salesforce::Column.to_csv_value(Time.zone.parse('2012-01-02 06:40PM'))
65
- assert_equal "1", Salesforce::Column.to_csv_value(1)
66
- assert_equal "1.0", Salesforce::Column.to_csv_value(1.0)
67
- assert_equal "1.04", Salesforce::Column.to_csv_value(BigDecimal("1.04"))
68
- assert_equal "col", Salesforce::Column.to_csv_value(:col)
59
+ assert_equal "string", Salesforce::Column.to_csv_value('string')
60
+ assert_equal "TRUE", Salesforce::Column.to_csv_value(true)
61
+ assert_equal "FALSE", Salesforce::Column.to_csv_value(false)
62
+ assert_equal '#N/A', Salesforce::Column.to_csv_value(nil)
63
+ assert_equal "2012-01-02", Salesforce::Column.to_csv_value(Date.parse('2012-01-02'))
64
+ assert_equal "2012-01-02T18:40:00-08:00", Salesforce::Column.to_csv_value(Time.zone.parse('2012-01-02 06:40PM'))
65
+ assert_equal "1", Salesforce::Column.to_csv_value(1)
66
+ assert_equal "1.0", Salesforce::Column.to_csv_value(1.0)
67
+ assert_equal "1.04", Salesforce::Column.to_csv_value(BigDecimal.new("1.04"))
68
+ assert_equal "col", Salesforce::Column.to_csv_value(:col)
69
69
  end
70
-
70
+
71
71
  def test_typecast
72
72
  assert_equal "123456789012345", Salesforce::Column.typecast(:id, "123456789012345")
73
73
  assert_equal "123456789012345", Salesforce::Column.typecast(:id, "123456789012345123")
@@ -75,12 +75,12 @@ class Salesforce::ColumnTest < ActiveSupport::TestCase
75
75
  assert_equal "123456789012345", Salesforce::Column.typecast(:reference, "123456789012345123")
76
76
  assert_equal Date.parse("2011-08-31"), Salesforce::Column.typecast(:date, "2011-08-31")
77
77
  assert_equal Date.parse("2011-08-31"), Salesforce::Column.typecast(:date, Date.parse("2011-08-31"))
78
- assert_nil Salesforce::Column.typecast(:date, nil)
79
- assert_nil Salesforce::Column.typecast(:date, 'nil')
78
+ assert_equal nil, Salesforce::Column.typecast(:date, nil)
79
+ assert_equal nil, Salesforce::Column.typecast(:date, 'nil')
80
80
 
81
81
  assert_equal Time.zone.parse('2012-01-02 06:40PM'), Salesforce::Column.typecast(:datetime, "2012-01-02 18:40:00 -08:00")
82
82
  assert_equal Time.zone.parse('2012-01-02 06:40PM'), Salesforce::Column.typecast(:datetime, Time.zone.parse('2012-01-02 06:40PM'))
83
- assert_nil Salesforce::Column.typecast(:datetime, nil)
83
+ assert_equal nil, Salesforce::Column.typecast(:datetime, nil)
84
84
  assert_equal Time.now.to_s, Salesforce::Column.typecast(:datetime, 'nil').to_s
85
85
 
86
86
  assert_equal BigDecimal("2012"), Salesforce::Column.typecast(:double, "2012")
@@ -89,22 +89,22 @@ class Salesforce::ColumnTest < ActiveSupport::TestCase
89
89
  assert_equal BigDecimal("1.2"), Salesforce::Column.typecast(:double, 1.2)
90
90
  assert_equal 0, Salesforce::Column.typecast(:double, nil)
91
91
  assert_equal 0, Salesforce::Column.typecast(:double, 'nil')
92
-
92
+
93
93
  assert_equal true, Salesforce::Column.typecast(:boolean, true)
94
94
  assert_equal false, Salesforce::Column.typecast(:boolean, false)
95
95
  end
96
-
96
+
97
97
  def test_typecast__date_max
98
- assert_nil Salesforce::Column.typecast(:date, "9999-12-31")
98
+ assert_equal nil, Salesforce::Column.typecast(:date, "9999-12-31")
99
99
  assert_equal Date.parse("4000-12-30"), Salesforce::Column.typecast(:date, "4000-12-30")
100
- assert_nil Salesforce::Column.typecast(:datetime, "9999-12-31")
101
- assert_nil Salesforce::Column.typecast(:datetime, "4000-12-30")
100
+ assert_equal nil, Salesforce::Column.typecast(:datetime, "9999-12-31")
101
+ assert_equal nil, Salesforce::Column.typecast(:datetime, "4000-12-30")
102
102
  end
103
103
 
104
104
  def test_typecast__date_min
105
- assert_nil Salesforce::Column.typecast(:date, "1699-13-31")
106
- assert_nil Salesforce::Column.typecast(:datetime, "1700-01-01")
107
- assert_nil Salesforce::Column.typecast(:datetime, "1699-12-31")
105
+ assert_equal nil, Salesforce::Column.typecast(:date, "1699-13-31")
106
+ assert_equal nil, Salesforce::Column.typecast(:datetime, "1700-01-01")
107
+ assert_equal nil, Salesforce::Column.typecast(:datetime, "1699-12-31")
108
108
  assert_equal Date.parse("01/01/1920").to_time, Salesforce::Column.typecast(:datetime, "1920-01-01")
109
109
  end
110
110
 
@@ -115,12 +115,12 @@ class Salesforce::ColumnTest < ActiveSupport::TestCase
115
115
  assert_equal "123456789012345", Salesforce::Column.typecast(:reference, "123456789012345")
116
116
  assert_equal "123456789012345123", Salesforce::Column.typecast(:reference, "123456789012345123")
117
117
  end
118
-
118
+
119
119
  def test_equals
120
120
  col1 = Salesforce::Column.new("name" => "Name", "type" => "string", "updateable" => true)
121
121
  col2 = Salesforce::Column.new("name" => "Name", "type" => "string", "updateable" => false)
122
122
  col3 = Salesforce::Column.new("name" => "Name__c", "type" => "string", "updateable" => true)
123
-
123
+
124
124
  assert col1 == col2
125
125
  assert col2 != col3
126
126
  assert col1 != col3
@@ -112,9 +112,6 @@ class Salesforce::ConfigTest < ActiveSupport::TestCase
112
112
 
113
113
  config.server_instance "na99"
114
114
  assert_equal "na99", Salesforce::Config.server_instance
115
-
116
- config.server_domain "something.salesforce.com"
117
- assert_equal "something.salesforce.com", Salesforce::Config.server_domain
118
115
 
119
116
  config.user_id "user_id"
120
117
  assert_equal "user_id", Salesforce::Config.user_id
@@ -124,10 +121,9 @@ class Salesforce::ConfigTest < ActiveSupport::TestCase
124
121
  def test_server_url__and_server_host
125
122
  config = Salesforce::Config.instance
126
123
  config.server_instance "sa2"
127
- config.server_domain "something.salesforce.com"
128
124
  config.api_version 99
129
- assert_equal "https://sa2.something.salesforce.com/services/data/v99.0", Salesforce::Config.server_url
130
- assert_equal "https://sa2.something.salesforce.com", Salesforce::Config.server_host
125
+ assert_equal "https://sa2.salesforce.com/services/data/v99.0", Salesforce::Config.server_url
126
+ assert_equal "https://sa2.salesforce.com", Salesforce::Config.server_host
131
127
  end
132
128
 
133
129
  def test_configured
@@ -1,11 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class Salesforce.connection::AsyncTest < ActiveSupport::TestCase
4
- setup do
5
- Salesforce::Config.instance.server_instance 'awesome-2000'
6
- Salesforce::Config.instance.server_domain 'something.salesforce.com'
7
- end
8
-
9
4
  def async_post(path, body, options = {})
10
5
  as_logged_in_user do
11
6
  convert_body RestClient.post(async_api_url(path), body, async_headers(options)), options
@@ -13,14 +8,14 @@ class Salesforce.connection::AsyncTest < ActiveSupport::TestCase
13
8
  rescue => e
14
9
  raise e
15
10
  end
16
-
11
+
17
12
  def test_async_post__json
18
13
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
19
14
  http_body = stub(:body => { :result => 'foo' }.to_json)
20
- RestClient.expects(:post).with('https://awesome-2000.something.salesforce.com/services/async/22.0/path', :body, {'X-SFDC-Session' => 'session_id', :content_type => 'application/json'}).returns(http_body)
15
+ RestClient.expects(:post).with('https://.salesforce.com/services/async/22.0/path', :body, {'X-SFDC-Session' => 'session_id', :content_type => 'application/json'}).returns(http_body)
21
16
  assert_equal({'result' => 'foo'}, Salesforce.connection.async_post('path', :body, :format => :json))
22
17
  end
23
-
18
+
24
19
  def test_async_post__404_error_json
25
20
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
26
21
  error = RestClient::BadRequest.new
@@ -31,106 +26,113 @@ class Salesforce.connection::AsyncTest < ActiveSupport::TestCase
31
26
  assert false, "Shouldn't have gotten here"
32
27
  rescue => e
33
28
  assert_equal "Salesforce::InvalidRequest", e.class.name
34
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/async/22.0/path", e.message
29
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/async/22.0/path", e.message
35
30
  end
36
31
  end
37
-
32
+
38
33
  def test_async_post__404_error_xml
39
34
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
40
35
  error = RestClient::BadRequest.new
41
36
  error.stubs(:http_body).returns("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Errors><Error><errorCode>MALFORMED_QUERY</errorCode><message>someproblem</message></Error></Errors>" )
42
- RestClient.expects(:post).with('https://awesome-2000.something.salesforce.com/services/async/22.0/path', :body, {'X-SFDC-Session' => 'session_id', :content_type => 'application/xml'}).raises(error)
43
-
37
+ RestClient.expects(:post).with('https://.salesforce.com/services/async/22.0/path', :body, {'X-SFDC-Session' => 'session_id', :content_type => 'application/xml'}).raises(error)
38
+
44
39
  begin
45
40
  Salesforce.connection.async_post('path', :body, :format => :xml)
46
41
  assert false, "Shouldn't have gotten here"
47
42
  rescue => e
48
43
  assert_equal "Salesforce::InvalidRequest", e.class.name
49
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/async/22.0/path", e.message
44
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/async/22.0/path", e.message
50
45
  end
51
46
  end
52
-
47
+
53
48
  def test_async_post__400_error_json
54
49
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
55
50
  error = RestClient::ResourceNotFound.new
56
51
  error.stubs(:http_body).returns("[{\"message\":\"someproblem\",\"errorCode\":\"MALFORMED_QUERY\"}]")
57
- RestClient.expects(:post).with('https://awesome-2000.something.salesforce.com/services/async/22.0/path', :body, {'X-SFDC-Session' => 'session_id', :content_type => 'application/json'}).raises(error)
52
+ RestClient.expects(:post).with('https://.salesforce.com/services/async/22.0/path', :body, {'X-SFDC-Session' => 'session_id', :content_type => 'application/json'}).raises(error)
58
53
  begin
59
54
  Salesforce.connection.async_post('path', :body, :format => :json)
60
55
  assert false, "Shouldn't have gotten here"
61
56
  rescue => e
62
57
  assert_equal "Salesforce::InvalidRequest", e.class.name
63
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/async/22.0/path", e.message
58
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/async/22.0/path", e.message
64
59
  end
65
60
  end
66
-
61
+
67
62
  def test_async_post__400_error_xml
68
63
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
69
64
  error = RestClient::ResourceNotFound.new
70
65
  error.stubs(:http_body).returns("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Errors><Error><errorCode>MALFORMED_QUERY</errorCode><message>someproblem</message></Error></Errors>" )
71
- RestClient.expects(:post).with('https://awesome-2000.something.salesforce.com/services/async/22.0/path', :body, {'X-SFDC-Session' => 'session_id', :content_type => 'application/xml'}).raises(error)
72
-
66
+ RestClient.expects(:post).with('https://.salesforce.com/services/async/22.0/path', :body, {'X-SFDC-Session' => 'session_id', :content_type => 'application/xml'}).raises(error)
67
+
73
68
  begin
74
69
  Salesforce.connection.async_post('path', :body, :format => :xml)
75
70
  assert false, "Shouldn't have gotten here"
76
71
  rescue => e
77
72
  assert_equal "Salesforce::InvalidRequest", e.class.name
78
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/async/22.0/path", e.message
73
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/async/22.0/path", e.message
79
74
  end
80
75
  end
81
-
76
+
82
77
  def test_async_post__xml
83
78
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
84
79
  http_body = stub(:body => { :result => 'foo' }.to_xml)
85
- RestClient.expects(:post).with('https://awesome-2000.something.salesforce.com/services/async/22.0/path', :body, {'X-SFDC-Session' => 'session_id', :content_type => 'application/xml'}).returns(http_body)
80
+ RestClient.expects(:post).with('https://.salesforce.com/services/async/22.0/path', :body, {'X-SFDC-Session' => 'session_id', :content_type => 'application/xml'}).returns(http_body)
86
81
  assert_equal({'result' => 'foo'}, Salesforce.connection.async_post('path', :body, :format => :xml))
87
82
  end
88
-
83
+
89
84
  def test_async_get__json
90
85
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
91
86
  http_body = stub(:body => { :result => 'foo' }.to_json)
92
- RestClient.expects(:get).with('https://awesome-2000.something.salesforce.com/services/async/22.0/path', {'X-SFDC-Session' => 'session_id', :content_type => 'application/json'}).returns(http_body)
87
+ RestClient.expects(:get).with('https://.salesforce.com/services/async/22.0/path', {'X-SFDC-Session' => 'session_id', :content_type => 'application/json'}).returns(http_body)
93
88
  assert_equal({'result' => 'foo'}, Salesforce.connection.async_get('path', :format => :json))
94
89
  end
95
-
90
+
96
91
  def test_async_get__error_json
97
92
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
98
93
  error = RestClient::BadRequest.new
99
94
  error.stubs(:http_body).returns("[{\"message\":\"someproblem\",\"errorCode\":\"MALFORMED_QUERY\"}]")
100
- RestClient.expects(:get).with('https://awesome-2000.something.salesforce.com/services/async/22.0/path', {'X-SFDC-Session' => 'session_id', :content_type => 'application/json'}).raises(error)
101
-
95
+ RestClient.expects(:get).with('https://.salesforce.com/services/async/22.0/path', {'X-SFDC-Session' => 'session_id', :content_type => 'application/json'}).raises(error)
96
+
102
97
  begin
103
98
  Salesforce.connection.async_get('path', :format => :json)
104
99
  assert false, "Shouldn't have gotten here"
105
100
  rescue => e
106
101
  assert_equal "Salesforce::InvalidRequest", e.class.name
107
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/async/22.0/path", e.message
102
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/async/22.0/path", e.message
108
103
  end
109
104
  end
110
-
105
+
111
106
  def test_async_get__error_xml
112
107
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
113
108
  error = RestClient::BadRequest.new
114
109
  error.stubs(:http_body).returns("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Errors><Error><errorCode>MALFORMED_QUERY</errorCode><message>someproblem</message></Error></Errors>" )
115
- RestClient.expects(:get).with('https://awesome-2000.something.salesforce.com/services/async/22.0/path', {'X-SFDC-Session' => 'session_id', :content_type => 'application/xml'}).raises(error)
116
-
110
+ RestClient.expects(:get).with('https://.salesforce.com/services/async/22.0/path', {'X-SFDC-Session' => 'session_id', :content_type => 'application/xml'}).raises(error)
111
+
117
112
  begin
118
113
  Salesforce.connection.async_get('path', :format => :xml)
119
114
  assert false, "Shouldn't have gotten here"
120
115
  rescue => e
121
116
  assert_equal "Salesforce::InvalidRequest", e.class.name
122
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/async/22.0/path", e.message
117
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/async/22.0/path", e.message
123
118
  end
124
119
  end
125
-
120
+
126
121
  def test_async_get__xml
127
122
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
128
123
  http_body = stub(:body => { :result => 'foo' }.to_xml)
129
- RestClient.expects(:get).with('https://awesome-2000.something.salesforce.com/services/async/22.0/path', {'X-SFDC-Session' => 'session_id', :content_type => 'application/xml'}).returns(http_body)
124
+ RestClient.expects(:get).with('https://.salesforce.com/services/async/22.0/path', {'X-SFDC-Session' => 'session_id', :content_type => 'application/xml'}).returns(http_body)
130
125
  assert_equal({'result' => 'foo'}, Salesforce.connection.async_get('path', :format => :xml))
131
126
  end
132
-
127
+
133
128
  def test_async_api_url
134
- assert_equal 'https://awesome-2000.something.salesforce.com/services/async/22.0/path', Salesforce.connection.async_api_url('path')
129
+ assert_equal 'https://.salesforce.com/services/async/22.0/path', Salesforce.connection.async_api_url('path')
135
130
  end
131
+
132
+
133
+
134
+
135
+
136
+
137
+
136
138
  end
@@ -1,11 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
4
- setup do
5
- Salesforce::Config.instance.server_instance 'awesome-2000'
6
- Salesforce::Config.instance.server_domain 'something.salesforce.com'
7
- end
8
-
9
4
  def test_content_type_headers
10
5
  assert_equal({ :content_type => 'application/json'}, Salesforce.connection.content_type_headers(:format => :json))
11
6
  assert_equal({ :content_type => 'application/json'}, Salesforce.connection.content_type_headers(:format => "json"))
@@ -18,7 +13,7 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
18
13
  def test_get__json
19
14
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
20
15
  http_body = stub(:body => { :result => 'foo' }.to_json)
21
- RestClient.expects(:get).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).returns(http_body)
16
+ RestClient.expects(:get).with('https://.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).returns(http_body)
22
17
  assert_equal({'result' => 'foo'}, Salesforce.connection.get('path', :format => :json))
23
18
  end
24
19
 
@@ -26,14 +21,14 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
26
21
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
27
22
  error = RestClient::BadRequest.new
28
23
  error.stubs(:http_body).returns("[{\"message\":\"someproblem\",\"errorCode\":\"MALFORMED_QUERY\"}]")
29
- RestClient.expects(:get).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).raises(error)
24
+ RestClient.expects(:get).with('https://.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).raises(error)
30
25
 
31
26
  begin
32
27
  Salesforce.connection.get('path', :format => :json)
33
28
  assert false, "Shouldn't have gotten here"
34
29
  rescue => e
35
30
  assert_equal "Salesforce::InvalidRequest", e.class.name
36
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/data/v22.0/path", e.message
31
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/data/v22.0/path", e.message
37
32
  end
38
33
  end
39
34
 
@@ -41,28 +36,28 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
41
36
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
42
37
  error = RestClient::BadRequest.new
43
38
  error.stubs(:http_body).returns("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Errors><Error><errorCode>MALFORMED_QUERY</errorCode><message>someproblem</message></Error></Errors>" )
44
- RestClient.expects(:get).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
39
+ RestClient.expects(:get).with('https://.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
45
40
 
46
41
  begin
47
42
  Salesforce.connection.get('path', :format => :xml)
48
43
  assert false, "Shouldn't have gotten here"
49
44
  rescue => e
50
45
  assert_equal "Salesforce::InvalidRequest", e.class.name
51
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/data/v22.0/path", e.message
46
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/data/v22.0/path", e.message
52
47
  end
53
48
  end
54
49
 
55
50
  def test_get__xml
56
51
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
57
52
  http_body = stub(:body => { :result => 'foo' }.to_xml)
58
- RestClient.expects(:get).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).returns(http_body)
53
+ RestClient.expects(:get).with('https://.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).returns(http_body)
59
54
  assert_equal({'result' => 'foo'}, Salesforce.connection.get('path', :format => :xml))
60
55
  end
61
56
 
62
57
  def test_patch__json
63
58
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
64
59
  http_body = stub(:code => 204, :body => '')
65
- RestClient.expects(:patch).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).returns(http_body)
60
+ RestClient.expects(:patch).with('https://.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).returns(http_body)
66
61
  assert Salesforce.connection.patch('path', :body, :format => :json)
67
62
  end
68
63
 
@@ -70,13 +65,13 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
70
65
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
71
66
  error = RestClient::BadRequest.new
72
67
  error.stubs(:http_body).returns("[{\"message\":\"someproblem\",\"errorCode\":\"MALFORMED_QUERY\"}]")
73
- RestClient.expects(:patch).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).raises(error)
68
+ RestClient.expects(:patch).with('https://.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).raises(error)
74
69
  begin
75
70
  Salesforce.connection.patch('path', :body, :format => :json)
76
71
  assert false, "Shouldn't have gotten here"
77
72
  rescue => e
78
73
  assert_equal "Salesforce::InvalidRequest", e.class.name
79
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/data/v22.0/path", e.message
74
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/data/v22.0/path", e.message
80
75
  end
81
76
  end
82
77
 
@@ -84,14 +79,14 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
84
79
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
85
80
  error = RestClient::BadRequest.new
86
81
  error.stubs(:http_body).returns("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Errors><Error><errorCode>MALFORMED_QUERY</errorCode><message>someproblem</message></Error></Errors>" )
87
- RestClient.expects(:patch).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
82
+ RestClient.expects(:patch).with('https://.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
88
83
 
89
84
  begin
90
85
  Salesforce.connection.patch('path', :body, :format => :xml)
91
86
  assert false, "Shouldn't have gotten here"
92
87
  rescue => e
93
88
  assert_equal "Salesforce::InvalidRequest", e.class.name
94
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/data/v22.0/path", e.message
89
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/data/v22.0/path", e.message
95
90
  end
96
91
  end
97
92
 
@@ -99,13 +94,13 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
99
94
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
100
95
  error = RestClient::ResourceNotFound.new
101
96
  error.stubs(:http_body).returns("[{\"message\":\"someproblem\",\"errorCode\":\"MALFORMED_QUERY\"}]")
102
- RestClient.expects(:patch).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).raises(error)
97
+ RestClient.expects(:patch).with('https://.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).raises(error)
103
98
  begin
104
99
  Salesforce.connection.patch('path', :body, :format => :json)
105
100
  assert false, "Shouldn't have gotten here"
106
101
  rescue => e
107
102
  assert_equal "Salesforce::InvalidRequest", e.class.name
108
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/data/v22.0/path", e.message
103
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/data/v22.0/path", e.message
109
104
  end
110
105
  end
111
106
 
@@ -113,21 +108,21 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
113
108
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
114
109
  error = RestClient::ResourceNotFound.new
115
110
  error.stubs(:http_body).returns("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Errors><Error><errorCode>MALFORMED_QUERY</errorCode><message>someproblem</message></Error></Errors>" )
116
- RestClient.expects(:patch).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
111
+ RestClient.expects(:patch).with('https://.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
117
112
 
118
113
  begin
119
114
  Salesforce.connection.patch('path', :body, :format => :xml)
120
115
  assert false, "Shouldn't have gotten here"
121
116
  rescue => e
122
117
  assert_equal "Salesforce::InvalidRequest", e.class.name
123
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/data/v22.0/path", e.message
118
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/data/v22.0/path", e.message
124
119
  end
125
120
  end
126
121
 
127
122
  def test_patch__xml
128
123
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
129
124
  http_body = stub(:code => 204, :body => '')
130
- RestClient.expects(:patch).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).returns(http_body)
125
+ RestClient.expects(:patch).with('https://.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).returns(http_body)
131
126
  assert Salesforce.connection.patch('path', :body, :format => :xml)
132
127
  end
133
128
 
@@ -135,7 +130,7 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
135
130
  def test_post__json
136
131
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
137
132
  http_body = stub(:body => { :result => 'foo' }.to_json)
138
- RestClient.expects(:post).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).returns(http_body)
133
+ RestClient.expects(:post).with('https://.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).returns(http_body)
139
134
  assert_equal({'result' => 'foo'}, Salesforce.connection.post('path', :body, :format => :json))
140
135
  end
141
136
 
@@ -143,13 +138,13 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
143
138
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
144
139
  error = RestClient::BadRequest.new
145
140
  error.stubs(:http_body).returns("[{\"message\":\"someproblem\",\"errorCode\":\"MALFORMED_QUERY\"}]")
146
- RestClient.expects(:post).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).raises(error)
141
+ RestClient.expects(:post).with('https://.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).raises(error)
147
142
  begin
148
143
  Salesforce.connection.post('path', :body, :format => :json)
149
144
  assert false, "Shouldn't have gotten here"
150
145
  rescue => e
151
146
  assert_equal "Salesforce::InvalidRequest", e.class.name
152
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/data/v22.0/path", e.message
147
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/data/v22.0/path", e.message
153
148
  end
154
149
  end
155
150
 
@@ -157,14 +152,14 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
157
152
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
158
153
  error = RestClient::BadRequest.new
159
154
  error.stubs(:http_body).returns("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Errors><Error><errorCode>MALFORMED_QUERY</errorCode><message>someproblem</message></Error></Errors>" )
160
- RestClient.expects(:post).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
155
+ RestClient.expects(:post).with('https://.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
161
156
 
162
157
  begin
163
158
  Salesforce.connection.post('path', :body, :format => :xml)
164
159
  assert false, "Shouldn't have gotten here"
165
160
  rescue => e
166
161
  assert_equal "Salesforce::InvalidRequest", e.class.name
167
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/data/v22.0/path", e.message
162
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/data/v22.0/path", e.message
168
163
  end
169
164
  end
170
165
 
@@ -172,13 +167,13 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
172
167
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
173
168
  error = RestClient::ResourceNotFound.new
174
169
  error.stubs(:http_body).returns("[{\"message\":\"someproblem\",\"errorCode\":\"MALFORMED_QUERY\"}]")
175
- RestClient.expects(:post).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).raises(error)
170
+ RestClient.expects(:post).with('https://.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).raises(error)
176
171
  begin
177
172
  Salesforce.connection.post('path', :body, :format => :json)
178
173
  assert false, "Shouldn't have gotten here"
179
174
  rescue => e
180
175
  assert_equal "Salesforce::InvalidRequest", e.class.name
181
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/data/v22.0/path", e.message
176
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/data/v22.0/path", e.message
182
177
  end
183
178
  end
184
179
 
@@ -186,21 +181,21 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
186
181
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
187
182
  error = RestClient::ResourceNotFound.new
188
183
  error.stubs(:http_body).returns("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Errors><Error><errorCode>MALFORMED_QUERY</errorCode><message>someproblem</message></Error></Errors>" )
189
- RestClient.expects(:post).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
184
+ RestClient.expects(:post).with('https://.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
190
185
 
191
186
  begin
192
187
  Salesforce.connection.post('path', :body, :format => :xml)
193
188
  assert false, "Shouldn't have gotten here"
194
189
  rescue => e
195
190
  assert_equal "Salesforce::InvalidRequest", e.class.name
196
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/data/v22.0/path", e.message
191
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/data/v22.0/path", e.message
197
192
  end
198
193
  end
199
194
 
200
195
  def test_post__xml
201
196
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
202
197
  http_body = stub(:body => { :result => 'foo' }.to_xml)
203
- RestClient.expects(:post).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).returns(http_body)
198
+ RestClient.expects(:post).with('https://.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).returns(http_body)
204
199
  assert_equal({'result' => 'foo'}, Salesforce.connection.post('path', :body, :format => :xml))
205
200
  end
206
201
 
@@ -208,14 +203,14 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
208
203
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
209
204
  error = RestClient::BadRequest.new
210
205
  error.stubs(:http_body).returns("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Errors><Error><errorCode>MALFORMED_QUERY</errorCode><message>someproblem</message></Error></Errors>" )
211
- RestClient.expects(:delete).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
206
+ RestClient.expects(:delete).with('https://.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
212
207
 
213
208
  begin
214
209
  Salesforce.connection.delete('path')
215
210
  assert false, "Shouldn't have gotten here"
216
211
  rescue => e
217
212
  assert_equal "Salesforce::InvalidRequest", e.class.name
218
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/data/v22.0/path", e.message
213
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/data/v22.0/path", e.message
219
214
  end
220
215
  end
221
216
 
@@ -223,25 +218,25 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
223
218
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
224
219
  error = RestClient::ResourceNotFound.new
225
220
  error.stubs(:http_body).returns("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Errors><Error><errorCode>MALFORMED_QUERY</errorCode><message>someproblem</message></Error></Errors>" )
226
- RestClient.expects(:delete).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
221
+ RestClient.expects(:delete).with('https://.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
227
222
 
228
223
  begin
229
224
  Salesforce.connection.delete('path')
230
225
  assert false, "Shouldn't have gotten here"
231
226
  rescue => e
232
227
  assert_equal "Salesforce::InvalidRequest", e.class.name
233
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/data/v22.0/path", e.message
228
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/data/v22.0/path", e.message
234
229
  end
235
230
  end
236
231
 
237
232
  def test_delete__xml
238
233
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
239
- RestClient.expects(:delete).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).returns(stub(:body => ''))
234
+ RestClient.expects(:delete).with('https://.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).returns(stub(:body => ''))
240
235
  assert Salesforce.connection.delete('path')
241
236
  end
242
237
 
243
238
  def test_salesforce_url
244
- assert_equal 'https://awesome-2000.something.salesforce.com/services/data/v22.0/path', Salesforce.connection.salesforce_url("path")
245
- assert_equal 'https://awesome-2000.something.salesforce.com/services/data/23.0/foo', Salesforce.connection.salesforce_url("/services/data/23.0/foo")
239
+ assert_equal 'https://.salesforce.com/services/data/v22.0/path', Salesforce.connection.salesforce_url("path")
240
+ assert_equal 'https://.salesforce.com/services/data/23.0/foo', Salesforce.connection.salesforce_url("/services/data/23.0/foo")
246
241
  end
247
- end
242
+ end