Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added unit tests for UTF-8 key and parameter values.
- Loading branch information
Showing
11 changed files
with
408 additions
and
14 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
....xcodeproj/project.xcworkspace/xcuserdata/jaanus.xcuserdatad/WorkspaceSettings.xcsettings
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,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>IDEWorkspaceUserSettings_HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges</key> | ||
<true/> | ||
<key>IDEWorkspaceUserSettings_SnapshotAutomaticallyBeforeSignificantChanges</key> | ||
<true/> | ||
</dict> | ||
</plist> |
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
48 changes: 48 additions & 0 deletions
48
PlainOAuth.xcodeproj/xcuserdata/jaanus.xcuserdatad/xcschemes/PlainOAuthUnitTests.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,48 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Scheme | ||
version = "1.3"> | ||
<BuildAction | ||
parallelizeBuildables = "YES" | ||
buildImplicitDependencies = "YES"> | ||
</BuildAction> | ||
<TestAction | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB" | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
buildConfiguration = "Debug"> | ||
<Testables> | ||
<TestableReference | ||
skipped = "NO"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "EA94F336140AD7DC00EFAF02" | ||
BuildableName = "PlainOAuthUnitTests.octest" | ||
BlueprintName = "PlainOAuthUnitTests" | ||
ReferencedContainer = "container:PlainOAuth.xcodeproj"> | ||
</BuildableReference> | ||
</TestableReference> | ||
</Testables> | ||
</TestAction> | ||
<LaunchAction | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB" | ||
launchStyle = "0" | ||
useCustomWorkingDirectory = "NO" | ||
buildConfiguration = "Debug"> | ||
<AdditionalOptions> | ||
</AdditionalOptions> | ||
</LaunchAction> | ||
<ProfileAction | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
savedToolIdentifier = "" | ||
useCustomWorkingDirectory = "NO" | ||
buildConfiguration = "Release"> | ||
</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
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,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>en</string> | ||
<key>CFBundleExecutable</key> | ||
<string>${EXECUTABLE_NAME}</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>com.jaanuskase.test.${PRODUCT_NAME:rfc1034identifier}</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundlePackageType</key> | ||
<string>BNDL</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleSignature</key> | ||
<string>????</string> | ||
<key>CFBundleVersion</key> | ||
<string>1</string> | ||
</dict> | ||
</plist> |
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,8 @@ | ||
// | ||
// Prefix header for all source files of the 'PlainOAuthUnitTests' target in the 'PlainOAuthUnitTests' project | ||
// | ||
|
||
#ifdef __OBJC__ | ||
#import <UIKit/UIKit.h> | ||
#import <Foundation/Foundation.h> | ||
#endif |
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,17 @@ | ||
// | ||
// PlainOAuthUnitTests.h | ||
// PlainOAuthUnitTests | ||
// | ||
// Created by Jaanus Kase on 28.08.11. | ||
// Copyright 2011 __MyCompanyName__. All rights reserved. | ||
// | ||
|
||
#import <SenTestingKit/SenTestingKit.h> | ||
|
||
@class OAuth; | ||
|
||
@interface PlainOAuthUnitTests : SenTestCase { | ||
OAuth *oAuth; | ||
} | ||
|
||
@end |
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,53 @@ | ||
// | ||
// PlainOAuthUnitTests.m | ||
// PlainOAuthUnitTests | ||
// | ||
// Created by Jaanus Kase on 28.08.11. | ||
// Copyright 2011 __MyCompanyName__. All rights reserved. | ||
// | ||
|
||
#import "PlainOAuthUnitTests.h" | ||
#import "OAuth.h" | ||
#import "OAuthConsumerCredentials.h" | ||
|
||
@implementation PlainOAuthUnitTests | ||
|
||
- (void)setUp | ||
{ | ||
[super setUp]; | ||
oAuth = [[OAuth alloc] initWithConsumerKey:OAUTH_CONSUMER_KEY andConsumerSecret:OAUTH_CONSUMER_SECRET]; | ||
} | ||
|
||
- (void)tearDown | ||
{ | ||
[oAuth release]; | ||
[super tearDown]; | ||
} | ||
|
||
|
||
- (void)testUtf8ParameterValue { | ||
NSString *header = [oAuth oAuthHeaderForMethod:@"GET" | ||
andUrl:@"http://www.example.com/" | ||
andParams:[NSDictionary dictionaryWithObjectsAndKeys:@"hõäöš€", @"utf8Value", nil]]; | ||
|
||
NSRange range = [header rangeOfString:@"h%C3%B5%C3%A4%C3%B6%C5%A1%E2%82%AC"]; | ||
if (range.location == NSNotFound) { | ||
STFail(@"Did not detect expected encoded UTF-8 parameter value in OAuth header"); | ||
} | ||
|
||
} | ||
|
||
- (void)testUtf8KeyValue { | ||
NSString *header = [oAuth oAuthHeaderForMethod:@"GET" | ||
andUrl:@"http://www.example.com/" | ||
andParams:[NSDictionary dictionaryWithObjectsAndKeys:@"value", @"utf8Keyhõäöš€", nil]]; | ||
|
||
NSRange range = [header rangeOfString:@"h%C3%B5%C3%A4%C3%B6%C5%A1%E2%82%AC"]; | ||
if (range.location == NSNotFound) { | ||
STFail(@"Did not detect expected encoded UTF-8 key value in OAuth header"); | ||
} | ||
|
||
|
||
} | ||
|
||
@end |
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,2 @@ | ||
/* Localized versions of Info.plist keys */ | ||
|
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