-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
See #7. Implement serializeBelongsTo in SLSerializer and add test cre…
…ating AttributeDatum with relationship to an existing Attribute.
- Loading branch information
Showing
11 changed files
with
159 additions
and
25 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
Streamlyne Cocoa SDK.xcodeproj/xcshareddata/xcschemes/Streamlyne-Mac-SDK.xcscheme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Scheme | ||
LastUpgradeVersion = "0510" | ||
version = "1.3"> | ||
<BuildAction | ||
parallelizeBuildables = "YES" | ||
buildImplicitDependencies = "YES"> | ||
<BuildActionEntries> | ||
<BuildActionEntry | ||
buildForTesting = "YES" | ||
buildForRunning = "YES" | ||
buildForProfiling = "YES" | ||
buildForArchiving = "YES" | ||
buildForAnalyzing = "YES"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "77B4EA0C184094D400435B97" | ||
BuildableName = "Streamlyne-Mac-SDK.framework" | ||
BlueprintName = "Streamlyne-Mac-SDK" | ||
ReferencedContainer = "container:Streamlyne Cocoa SDK.xcodeproj"> | ||
</BuildableReference> | ||
</BuildActionEntry> | ||
</BuildActionEntries> | ||
</BuildAction> | ||
<TestAction | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
buildConfiguration = "Debug"> | ||
<Testables> | ||
<TestableReference | ||
skipped = "NO"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "77B4EA21184094D400435B97" | ||
BuildableName = "Streamlyne-Mac-SDKTests.xctest" | ||
BlueprintName = "Streamlyne-Mac-SDKTests" | ||
ReferencedContainer = "container:Streamlyne Cocoa SDK.xcodeproj"> | ||
</BuildableReference> | ||
</TestableReference> | ||
</Testables> | ||
</TestAction> | ||
<LaunchAction | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
launchStyle = "0" | ||
useCustomWorkingDirectory = "NO" | ||
buildConfiguration = "Debug" | ||
ignoresPersistentStateOnLaunch = "NO" | ||
debugDocumentVersioning = "YES" | ||
allowLocationSimulation = "YES"> | ||
<AdditionalOptions> | ||
</AdditionalOptions> | ||
</LaunchAction> | ||
<ProfileAction | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
savedToolIdentifier = "" | ||
useCustomWorkingDirectory = "NO" | ||
buildConfiguration = "Release" | ||
debugDocumentVersioning = "YES"> | ||
</ProfileAction> | ||
<AnalyzeAction | ||
buildConfiguration = "Debug"> | ||
</AnalyzeAction> | ||
<ArchiveAction | ||
buildConfiguration = "Release" | ||
revealArchiveInOrganizer = "YES"> | ||
</ArchiveAction> | ||
</Scheme> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,13 +39,12 @@ @implementation Streamlyne_iOS_SDKTests | |
(XCTAssertTrue([a isEqualToString:b], format) ); | ||
|
||
// Login Credentials | ||
//#define SLLoginEmail @"[email protected]" | ||
//#define SLLoginPassword @"test" | ||
//#define SLLoginOrganization @"test" | ||
|
||
#define SLLoginEmail @"[email protected]" | ||
#define SLLoginPassword @"glavin" | ||
#define SLLoginOrganization @"nevis" | ||
#define SLLoginEmail @"[email protected]" | ||
#define SLLoginPassword @"test" | ||
#define SLLoginOrganization @"test" | ||
//#define SLLoginEmail @"[email protected]" | ||
//#define SLLoginPassword @"glavin" | ||
//#define SLLoginOrganization @"nevis" | ||
|
||
|
||
// Put setup code here. This method is called before the invocation of each test method in the class. | ||
|
@@ -69,6 +68,10 @@ - (void)setUp | |
withOrganization:SLLoginOrganization] | ||
.then(^(SLClient *client, SLUser *me) { | ||
EndBlock(); | ||
}) | ||
.catch(^(NSError *error) { | ||
EndBlock(); | ||
XCTFail(@"setUp failed to authenticate with error: %@",error); | ||
}); | ||
|
||
WaitUntilBlockCompletes(); | ||
|
@@ -105,7 +108,6 @@ - (void) testHMAC | |
NSString *message = @"ILove2Test!tTest!t"; | ||
NSString *secret = @"Streamlyne"; | ||
NSString *hmac = @"1c2c34e017a17a6ae42c0dbdf6a3586f6735de3b"; | ||
|
||
NSString *result = [SLAdapter hmac:message withSecret:secret]; | ||
XCTAssertStringEqual(result, hmac, @"HMACs should be the same."); | ||
} | ||
|
@@ -120,9 +122,12 @@ - (void) testAuthentication | |
withPassword:SLLoginPassword | ||
withOrganization:SLLoginOrganization] | ||
.then(^() { | ||
NSLog(@"TESTTT"); | ||
XCTAssertTrue(true, @"PARTY. IT WORKED."); | ||
EndBlock(); | ||
}) | ||
.catch(^(NSError *error) { | ||
EndBlock(); | ||
XCTFail(@"%@", error); | ||
}) | ||
.finally(^() { | ||
|
@@ -488,29 +493,66 @@ - (void) testFindQuery | |
|
||
} | ||
|
||
- (void) testCreateAttributeDatum | ||
- (void) testCreateAttribute | ||
{ | ||
StartBlock(); | ||
|
||
// Create | ||
SLAttributeDatum *attributeDatum = [SLAttributeDatum createRecord:@{ | ||
@"value": @123.0 | ||
}]; | ||
SLAttribute *attribute = [SLAttribute createRecord]; | ||
attribute.name = @"TESTATTR1"; | ||
attribute.humanName = @"Test Attribute"; | ||
|
||
// Save | ||
[attributeDatum save] | ||
.then(^(SLAttributeDatum *attributeDatum) { | ||
NSLog(@"Datum: %@", attributeDatum); | ||
[attribute save] | ||
.then(^(SLAttribute *attribute) { | ||
NSLog(@"Attribute: %@", attribute); | ||
EndBlock(); | ||
}) | ||
.catch(^(NSError *error){ | ||
NSLog(@"%@", error); | ||
EndBlock(); | ||
XCTFail(@"%@", error); | ||
}); | ||
|
||
|
||
WaitUntilBlockCompletes(); | ||
|
||
} | ||
|
||
- (void) testCreateAttributeDatum | ||
{ | ||
StartBlock(); | ||
// Create | ||
SLAttributeDatum *attributeDatum = [SLAttributeDatum createRecord:@{ | ||
@"value": @123.0 | ||
}]; | ||
[SLAttribute findAll] | ||
.then(^(NSArray *attributes) { | ||
if ([attributes count] > 0) | ||
{ | ||
// Get the first Attribute | ||
SLAttribute *attribute = [attributes objectAtIndex:0]; | ||
// Associate the Attribute to the AttributeDatum | ||
attributeDatum.attribute = attribute; | ||
// Save | ||
[attributeDatum save] | ||
.then(^(SLAttributeDatum *attributeDatum) { | ||
NSLog(@"Datum: %@", attributeDatum); | ||
EndBlock(); | ||
}) | ||
.catch(^(NSError *error){ | ||
NSLog(@"%@", error); | ||
EndBlock(); | ||
XCTFail(@"%@", error); | ||
}); | ||
} | ||
else | ||
{ | ||
EndBlock(); | ||
XCTFail(@"No attributes found for this AttributeDatum to be associated to."); | ||
} | ||
}) | ||
.catch(^(NSError *error) { | ||
EndBlock(); | ||
XCTFail(@"Could not get an attribute to associate the AttributeDatum to: %@", error); | ||
}); | ||
WaitUntilBlockCompletes(); | ||
} | ||
|
||
|
||
|