diff --git a/openbis-ipad/BisKit/Tests/CISDOBIpadServiceTest.m b/openbis-ipad/BisKit/Tests/CISDOBIpadServiceTest.m index 75446ccff31ce76c7224168f14c557cbeb49f61d..cbf3db442ec8eff3dc8d3862c5d55038dcf765ab 100644 --- a/openbis-ipad/BisKit/Tests/CISDOBIpadServiceTest.m +++ b/openbis-ipad/BisKit/Tests/CISDOBIpadServiceTest.m @@ -115,4 +115,38 @@ STAssertTrue([rawEntities count] > 0, @"The Pad service should have returned some entities."); } +- (void)testDetails +{ + CISDOBAsyncCall *call; + call = [_service loginUser: GetDefaultUserName() password: GetDefaultUserPassword()]; + [self configureAndRunCallSynchronously: call]; + + call = [_service listRootLevelEntities]; + [self configureAndRunCallSynchronously: call]; + + STAssertNotNil(_callResult, @"The iPad service should have returned some entities."); + NSArray *rawEntities = _callResult; + STAssertTrue([rawEntities count] > 0, @"The Pad service should have returned some entities."); + + + // Find an entity with children and drill on it + CISDOBIpadRawEntity *entityWithChildren = nil; + for (CISDOBIpadRawEntity *rawEntity in rawEntities) { + if ([rawEntity.children length] > 2) { + entityWithChildren = rawEntity; + break; + } + } + + // Details + NSError *error; + id refconObject = [NSJSONSerialization JSONObjectWithData: [entityWithChildren.refcon dataUsingEncoding: NSASCIIStringEncoding] options: 0 error: &error]; + STAssertNotNil(refconObject, @"Could not parse refcon string %@ : %@", entityWithChildren.refcon, error); + call = [_service detailsForEntityWithPermId: entityWithChildren.permId refcon: refconObject]; + [self configureAndRunCallSynchronously: call]; + + rawEntities = _callResult; + STAssertEquals([rawEntities count], (NSUInteger) 1, @"The Pad service should have returned one entity for details."); +} + @end diff --git a/openbis-ipad/Research/BisMac.xcodeproj/project.xcworkspace/xcuserdata/cramakri.xcuserdatad/UserInterfaceState.xcuserstate b/openbis-ipad/Research/BisMac.xcodeproj/project.xcworkspace/xcuserdata/cramakri.xcuserdatad/UserInterfaceState.xcuserstate index 06d062fcffe376eb04eb5b14acd4f0621ba5d062..74612961f3934f4e7a7982ca013983ebdaa2956d 100644 Binary files a/openbis-ipad/Research/BisMac.xcodeproj/project.xcworkspace/xcuserdata/cramakri.xcuserdatad/UserInterfaceState.xcuserstate and b/openbis-ipad/Research/BisMac.xcodeproj/project.xcworkspace/xcuserdata/cramakri.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/openbis-ipad/ipad-example-data/ipad-ui/1/dss/reporting-plugins/ipad-read-service-v1/ipad_read.py b/openbis-ipad/ipad-example-data/ipad-ui/1/dss/reporting-plugins/ipad-read-service-v1/ipad_read.py index a86a0052c7c713b69616ea30bf7916c9f7656d0d..9e9bee46695a66c0cd83fdba0273e3760773ae18 100644 --- a/openbis-ipad/ipad-example-data/ipad-ui/1/dss/reporting-plugins/ipad-read-service-v1/ipad_read.py +++ b/openbis-ipad/ipad-example-data/ipad-ui/1/dss/reporting-plugins/ipad-read-service-v1/ipad_read.py @@ -260,10 +260,10 @@ class ExampleDetailRequestHandler(DetailRequestHandler): def retrieve_data(self): # Get the data and add a row for each data item entities = self.parameters['entities'] - detail_samples = [entity for entity in entities and 'SAMPLE' == entity['REFCON']['entityKind']] + detail_samples = [entity for entity in entities if 'SAMPLE' == entity['REFCON']['entityKind']] self.samples = retrieve_samples(detail_samples) - detail_materials = [entity for entity in entities and 'MATERIAL' == entity['REFCON']['entityKind']] + detail_materials = [entity for entity in entities if 'MATERIAL' == entity['REFCON']['entityKind']] material_identifiers = MaterialIdentifierCollection() for detail_material in detail_materials: add_material_to_collection(detail_material, material_identifiers)