Skip to content
Snippets Groups Projects
Commit 93789c30 authored by cramakri's avatar cramakri
Browse files

Updated the test to match the new three-action model

SVN: 27348
parent b365f717
No related branches found
No related tags found
No related merge requests found
...@@ -60,16 +60,6 @@ ...@@ -60,16 +60,6 @@
return nil; return nil;
} }
- (void)assertServiceDataRowIsParsable:(NSArray *)row
{
// The only column we need to check is the properties column, which is the last one.
NSDictionary *propertiesRow = [row objectAtIndex: [row count] - 1];
NSString *propertiesValue = [propertiesRow objectForKey: @"value"];
NSError *error;
NSDictionary *jsonProperties = [NSJSONSerialization JSONObjectWithData:[propertiesValue dataUsingEncoding: NSUTF8StringEncoding] options: 0 error:&error];
STAssertNotNil(jsonProperties, @"Properties should have been parsed, %@", error);
}
- (void)testLoginAndListServices - (void)testLoginAndListServices
{ {
CISDOBAsyncCall *call; CISDOBAsyncCall *call;
...@@ -79,9 +69,11 @@ ...@@ -79,9 +69,11 @@
call = [_connection listAggregationServices]; call = [_connection listAggregationServices];
[self configureAndRunCallSynchronously: call]; [self configureAndRunCallSynchronously: call];
STAssertNotNil(_callResult, @"There should be some aggregation services on the server"); STAssertNotNil(_callResult, @"There should be some aggregation services on the server");
NSDictionary *service = [self extractIpadService: _callResult]; NSDictionary *service = [self extractIpadService: _callResult];
[service retain];
STAssertNotNil(service, @"There should be a service with key \"ipad-read-service-v1\". Services: %@", _callResult); STAssertNotNil(service, @"There should be a service with key \"ipad-read-service-v1\". Services: %@", _callResult);
// Call without any parameters
call = call =
[_connection [_connection
createReportFromDataStore: [service objectForKey: @"dataStoreCode"] createReportFromDataStore: [service objectForKey: @"dataStoreCode"]
...@@ -90,9 +82,20 @@ ...@@ -90,9 +82,20 @@
[self configureAndRunCallSynchronously: call]; [self configureAndRunCallSynchronously: call];
STAssertNotNil(_callResult, @"The ipad-read-service-v1 should have returned some data."); STAssertNotNil(_callResult, @"The ipad-read-service-v1 should have returned some data.");
NSArray *rows = [_callResult objectForKey: @"rows"]; NSArray *rows = [_callResult objectForKey: @"rows"];
STAssertTrue([rows count] == 0, @"The ipad-read-service-v1 should have returned empty data.");
// Call with the correct parameters
NSDictionary *parameters = [NSDictionary dictionaryWithObject: @"ROOT" forKey: @"requestKey"];
call =
[_connection
createReportFromDataStore: [service objectForKey: @"dataStoreCode"]
aggregationService: [service objectForKey: @"serviceKey"]
parameters: parameters];
[self configureAndRunCallSynchronously: call];
STAssertNotNil(_callResult, @"The ipad-read-service-v1 should have returned some data.");
rows = [_callResult objectForKey: @"rows"];
STAssertTrue([rows count] > 0, @"The ipad-read-service-v1 should have returned some data."); STAssertTrue([rows count] > 0, @"The ipad-read-service-v1 should have returned some data.");
for (NSArray* row in rows) [service release];
[self assertServiceDataRowIsParsable: row];
} }
@end @end
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