Skip to content
Snippets Groups Projects
Commit 41f1dea5 authored by cramakri's avatar cramakri
Browse files

Working on implementing detail

SVN: 27280
parent 040fe45e
No related branches found
No related tags found
No related merge requests found
...@@ -115,4 +115,38 @@ ...@@ -115,4 +115,38 @@
STAssertTrue([rawEntities count] > 0, @"The Pad service should have returned some entities."); 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 @end
...@@ -260,10 +260,10 @@ class ExampleDetailRequestHandler(DetailRequestHandler): ...@@ -260,10 +260,10 @@ class ExampleDetailRequestHandler(DetailRequestHandler):
def retrieve_data(self): def retrieve_data(self):
# Get the data and add a row for each data item # Get the data and add a row for each data item
entities = self.parameters['entities'] 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) 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() material_identifiers = MaterialIdentifierCollection()
for detail_material in detail_materials: for detail_material in detail_materials:
add_material_to_collection(detail_material, material_identifiers) add_material_to_collection(detail_material, material_identifiers)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment