Changeset 11865 for lang/objective-c
- Timestamp:
- 05/18/08 13:35:55 (6 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/objective-c/HatebuCoreData/HatenaBookmarkTest.m
r11864 r11865 31 31 NSURLRequest *req = [Bookmark makeRequest:[Bookmark feedURL] withFields:fields]; 32 32 STAssertNotNil(req, @"request create failed"); 33 33 34 NSString *result = [Bookmark sendRequest:req]; 34 35 STAssertNotNil(result, @"sendRequest failed"); 35 NSLog(@"result: %@", result);36 36 STAssertTrue([result hasPrefix:@"<?xml version="], @"feed should be xml"); 37 37 } 38 38 39 -(NSString *)latestBookmark { 40 NSDictionary *fields = [NSDictionary dictionaryWithObject:cred_ forKey:@"X-WSSE"]; 41 NSURLRequest *req = [Bookmark makeRequest:[Bookmark feedURL] withFields:fields]; 42 NSString *recent = [Bookmark sendRequest:req]; 43 44 NSXMLDocument *doc = [[NSXMLDocument alloc] initWithXMLString:recent options:NSXMLDocumentTidyXML error:nil]; 45 STAssertNotNil(doc, @"parse error", nil); 46 47 NSArray *ary = [[doc rootElement] nodesForXPath: @"/feed/entry" error: nil]; 48 STAssertNotNil(ary, @"no entries", nil); 49 50 NSXMLElement *entry = [ary objectAtIndex:0]; 51 STAssertNotNil(entry, @"bad entry", nil); 52 53 return [[[entry elementsForName: @"id"] objectAtIndex:0] stringValue]; 54 } 55 56 -(void) testLatest { 57 NSString *latest = [self latestBookmark]; 58 NSLog(@"latest entry id : %@", latest); 59 STAssertNotNil(latest, @"latest", nil); 60 } 61 39 62 -(void) testEditUriGet { 40 NSDictionary *fields = [NSDictionary dictionary ];41 NSURLRequest *req = [Bookmark makeRequest:[Bookmark editURL: @"XXX"] withFields:fields];63 NSDictionary *fields = [NSDictionary dictionaryWithObject:cred_ forKey:@"X-WSSE"]; 64 NSURLRequest *req = [Bookmark makeRequest:[Bookmark editURL:[self latestBookmark]] withFields:fields]; 42 65 STAssertNotNil(req, @"request create failed"); 66 67 NSString *result = [Bookmark sendRequest:req]; 68 NSLog(@"result : %@", result); 69 STAssertNotNil(result, @"sendRequest failed"); 70 STAssertTrue([result hasPrefix:@"<?xml version="], @"feed should be xml"); 43 71 } 72 44 73 45 74 @end
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)