Revision c53aa229 trunk/Pithos.Network.Test/NetworkOpsTest.cs
b/trunk/Pithos.Network.Test/NetworkOpsTest.cs | ||
---|---|---|
13 | 13 |
[TestFixture] |
14 | 14 |
class NetworkOpsTest |
15 | 15 |
{ |
16 |
private string _apiKey = "9d3cb7b231e96f72ebe96af1c6cd5112"; |
|
17 |
private string _userName = "pkanavos"; |
|
18 | 16 |
|
19 | 17 |
|
20 | 18 |
|
21 | 19 |
[Test] |
22 | 20 |
public void TestAuthenticate([Values(true,false)]bool usePithos) |
23 | 21 |
{ |
24 |
ICloudClient client = new CloudFilesClient{UsePithos=usePithos}; |
|
25 |
client.Authenticate(_userName, _apiKey); |
|
22 |
var account = "890329@vho.grnet.gr"; |
|
23 |
var apiKey = "24989dce4e0fcb072f8cb60c8922be19"; |
|
24 |
var client = new CloudFilesClient(account, apiKey) { UsePithos = usePithos }; |
|
25 |
client.Authenticate(); |
|
26 | 26 |
Uri storageUrl=client.StorageUrl; |
27 | 27 |
string token = client.Token; |
28 | 28 |
|
... | ... | |
33 | 33 |
[Test] |
34 | 34 |
public void TestListContainers([Values(true, false)]bool usePithos) |
35 | 35 |
{ |
36 |
ICloudClient client = new CloudFilesClient { UsePithos = usePithos }; |
|
37 |
client.Authenticate(_userName, _apiKey); |
|
36 |
var account = "890329@vho.grnet.gr"; |
|
37 |
var apiKey = "24989dce4e0fcb072f8cb60c8922be19"; |
|
38 |
var client = new CloudFilesClient(account, apiKey) { UsePithos = usePithos }; |
|
39 |
var accountInfo = client.Authenticate(); |
|
38 | 40 |
client.CreateContainer(null, "PITHOS"); |
39 | 41 |
|
40 |
IList<ContainerInfo> containers=client.ListContainers(); |
|
42 |
IList<ContainerInfo> containers=client.ListContainers(account);
|
|
41 | 43 |
Assert.IsTrue(containers.Count()>1); |
42 | 44 |
} |
43 | 45 |
|
44 | 46 |
[Test] |
45 | 47 |
public void TestListObjects([Values(true, false)]bool usePithos) |
46 | 48 |
{ |
47 |
ICloudClient client = new CloudFilesClient { UsePithos = usePithos }; |
|
48 |
client.Authenticate(_userName, _apiKey); |
|
49 |
var account = "890329@vho.grnet.gr"; |
|
50 |
var apiKey = "24989dce4e0fcb072f8cb60c8922be19"; |
|
51 |
var client = new CloudFilesClient(account, apiKey) { UsePithos = usePithos }; |
|
52 |
client.Authenticate(); |
|
49 | 53 |
client.CreateContainer(null, "PITHOS"); |
50 | 54 |
client.PutObject(null, "PITHOS","devguide.pdf","devguide.pdf"); |
51 | 55 |
|
... | ... | |
56 | 60 |
[Test] |
57 | 61 |
public void TestContainerExists([Values(true, false)]bool usePithos) |
58 | 62 |
{ |
59 |
ICloudClient client = new CloudFilesClient { UsePithos = usePithos }; |
|
60 |
client.Authenticate(_userName, _apiKey); |
|
63 |
var account = "890329@vho.grnet.gr"; |
|
64 |
var apiKey = "24989dce4e0fcb072f8cb60c8922be19"; |
|
65 |
var client = new CloudFilesClient(account, apiKey) { UsePithos = usePithos }; |
|
66 |
client.Authenticate(); |
|
61 | 67 |
client.CreateContainer(null, "TestContainer"); |
62 | 68 |
bool dnzExists=client.ContainerExists(null, "TestContainer"); |
63 | 69 |
|
... | ... | |
70 | 76 |
[Test] |
71 | 77 |
public void TestGetContainerInfo([Values(true, false)]bool usePithos) |
72 | 78 |
{ |
73 |
ICloudClient client = new CloudFilesClient { UsePithos = usePithos }; |
|
74 |
client.Authenticate(_userName, _apiKey); |
|
79 |
var account = "890329@vho.grnet.gr"; |
|
80 |
var apiKey = "24989dce4e0fcb072f8cb60c8922be19"; |
|
81 |
var client = new CloudFilesClient(account, apiKey) { UsePithos = usePithos }; |
|
82 |
client.Authenticate(); |
|
75 | 83 |
|
76 | 84 |
client.CreateContainer(null, "PITHOS"); |
77 | 85 |
client.CreateContainer(null, "DotNetZone"); |
... | ... | |
91 | 99 |
{ |
92 | 100 |
Assert.DoesNotThrow(() => |
93 | 101 |
{ |
94 |
ICloudClient client = new CloudFilesClient{UsePithos=usePithos}; |
|
95 |
client.Authenticate(_userName, _apiKey); |
|
102 |
var account = "890329@vho.grnet.gr"; |
|
103 |
var apiKey = "24989dce4e0fcb072f8cb60c8922be19"; |
|
104 |
var client = new CloudFilesClient(account, apiKey) { UsePithos = usePithos }; |
|
105 |
client.Authenticate(); |
|
96 | 106 |
|
97 | 107 |
client.CreateContainer(null, "Shares2"); |
98 | 108 |
Assert.IsTrue(client.ContainerExists(null, "Shares2")); |
... | ... | |
110 | 120 |
{ |
111 | 121 |
Assert.DoesNotThrow(() => |
112 | 122 |
{ |
113 |
ICloudClient client = new CloudFilesClient { UsePithos = usePithos }; |
|
114 |
client.Authenticate(_userName, _apiKey); |
|
123 |
var account = "890329@vho.grnet.gr"; |
|
124 |
var apiKey = "24989dce4e0fcb072f8cb60c8922be19"; |
|
125 |
var client = new CloudFilesClient(account, apiKey) { UsePithos = usePithos }; |
|
126 |
client.Authenticate(); |
|
115 | 127 |
//Prepare test file |
116 | 128 |
client.CreateContainer(null, "Shares"); |
117 | 129 |
string testFileName = "test.txt"; |
... | ... | |
134 | 146 |
{ |
135 | 147 |
Assert.DoesNotThrow(() => |
136 | 148 |
{ |
137 |
ICloudClient client = new CloudFilesClient {UsePithos = usePithos}; |
|
138 |
client.Authenticate(_userName, _apiKey); |
|
149 |
var account = "890329@vho.grnet.gr"; |
|
150 |
var apiKey = "24989dce4e0fcb072f8cb60c8922be19"; |
|
151 |
var client = new CloudFilesClient(account, apiKey) { UsePithos = usePithos }; |
|
152 |
client.Authenticate(); |
|
139 | 153 |
|
140 | 154 |
client.CreateContainer(null, "Shares"); |
141 | 155 |
Assert.IsTrue(client.ContainerExists(null, "Shares")); |
... | ... | |
156 | 170 |
{ |
157 | 171 |
Assert.DoesNotThrow(() => |
158 | 172 |
{ |
159 |
ICloudClient client = new CloudFilesClient { UsePithos = usePithos }; |
|
160 |
client.Authenticate(_userName, _apiKey); |
|
173 |
var account = "890329@vho.grnet.gr"; |
|
174 |
var apiKey = "24989dce4e0fcb072f8cb60c8922be19"; |
|
175 |
var client = new CloudFilesClient(account, apiKey) { UsePithos = usePithos }; |
|
176 |
client.Authenticate(); |
|
161 | 177 |
|
162 | 178 |
client.CreateContainer(null, "Shares"); |
163 | 179 |
Assert.IsTrue(client.ContainerExists(null, "Shares")); |
... | ... | |
184 | 200 |
{ |
185 | 201 |
Assert.DoesNotThrow(() => |
186 | 202 |
{ |
187 |
ICloudClient client = new CloudFilesClient { UsePithos = usePithos }; |
|
188 |
client.Authenticate(_userName, _apiKey); |
|
203 |
var account = "890329@vho.grnet.gr"; |
|
204 |
var apiKey = "24989dce4e0fcb072f8cb60c8922be19"; |
|
205 |
var client = new CloudFilesClient(account, apiKey) { UsePithos = usePithos }; |
|
206 |
client.Authenticate(); |
|
189 | 207 |
|
190 | 208 |
client.CreateContainer(null, "Shares"); |
191 | 209 |
Assert.IsTrue(client.ContainerExists(null, "Shares"),"Container Exists"); |
... | ... | |
199 | 217 |
|
200 | 218 |
Assert.IsTrue(client.ObjectExists(null, "Shares",info.Name),"File Created"); |
201 | 219 |
|
202 |
client.DeleteObject(null, "Shares/devguide.pdf",info.Name,"trash");
|
|
220 |
client.DeleteObject(null, "Shares/devguide.pdf",info.Name); |
|
203 | 221 |
|
204 | 222 |
}); |
205 | 223 |
|
... | ... | |
210 | 228 |
{ |
211 | 229 |
Assert.DoesNotThrow(() => |
212 | 230 |
{ |
213 |
ICloudClient client = new CloudFilesClient { UsePithos = usePithos }; |
|
214 |
client.Authenticate(_userName, _apiKey); |
|
231 |
var account = "890329@vho.grnet.gr"; |
|
232 |
var apiKey = "24989dce4e0fcb072f8cb60c8922be19"; |
|
233 |
var client = new CloudFilesClient(account, apiKey) { UsePithos = usePithos }; |
|
234 |
client.Authenticate(); |
|
215 | 235 |
|
216 | 236 |
client.CreateContainer(null, "Shares"); |
217 | 237 |
Assert.IsTrue(client.ContainerExists(null, "Shares"),"Container Exists"); |
... | ... | |
225 | 245 |
|
226 | 246 |
Assert.IsTrue(client.ObjectExists(null, "Shares",info.Name),"File Created"); |
227 | 247 |
|
228 |
client.DeleteObject(null, "Shares",info.Name,"trash");
|
|
248 |
client.DeleteObject(null, "Shares",info.Name); |
|
229 | 249 |
Assert.IsFalse(client.ObjectExists(null, "Shares", info.Name),"Container Deleted"); |
230 | 250 |
|
231 |
client.DeleteObject(null, "Moo",info.Name,"trash");
|
|
251 |
client.DeleteObject(null, "Moo",info.Name); |
|
232 | 252 |
Assert.IsFalse(client.ObjectExists(null, "Moo", info.Name),"Container Deleted"); |
233 | 253 |
|
234 | 254 |
}); |
... | ... | |
269 | 289 |
{ |
270 | 290 |
Assert.DoesNotThrow(() => |
271 | 291 |
{ |
272 |
ICloudClient client = new CloudFilesClient { UsePithos = usePithos }; |
|
273 |
client.Authenticate(_userName, _apiKey); |
|
292 |
var account = "890329@vho.grnet.gr"; |
|
293 |
var apiKey = "24989dce4e0fcb072f8cb60c8922be19"; |
|
294 |
var client = new CloudFilesClient(account, apiKey) { UsePithos = usePithos }; |
|
295 |
client.Authenticate(); |
|
274 | 296 |
|
275 | 297 |
client.CreateContainer(null, "Shares"); |
276 | 298 |
Assert.IsTrue(client.ContainerExists(null, "Shares"),"Container Exists"); |
... | ... | |
304 | 326 |
{ |
305 | 327 |
Assert.Catch<ArgumentNullException>(() => |
306 | 328 |
{ |
307 |
ICloudClient client = new CloudFilesClient { UsePithos = usePithos }; |
|
308 |
client.Authenticate("someUser",null); |
|
329 |
var account = "890329@vho.grnet.gr"; |
|
330 |
var apiKey = "24989dce4e0fcb072f8cb60c8922be19"; |
|
331 |
var client = new CloudFilesClient(account, apiKey) { UsePithos = usePithos }; |
|
332 |
client.Authenticate(); |
|
309 | 333 |
}); |
310 | 334 |
|
311 | 335 |
Assert.Catch<ArgumentNullException>(() => |
312 | 336 |
{ |
313 |
ICloudClient client = new CloudFilesClient { UsePithos = usePithos }; |
|
314 |
client.Authenticate(null,"someKey"); |
|
337 |
var account = "890329@vho.grnet.gr"; |
|
338 |
var apiKey = "24989dce4e0fcb072f8cb60c8922be19"; |
|
339 |
var client = new CloudFilesClient(account, apiKey) { UsePithos = usePithos }; |
|
340 |
client.Authenticate(); |
|
315 | 341 |
}); |
316 | 342 |
|
317 | 343 |
} |
Also available in: Unified diff