sugarcrm 0.9.10 → 0.9.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. data/LICENSE +1 -1
  2. data/README.rdoc +38 -6
  3. data/Rakefile +1 -0
  4. data/VERSION +1 -1
  5. data/bin/sugarcrm +26 -0
  6. data/lib/sugarcrm.rb +2 -2
  7. data/lib/sugarcrm/associations/association.rb +11 -8
  8. data/lib/sugarcrm/associations/association_collection.rb +1 -1
  9. data/lib/sugarcrm/associations/association_methods.rb +1 -1
  10. data/lib/sugarcrm/attributes/attribute_methods.rb +7 -2
  11. data/lib/sugarcrm/attributes/attribute_typecast.rb +2 -2
  12. data/lib/sugarcrm/base.rb +37 -236
  13. data/lib/sugarcrm/connection/api/get_available_modules.rb +2 -2
  14. data/lib/sugarcrm/connection/api/get_document_revision.rb +2 -2
  15. data/lib/sugarcrm/connection/api/get_entries.rb +2 -2
  16. data/lib/sugarcrm/connection/api/get_entries_count.rb +1 -1
  17. data/lib/sugarcrm/connection/api/get_entry.rb +2 -2
  18. data/lib/sugarcrm/connection/api/get_entry_list.rb +2 -2
  19. data/lib/sugarcrm/connection/api/get_module_fields.rb +2 -2
  20. data/lib/sugarcrm/connection/api/get_note_attachment.rb +1 -1
  21. data/lib/sugarcrm/connection/api/get_relationships.rb +2 -2
  22. data/lib/sugarcrm/connection/api/get_report_entries.rb +1 -1
  23. data/lib/sugarcrm/connection/api/get_server_info.rb +1 -1
  24. data/lib/sugarcrm/connection/api/get_user_id.rb +1 -1
  25. data/lib/sugarcrm/connection/api/get_user_team_id.rb +1 -1
  26. data/lib/sugarcrm/connection/api/logout.rb +1 -1
  27. data/lib/sugarcrm/connection/api/seamless_login.rb +1 -1
  28. data/lib/sugarcrm/connection/api/search_by_module.rb +1 -1
  29. data/lib/sugarcrm/connection/api/set_campaign_merge.rb +1 -1
  30. data/lib/sugarcrm/connection/api/set_document_revision.rb +1 -1
  31. data/lib/sugarcrm/connection/api/set_entries.rb +1 -1
  32. data/lib/sugarcrm/connection/api/set_entry.rb +1 -1
  33. data/lib/sugarcrm/connection/api/set_note_attachment.rb +1 -1
  34. data/lib/sugarcrm/connection/api/set_relationship.rb +1 -1
  35. data/lib/sugarcrm/connection/api/set_relationships.rb +1 -1
  36. data/lib/sugarcrm/connection/connection.rb +5 -10
  37. data/lib/sugarcrm/connection/helper.rb +3 -2
  38. data/lib/sugarcrm/connection/response.rb +8 -6
  39. data/lib/sugarcrm/exceptions.rb +3 -0
  40. data/lib/sugarcrm/finders.rb +2 -0
  41. data/lib/sugarcrm/{dynamic_finder_match.rb → finders/dynamic_finder_match.rb} +0 -0
  42. data/lib/sugarcrm/finders/finder_methods.rb +236 -0
  43. data/lib/sugarcrm/module.rb +35 -11
  44. data/lib/sugarcrm/module_methods.rb +68 -23
  45. data/lib/sugarcrm/session.rb +179 -0
  46. data/test/connection/test_get_available_modules.rb +1 -4
  47. data/test/connection/test_get_entries.rb +2 -8
  48. data/test/connection/test_get_entry.rb +1 -2
  49. data/test/connection/test_get_entry_list.rb +6 -12
  50. data/test/connection/test_get_module_fields.rb +1 -4
  51. data/test/connection/test_get_relationships.rb +1 -4
  52. data/test/connection/test_get_server_info.rb +1 -4
  53. data/test/connection/test_get_user_id.rb +1 -4
  54. data/test/connection/test_get_user_team_id.rb +1 -4
  55. data/test/connection/test_login.rb +3 -5
  56. data/test/connection/test_logout.rb +1 -4
  57. data/test/connection/test_set_note_attachment.rb +1 -2
  58. data/test/connection/test_set_relationship.rb +1 -2
  59. data/test/helper.rb +6 -8
  60. data/test/test_association_collection.rb +1 -2
  61. data/test/test_associations.rb +18 -1
  62. data/test/test_connection.rb +2 -6
  63. data/test/test_module.rb +34 -6
  64. data/test/test_response.rb +2 -3
  65. data/test/test_session.rb +109 -0
  66. data/test/test_sugarcrm.rb +58 -7
  67. metadata +14 -11
  68. data/lib/sugarcrm/environment.rb +0 -63
  69. data/test/test_environment.rb +0 -45
@@ -1,10 +1,7 @@
1
1
  require 'helper'
2
2
 
3
- class TestModuleFields < Test::Unit::TestCase
3
+ class TestModuleFields < ActiveSupport::TestCase
4
4
  context "A SugarCRM.connection" do
5
- setup do
6
- SugarCRM::Connection.new(URL, USER, PASS, {:debug => false, :register_modules => false})
7
- end
8
5
  should "return a hash of module fields when #get_module_fields" do
9
6
  fields = SugarCRM.connection.get_module_fields("Users")
10
7
  assert_instance_of ActiveSupport::HashWithIndifferentAccess, fields
@@ -1,10 +1,7 @@
1
1
  require 'helper'
2
2
 
3
- class TestGetRelationships < Test::Unit::TestCase
3
+ class TestGetRelationships < ActiveSupport::TestCase
4
4
  context "A SugarCRM.connection" do
5
- setup do
6
- SugarCRM::Connection.new(URL, USER, PASS, {:register_modules => false, :debug => false})
7
- end
8
5
  should "return a list of email_addresses when sent #get_relationship and a user_id" do
9
6
  email_addresses = SugarCRM.connection.get_relationships(
10
7
  "Users",1,"email_addresses"
@@ -1,10 +1,7 @@
1
1
  require 'helper'
2
2
 
3
- class TestGetServerInfo < Test::Unit::TestCase
3
+ class TestGetServerInfo < ActiveSupport::TestCase
4
4
  context "A SugarCRM.connection" do
5
- setup do
6
- SugarCRM::Connection.new(URL, USER, PASS, {:register_modules => false})
7
- end
8
5
  should "get server info" do
9
6
  assert_instance_of String, SugarCRM.connection.get_server_info["version"]
10
7
  end
@@ -1,10 +1,7 @@
1
1
  require 'helper'
2
2
 
3
- class TestGetUserID < Test::Unit::TestCase
3
+ class TestGetUserID < ActiveSupport::TestCase
4
4
  context "A SugarCRM.connection" do
5
- setup do
6
- SugarCRM::Connection.new(URL, USER, PASS, {:register_modules => false})
7
- end
8
5
  should "get the ID of the logged in user" do
9
6
  assert true, SugarCRM.connection.get_user_id
10
7
  end
@@ -1,10 +1,7 @@
1
1
  require 'helper'
2
2
 
3
- class TestGetUserTeamID < Test::Unit::TestCase
3
+ class TestGetUserTeamID < ActiveSupport::TestCase
4
4
  context "A SugarCRM.connection" do
5
- setup do
6
- SugarCRM::Connection.new(URL, USER, PASS, {:register_modules => false})
7
- end
8
5
  should "get the team ID of the logged in user" do
9
6
  assert true, SugarCRM.connection.get_user_team_id
10
7
  end
@@ -1,12 +1,10 @@
1
1
  require 'helper'
2
2
 
3
- class TestLogin < Test::Unit::TestCase
3
+ class TestLogin < ActiveSupport::TestCase
4
4
  context "A SugarCRM.connection" do
5
- setup do
6
- SugarCRM::Connection.new(URL, USER, PASS, {:register_modules => false})
7
- end
8
5
  should "login and set session id" do
9
- assert (SugarCRM.connection.session.class == String)
6
+ assert (SugarCRM.connection.session_id.class == String)
7
+ assert_equal SugarCRM.connection.session.id, SugarCRM.connection.session_id
10
8
  end
11
9
  end
12
10
  end
@@ -1,10 +1,7 @@
1
1
  require 'helper'
2
2
 
3
- class TestLogout < Test::Unit::TestCase
3
+ class TestLogout < ActiveSupport::TestCase
4
4
  context "A SugarCRM.connection" do
5
- setup do
6
- SugarCRM::Connection.new(URL, USER, PASS, {:register_modules => false})
7
- end
8
5
  should "logout and not be able to login with the old session id" do
9
6
  assert (SugarCRM.connection.logout.class == Hash)
10
7
  end
@@ -1,9 +1,8 @@
1
1
  require 'helper'
2
2
 
3
- class TestSetNoteAttachment < Test::Unit::TestCase
3
+ class TestSetNoteAttachment < ActiveSupport::TestCase
4
4
  context "A SugarCRM.connection" do
5
5
  should "Add an attachment to a Note" do
6
- SugarCRM.connect(URL, USER, PASS, {:debug => false})
7
6
  n = SugarCRM::Note.new
8
7
  n.name = "A Test Note"
9
8
  assert n.save
@@ -1,9 +1,8 @@
1
1
  require 'helper'
2
2
 
3
- class TestSetRelationship < Test::Unit::TestCase
3
+ class TestSetRelationship < ActiveSupport::TestCase
4
4
  context "A SugarCRM.connection" do
5
5
  should "add and remove a relationship when #set_relationship" do
6
- SugarCRM.connect(URL, USER, PASS, {:debug => false})
7
6
  meeting = SugarCRM::Meeting.new
8
7
  meeting.date_start = DateTime.now
9
8
  meeting.duration_hours = 0.5
data/test/helper.rb CHANGED
@@ -6,13 +6,11 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
6
  $LOAD_PATH.unshift(File.dirname(__FILE__))
7
7
  require 'sugarcrm'
8
8
 
9
- class Test::Unit::TestCase
10
- # Replace these with your test instance
11
- URL = "http://localhost:8080/sugarcrm"
12
- USER = "admin"
13
- PASS = 'letmein'
9
+ CONFIG_PATH = File.join(File.dirname(__FILE__),'config.yaml')
14
10
 
15
- def setup_connection
16
- SugarCRM.connect(URL, USER, PASS, {:debug => false})
17
- end
11
+ class ActiveSupport::TestCase
12
+ # put your credentials into a YAML file in the test directory
13
+ # the format should be identical to the config_test.yaml found in the same directory
14
+ raise "test/config.yaml file not found. See README for instructions on setting up a testing environment" unless File.exists? CONFIG_PATH
15
+ SugarCRM::Session.new_from_file(CONFIG_PATH)
18
16
  end
@@ -1,9 +1,8 @@
1
1
  require 'helper'
2
2
 
3
- class TestAssociationCollection < Test::Unit::TestCase
3
+ class TestAssociationCollection < ActiveSupport::TestCase
4
4
  context "A SugarCRM::AssociationCollection instance" do
5
5
  should "create a new instance when #new" do
6
- SugarCRM.connect!(URL, USER, PASS)
7
6
  u = SugarCRM::User.find("seed_sarah_id")
8
7
  ac = SugarCRM::AssociationCollection.new(u,:email_addresses)
9
8
  assert_instance_of SugarCRM::AssociationCollection, ac
@@ -1,6 +1,6 @@
1
1
  require 'helper'
2
2
 
3
- class TestAssociations < Test::Unit::TestCase
3
+ class TestAssociations < ActiveSupport::TestCase
4
4
  context "A SugarCRM::Associations class" do
5
5
  should "Return an array of Association objects when self#register(SugarCRM::User.new)" do
6
6
  associations = SugarCRM::Associations.register(SugarCRM::User.new)
@@ -8,6 +8,23 @@ class TestAssociations < Test::Unit::TestCase
8
8
  assert associations.proxy_methods.include? "email_addresses"
9
9
  end
10
10
  end
11
+
12
+ context "A SugarCRM::Association class" do
13
+ should "compute relationship cardinality correctly" do
14
+ c = SugarCRM::Case.first
15
+ link_fields_hash = c.associations.classify{|i| i.link_field}
16
+ # TODO: test one_to_one cardinality by creating custom module with custom relationship
17
+ # (no "official" one-to-one relationship exists in Sugar out of the box)
18
+ assert_equal :one_to_many, link_fields_hash['calls'].first.cardinality
19
+ assert_equal :many_to_one, link_fields_hash['accounts'].first.cardinality
20
+ assert_equal :many_to_many, link_fields_hash['contacts'].first.cardinality
21
+ end
22
+ should "respond to #pretty_print" do
23
+ a = SugarCRM::Case.first.associations.first
24
+ assert_respond_to a, :pretty_print
25
+ end
26
+ end
27
+
11
28
  context "A SugarCRM::Base instance" do
12
29
  should "return an email address when sent #email_addresses" do
13
30
  u = SugarCRM::User.find("seed_sarah_id")
@@ -1,17 +1,13 @@
1
1
  require 'helper'
2
2
 
3
- class TestConnection < Test::Unit::TestCase
3
+ class TestConnection < ActiveSupport::TestCase
4
4
  context "A SugarCRM::Connection instance" do
5
- setup do
6
- @connection = SugarCRM::Connection.new(URL, USER, PASS)
7
- end
8
5
  should "retrieve the list of available modules" do
9
6
  assert_instance_of Array, SugarCRM.modules
10
7
  assert_instance_of SugarCRM::Module, SugarCRM.modules[0]
11
8
  end
12
9
  should "create sub-classes by module name" do
13
- @connection = SugarCRM::Connection.new(URL, USER, PASS, {:register_modules => true})
14
- assert SugarCRM.const_defined? "User"
10
+ assert SugarCRM.session.namespace_const.const_defined? "User"
15
11
  end
16
12
  end
17
13
  end
data/test/test_module.rb CHANGED
@@ -1,12 +1,7 @@
1
1
  require 'helper'
2
2
 
3
- class TestModule < Test::Unit::TestCase
3
+ class TestModule < ActiveSupport::TestCase
4
4
  context "A SugarCRM::Module instance" do
5
-
6
- setup do
7
- @connection = SugarCRM::Connection.new(URL, USER, PASS)
8
- end
9
-
10
5
  should "respond to #fields" do
11
6
  assert_respond_to SugarCRM.modules[0], :fields
12
7
  end
@@ -20,4 +15,37 @@ class TestModule < Test::Unit::TestCase
20
15
  # assert_equal "accounts_cstm", SugarCRM::Account._module.custom_table_name
21
16
  #end
22
17
  end
18
+
19
+ context "SugarCRM::Module" do
20
+ should "find modules" do
21
+ assert_instance_of SugarCRM::Module, SugarCRM::Module.find("Accounts")
22
+ end
23
+
24
+ should "(de)register all modules" do
25
+ assert SugarCRM.modules.size > 0
26
+ assert SugarCRM.session.namespace_const.const_defined? 'User'
27
+
28
+ SugarCRM::Module.deregister_all(SugarCRM.session)
29
+ assert SugarCRM.modules.size == 0
30
+ assert ! (SugarCRM.session.namespace_const.const_defined? 'User')
31
+
32
+ SugarCRM::Module.register_all(SugarCRM.session)
33
+ assert SugarCRM.modules.size > 0
34
+ assert SugarCRM.session.namespace_const.const_defined? 'User'
35
+ end
36
+ end
37
+
38
+ context "The SugarCRM class" do
39
+ should "return current user" do
40
+ current_user = SugarCRM.current_user
41
+ assert_instance_of SugarCRM::User, current_user
42
+ assert_equal SugarCRM.config[:username], current_user.user_name
43
+ end
44
+
45
+ should "implement reload!" do
46
+ assert_nothing_raised do
47
+ SugarCRM.reload!
48
+ end
49
+ end
50
+ end
23
51
  end
@@ -1,9 +1,8 @@
1
1
  require 'helper'
2
2
 
3
- class TestResponse < Test::Unit::TestCase
3
+ class TestResponse < ActiveSupport::TestCase
4
4
  context "A SugarCRM::Response instance" do
5
5
  setup do
6
- @connection = SugarCRM::Connection.new(URL, USER, PASS)
7
6
  @json = {"entry_list"=> [{
8
7
  "name_value_list"=> {
9
8
  "address_city" => {"name"=>"address_city", "value"=>""},
@@ -16,7 +15,7 @@ class TestResponse < Test::Unit::TestCase
16
15
  }],
17
16
  "relationship_list"=>[]}
18
17
 
19
- @response = SugarCRM::Response.handle(@json)
18
+ @response = SugarCRM::Response.handle(@json, SugarCRM.session)
20
19
  end
21
20
 
22
21
  should "return an instance of a SugarCRM Module" do
@@ -0,0 +1,109 @@
1
+ require 'helper'
2
+
3
+ class TestSession < ActiveSupport::TestCase
4
+ context "The SugarCRM::Session class" do
5
+ should "raise SugarCRM::MissingCredentials if at least one of url/username/password is missing" do
6
+ assert_raise(SugarCRM::MissingCredentials){ SugarCRM.connect('http://127.0.0.1/sugarcrm', nil, nil) }
7
+ end
8
+
9
+ should "assign namespaces in a way that prevents collisions" do
10
+ # Namespae0 already assigned (linked to the current connection)
11
+ One = SugarCRM::Session.new_from_file(CONFIG_PATH)
12
+ Two = SugarCRM::Session.new_from_file(CONFIG_PATH)
13
+ One.disconnect!
14
+ Three = SugarCRM::Session.new_from_file(CONFIG_PATH)
15
+ assert_not_equal Two, Three # namespaces must be different
16
+ Two.disconnect!
17
+ Three.disconnect!
18
+ end
19
+ end
20
+
21
+ context "A SugarCRM::Session instance" do
22
+ should "load monkey patch extensions" do
23
+ SugarCRM.extensions_folder = File.join(File.dirname(__FILE__), 'extensions_test')
24
+ assert SugarCRM::Contact.is_extended?
25
+ assert SugarCRM::Contact.is_extended?
26
+ end
27
+
28
+ should "implement reload!" do
29
+ assert_nothing_raised do
30
+ SugarCRM.reload!
31
+ end
32
+ end
33
+
34
+ should "load config file" do
35
+ SugarCRM.load_config File.join(File.dirname(__FILE__), 'config_test.yaml')
36
+ config_contents = {
37
+ :config => {
38
+ :base_url => 'http://127.0.0.1/sugarcrm',
39
+ :username => 'admin',
40
+ :password => 'letmein'
41
+ }
42
+ }
43
+ config_contents[:config].each{|k,v| assert_equal v, SugarCRM.config[k]}
44
+ end
45
+
46
+ should "be able to disconnect, and log in to Sugar automatically if credentials are present in config file" do
47
+ assert_nothing_raised{ SugarCRM.current_user }
48
+ assert SugarCRM.sessions.size == 1
49
+
50
+ SugarCRM.disconnect!
51
+ assert SugarCRM.sessions.size == 0
52
+
53
+ assert_raise(SugarCRM::NoActiveSession){ SugarCRM.current_user }
54
+
55
+ SugarCRM::Session.new_from_file(CONFIG_PATH)
56
+
57
+ assert_nothing_raised{ SugarCRM.current_user }
58
+ assert SugarCRM.sessions.size == 1
59
+ end
60
+
61
+ should "update the login credentials on connection" do
62
+ config = YAML.load_file(CONFIG_PATH) # was loaded in helper.rb
63
+ ["base_url", "username", "password"].each{|k|
64
+ assert_equal config["config"][k], SugarCRM.config[k.to_sym]
65
+ }
66
+ end
67
+
68
+ should "return the server version" do
69
+ assert_equal String, SugarCRM.sugar_version.class
70
+ end
71
+ end
72
+
73
+ context "The SugarCRM module" do
74
+ should "show the only the namespaces currently in use with SugarCRM.namespaces" do
75
+ assert_equal 1, SugarCRM.namespaces.size
76
+
77
+ assert_difference('SugarCRM.namespaces.size') do
78
+ OneA = SugarCRM::Session.new_from_file(CONFIG_PATH)
79
+ end
80
+
81
+ assert_difference('SugarCRM.namespaces.size', -1) do
82
+ OneA.disconnect!
83
+ end
84
+ end
85
+
86
+ should "add a used namespace on each new connection" do
87
+ assert_difference('SugarCRM.used_namespaces.size') do
88
+ OneB = SugarCRM::Session.new_from_file(CONFIG_PATH)
89
+ end
90
+
91
+ # connection (and namespace) is reused => no used namespace should be added
92
+ assert_no_difference('SugarCRM.used_namespaces.size') do
93
+ OneB.reconnect!
94
+ end
95
+
96
+ assert_no_difference('SugarCRM.used_namespaces.size') do
97
+ OneB.disconnect!
98
+ end
99
+ end
100
+
101
+ should "not allow access to methods on SugarCRM if there are multiple active connections" do
102
+ OneC = SugarCRM::Session.new_from_file(CONFIG_PATH)
103
+
104
+ assert_raise(SugarCRM::MultipleSessions){ SugarCRM.current_user }
105
+
106
+ OneC.disconnect!
107
+ end
108
+ end
109
+ end
@@ -1,15 +1,10 @@
1
1
  require 'helper'
2
2
 
3
- class TestSugarCRM < Test::Unit::TestCase
3
+ class TestSugarCRM < ActiveSupport::TestCase
4
4
  context "A SugarCRM::Base instance" do
5
5
 
6
- should "establish a connection when SugarCRM#connect!" do
7
- SugarCRM.connect!(URL, USER, PASS)
8
- assert SugarCRM.connection.connected?
9
- end
10
-
11
6
  should "establish a connection when Base#establish_connection" do
12
- SugarCRM::Base.establish_connection(URL, USER, PASS)
7
+ # Base#establish_connection was called automatically when loading config file containing connection params
13
8
  assert SugarCRM.connection.connected?
14
9
  end
15
10
 
@@ -96,6 +91,40 @@ class TestSugarCRM < Test::Unit::TestCase
96
91
  assert_instance_of SugarCRM::Account, account
97
92
  end
98
93
 
94
+ should "support finding last instance (sorted by attribute)" do
95
+ expected_account = SugarCRM::Account.first({:order_by => 'name DESC'})
96
+ account = SugarCRM::Account.last({:order_by => 'name'})
97
+ assert_equal expected_account.id, account.id
98
+
99
+ expected_account = SugarCRM::Account.first({:order_by => 'name DESC'})
100
+ account = SugarCRM::Account.last({:order_by => 'name ASC'})
101
+ assert_equal expected_account.id, account.id
102
+
103
+ expected_account = SugarCRM::Account.first({:order_by => 'name ASC'})
104
+ account = SugarCRM::Account.last({:order_by => 'name DESC'})
105
+ assert_equal expected_account.id, account.id
106
+ end
107
+
108
+ should "support finding last instance (last created)" do
109
+ expected_account = SugarCRM::Account.first({:order_by => 'date_entered DESC'})
110
+ account = SugarCRM::Account.last
111
+ assert_equal expected_account.id, account.id
112
+ end
113
+
114
+ should "support returning only certain fields" do
115
+ user = SugarCRM::User.first(:fields => [:first_name, :department])
116
+ assert_instance_of SugarCRM::User, user
117
+ end
118
+
119
+ should "raise a RuntimeError when searching for last instance with multiple order clauses" do
120
+ assert_raise(RuntimeError){ SugarCRM::Account.last({:order_by => 'name, id DESC'}) }
121
+ end
122
+
123
+ should "raise a RuntimeError when searching for last instance if order clause has weird format" do
124
+ assert_raise(RuntimeError){ SugarCRM::Account.last({:order_by => 'name id DESC'}) }
125
+ assert_raise(RuntimeError){ SugarCRM::Account.last({:order_by => 'name DESC id'}) }
126
+ end
127
+
99
128
  should "support searching based on conditions" do
100
129
  accounts = SugarCRM::Account.all({
101
130
  :conditions => { :billing_address_postalcode => ["> '70000'", "< '79999'" ] },
@@ -188,6 +217,28 @@ class TestSugarCRM < Test::Unit::TestCase
188
217
  assert a.save!
189
218
  assert a.delete
190
219
  end
220
+
221
+ should "implement Base#reload!" do
222
+ a = SugarCRM::User.last
223
+ b = SugarCRM::User.last
224
+ assert_not_equal 'admin', a.user_name # make sure we don't mess up admin user
225
+ # Save the original value, so we can set it back.
226
+ orig_last_name = a.last_name.dup
227
+ diff_last_name = a.last_name + 'crm'
228
+ b.last_name = diff_last_name
229
+ b.save!
230
+ # Compare the two user objects
231
+ assert_not_equal b.last_name, a.last_name
232
+ a.reload!
233
+ assert_equal a.last_name, b.last_name
234
+ # Set the name back to what it was before
235
+ b.last_name = orig_last_name
236
+ b.save!
237
+ end
238
+ end
239
+
240
+ should "respond to #pretty_print" do
241
+ assert_respond_to SugarCRM::User.new, :pretty_print
191
242
  end
192
243
 
193
244
  end