aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/Tests
diff options
context:
space:
mode:
authorSean Dague2008-10-15 18:15:43 +0000
committerSean Dague2008-10-15 18:15:43 +0000
commitfa8c0d7683d567743f5138813f08a502aff8e3d0 (patch)
tree7ac4d9dbb9979fcc4734e4a1898c24287bc3b6d3 /OpenSim/Data/Tests
parentRemoved some comments (diff)
downloadopensim-SC-fa8c0d7683d567743f5138813f08a502aff8e3d0.zip
opensim-SC-fa8c0d7683d567743f5138813f08a502aff8e3d0.tar.gz
opensim-SC-fa8c0d7683d567743f5138813f08a502aff8e3d0.tar.bz2
opensim-SC-fa8c0d7683d567743f5138813f08a502aff8e3d0.tar.xz
- Makes MySQL reject inserting UUID 0
- Makes SQLite mimick MySQL default behavior on first and last name already on db: it does not insert the new record. - Added tests for UUID 0 and for new UUID with existing first and last name.
Diffstat (limited to 'OpenSim/Data/Tests')
-rw-r--r--OpenSim/Data/Tests/BasicUserTest.cs24
1 files changed, 19 insertions, 5 deletions
diff --git a/OpenSim/Data/Tests/BasicUserTest.cs b/OpenSim/Data/Tests/BasicUserTest.cs
index 24cb215..dc8ccc3 100644
--- a/OpenSim/Data/Tests/BasicUserTest.cs
+++ b/OpenSim/Data/Tests/BasicUserTest.cs
@@ -45,6 +45,7 @@ namespace OpenSim.Data.Tests
45 public UUID user1; 45 public UUID user1;
46 public UUID user2; 46 public UUID user2;
47 public UUID user3; 47 public UUID user3;
48 public UUID user4;
48 public UUID webkey; 49 public UUID webkey;
49 public UUID zero = UUID.Zero; 50 public UUID zero = UUID.Zero;
50 public Random random; 51 public Random random;
@@ -55,6 +56,8 @@ namespace OpenSim.Data.Tests
55 56
56 public UUID region1; 57 public UUID region1;
57 58
59 public string fname0;
60 public string lname0;
58 public string fname1; 61 public string fname1;
59 public string lname1; 62 public string lname1;
60 public string fname2; 63 public string fname2;
@@ -76,11 +79,14 @@ namespace OpenSim.Data.Tests
76 user1 = UUID.Random(); 79 user1 = UUID.Random();
77 user2 = UUID.Random(); 80 user2 = UUID.Random();
78 user3 = UUID.Random(); 81 user3 = UUID.Random();
82 user4 = UUID.Random();
79 agent1 = UUID.Random(); 83 agent1 = UUID.Random();
80 agent2 = UUID.Random(); 84 agent2 = UUID.Random();
81 agent3 = UUID.Random(); 85 agent3 = UUID.Random();
82 webkey = UUID.Random(); 86 webkey = UUID.Random();
83 region1 = UUID.Random(); 87 region1 = UUID.Random();
88 fname0 = RandomName(random);
89 lname0 = RandomName(random);
84 fname1 = RandomName(random); 90 fname1 = RandomName(random);
85 lname1 = RandomName(random); 91 lname1 = RandomName(random);
86 fname2 = RandomName(random); 92 fname2 = RandomName(random);
@@ -115,19 +121,16 @@ namespace OpenSim.Data.Tests
115 [Test] 121 [Test]
116 public void T010_CreateUser() 122 public void T010_CreateUser()
117 { 123 {
118 UserProfileData u1 = NewUser(user1,fname1,lname1); // Must first and last names be unique? 124 UserProfileData u1 = NewUser(user1,fname1,lname1);
119 //UserProfileData u0 = NewUser(zero,fname1,lname1); // Zero causes some weird behaviors
120 UserProfileData u2 = NewUser(user2,fname2,lname2); 125 UserProfileData u2 = NewUser(user2,fname2,lname2);
121 UserProfileData u3 = NewUser(user3,fname3,lname3); 126 UserProfileData u3 = NewUser(user3,fname3,lname3);
122 //db.AddNewUserProfile(u0); 127 Console.WriteLine("Users are {0} {1} {2}",user1,user2,user3);
123 db.AddNewUserProfile(u1); 128 db.AddNewUserProfile(u1);
124 db.AddNewUserProfile(u2); 129 db.AddNewUserProfile(u2);
125 db.AddNewUserProfile(u3); 130 db.AddNewUserProfile(u3);
126 //UserProfileData u1z = db.GetUserByUUID(zero);
127 UserProfileData u1a = db.GetUserByUUID(user1); 131 UserProfileData u1a = db.GetUserByUUID(user1);
128 UserProfileData u2a = db.GetUserByUUID(user2); 132 UserProfileData u2a = db.GetUserByUUID(user2);
129 UserProfileData u3a = db.GetUserByUUID(user3); 133 UserProfileData u3a = db.GetUserByUUID(user3);
130 //Assert.That(zero,Is.EqualTo(u1z.ID));
131 Assert.That(user1,Is.EqualTo(u1a.ID)); 134 Assert.That(user1,Is.EqualTo(u1a.ID));
132 Assert.That(user2,Is.EqualTo(u2a.ID)); 135 Assert.That(user2,Is.EqualTo(u2a.ID));
133 Assert.That(user3,Is.EqualTo(u3a.ID)); 136 Assert.That(user3,Is.EqualTo(u3a.ID));
@@ -164,6 +167,17 @@ namespace OpenSim.Data.Tests
164 u1 = db.GetUserByUUID(user1); 167 u1 = db.GetUserByUUID(user1);
165 Assert.That(u1.WebLoginKey,Is.EqualTo(webkey)); 168 Assert.That(u1.WebLoginKey,Is.EqualTo(webkey));
166 } 169 }
170
171 [Test]
172 public void T014_ExpectedNullReferenceReturns()
173 {
174 UserProfileData u0 = NewUser(zero,fname0,lname0);
175 UserProfileData u4 = NewUser(user4,fname2,lname2);
176 db.AddNewUserProfile(u0);
177 db.AddNewUserProfile(u4);
178 Assert.That(db.GetUserByUUID(zero),Is.Null);
179 Assert.That(db.GetUserByUUID(user4),Is.Null);
180 }
167 181
168 [Test] 182 [Test]
169 public void T020_CreateAgent() 183 public void T020_CreateAgent()