diff --git a/.gitmodules b/.gitmodules index 5f4f48f..7c4d9da 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "Frameworks/Hippolyte"] path = Frameworks/Hippolyte - url = https://github.com/JanGorman/Hippolyte.git + url = https://github.com/JanGorman/Hippolyte diff --git a/Frameworks/Hippolyte b/Frameworks/Hippolyte new file mode 160000 index 0000000..bcfc2d4 --- /dev/null +++ b/Frameworks/Hippolyte @@ -0,0 +1 @@ +Subproject commit bcfc2d4935f0b2e006b290e71aba37cd689f36e5 diff --git a/Frameworks/Hippolyte/.gitignore b/Frameworks/Hippolyte/.gitignore deleted file mode 100644 index 5e56312..0000000 --- a/Frameworks/Hippolyte/.gitignore +++ /dev/null @@ -1,27 +0,0 @@ -### https://raw.github.com/github/gitignore/d5ce0fc1d4a677eaa60d5b8e01ac9e42ec7cfcd1/Global/Xcode.gitignore - -# Xcode -# -# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore - -## Build generated -build/ -DerivedData/ - -## Various settings -*.pbxuser -!default.pbxuser -*.mode1v3 -!default.mode1v3 -*.mode2v3 -!default.mode2v3 -*.perspectivev3 -!default.perspectivev3 -xcuserdata/ - -## Other -*.moved-aside -*.xccheckout -*.xcscmblueprint - - diff --git a/Frameworks/Hippolyte/.swift-version b/Frameworks/Hippolyte/.swift-version deleted file mode 100644 index bf0d87a..0000000 --- a/Frameworks/Hippolyte/.swift-version +++ /dev/null @@ -1 +0,0 @@ -4 \ No newline at end of file diff --git a/Frameworks/Hippolyte/.travis.yml b/Frameworks/Hippolyte/.travis.yml deleted file mode 100644 index 8d83a69..0000000 --- a/Frameworks/Hippolyte/.travis.yml +++ /dev/null @@ -1,6 +0,0 @@ -language: objective-c -osx_image: xcode9 -script: - - bundle exec fastlane scan --code_coverage true -after_success: - - bash <(curl -s https://codecov.io/bash) -J 'Hippolyte' \ No newline at end of file diff --git a/Frameworks/Hippolyte/CHANGELOG.md b/Frameworks/Hippolyte/CHANGELOG.md deleted file mode 100644 index 30d2b50..0000000 --- a/Frameworks/Hippolyte/CHANGELOG.md +++ /dev/null @@ -1,9 +0,0 @@ -# Changelog - -### 0.1.0 - -- Builders for `StubResponse` and `StubRequest` - -### 0.0.1 - -- Initial release \ No newline at end of file diff --git a/Frameworks/Hippolyte/Gemfile b/Frameworks/Hippolyte/Gemfile deleted file mode 100644 index adc90d9..0000000 --- a/Frameworks/Hippolyte/Gemfile +++ /dev/null @@ -1,3 +0,0 @@ -source "https://rubygems.org" - -gem "fastlane" \ No newline at end of file diff --git a/Frameworks/Hippolyte/Gemfile.lock b/Frameworks/Hippolyte/Gemfile.lock deleted file mode 100644 index 02baef7..0000000 --- a/Frameworks/Hippolyte/Gemfile.lock +++ /dev/null @@ -1,139 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - CFPropertyList (2.3.5) - addressable (2.5.2) - public_suffix (>= 2.0.2, < 4.0) - babosa (1.0.2) - claide (1.0.2) - colored (1.2) - colored2 (3.1.2) - commander-fastlane (4.4.5) - highline (~> 1.7.2) - declarative (0.0.9) - declarative-option (0.1.0) - domain_name (0.5.20170404) - unf (>= 0.0.5, < 1.0.0) - dotenv (2.2.1) - excon (0.59.0) - faraday (0.13.1) - multipart-post (>= 1.2, < 3) - faraday-cookie_jar (0.0.6) - faraday (>= 0.7.4) - http-cookie (~> 1.0.0) - faraday_middleware (0.12.2) - faraday (>= 0.7.4, < 1.0) - fastimage (2.1.0) - fastlane (2.55.0) - CFPropertyList (>= 2.3, < 3.0.0) - addressable (>= 2.3, < 3.0.0) - babosa (>= 1.0.2, < 2.0.0) - bundler (>= 1.12.0, < 2.0.0) - colored - commander-fastlane (>= 4.4.5, < 5.0.0) - dotenv (>= 2.1.1, < 3.0.0) - excon (>= 0.45.0, < 1.0.0) - faraday (~> 0.9) - faraday-cookie_jar (~> 0.0.6) - faraday_middleware (~> 0.9) - fastimage (>= 2.1.0, < 3.0.0) - gh_inspector (>= 1.0.1, < 2.0.0) - google-api-client (>= 0.13.1, < 0.14.0) - highline (>= 1.7.2, < 2.0.0) - json (< 3.0.0) - mini_magick (~> 4.5.1) - multi_json - multi_xml (~> 0.5) - multipart-post (~> 2.0.0) - plist (>= 3.1.0, < 4.0.0) - public_suffix (~> 2.0.0) - rubyzip (>= 1.1.0, < 2.0.0) - security (= 0.1.3) - slack-notifier (>= 1.3, < 2.0.0) - terminal-notifier (>= 1.6.2, < 2.0.0) - terminal-table (>= 1.4.5, < 2.0.0) - tty-screen (~> 0.5.0) - word_wrap (~> 1.0.0) - xcodeproj (>= 1.5.0, < 2.0.0) - xcpretty (>= 0.2.4, < 1.0.0) - xcpretty-travis-formatter (>= 0.0.3) - gh_inspector (1.0.3) - google-api-client (0.13.5) - addressable (~> 2.5, >= 2.5.1) - googleauth (~> 0.5) - httpclient (>= 2.8.1, < 3.0) - mime-types (~> 3.0) - representable (~> 3.0) - retriable (>= 2.0, < 4.0) - googleauth (0.5.3) - faraday (~> 0.12) - jwt (~> 1.4) - logging (~> 2.0) - memoist (~> 0.12) - multi_json (~> 1.11) - os (~> 0.9) - signet (~> 0.7) - highline (1.7.8) - http-cookie (1.0.3) - domain_name (~> 0.5) - httpclient (2.8.3) - json (2.1.0) - jwt (1.5.6) - little-plugger (1.1.4) - logging (2.2.2) - little-plugger (~> 1.1) - multi_json (~> 1.10) - memoist (0.16.0) - mime-types (3.1) - mime-types-data (~> 3.2015) - mime-types-data (3.2016.0521) - mini_magick (4.5.1) - multi_json (1.12.2) - multi_xml (0.6.0) - multipart-post (2.0.0) - nanaimo (0.2.3) - os (0.9.6) - plist (3.3.0) - public_suffix (2.0.5) - representable (3.0.4) - declarative (< 0.1.0) - declarative-option (< 0.2.0) - uber (< 0.2.0) - retriable (3.1.1) - rouge (2.0.7) - rubyzip (1.2.1) - security (0.1.3) - signet (0.7.3) - addressable (~> 2.3) - faraday (~> 0.9) - jwt (~> 1.5) - multi_json (~> 1.10) - slack-notifier (1.5.1) - terminal-notifier (1.8.0) - terminal-table (1.8.0) - unicode-display_width (~> 1.1, >= 1.1.1) - tty-screen (0.5.0) - uber (0.1.0) - unf (0.1.4) - unf_ext - unf_ext (0.0.7.4) - unicode-display_width (1.3.0) - word_wrap (1.0.0) - xcodeproj (1.5.1) - CFPropertyList (~> 2.3.3) - claide (>= 1.0.2, < 2.0) - colored2 (~> 3.1) - nanaimo (~> 0.2.3) - xcpretty (0.2.8) - rouge (~> 2.0.7) - xcpretty-travis-formatter (0.0.4) - xcpretty (~> 0.2, >= 0.0.7) - -PLATFORMS - ruby - -DEPENDENCIES - fastlane - -BUNDLED WITH - 1.15.4 diff --git a/Frameworks/Hippolyte/Hippolyte.podspec b/Frameworks/Hippolyte/Hippolyte.podspec deleted file mode 100644 index 44af42e..0000000 --- a/Frameworks/Hippolyte/Hippolyte.podspec +++ /dev/null @@ -1,24 +0,0 @@ -Pod::Spec.new do |s| - - s.name = "Hippolyte" - s.version = "0.1.0" - s.summary = "HTTP Stubbing in Swift" - - s.description = <<-DESC - Easily stub HTTP requests in your tests. Hippolyte makes your tests run fast and reliable without hitting the network. - DESC - - s.homepage = "https://github.com/JanGorman/Hippolyte" - - s.license = { :type => "MIT", :file => "LICENSE" } - - s.author = { "Jan Gorman" => "gorman.jan@gmail.com" } - s.social_media_url = "http://twitter.com/JanGorman" - - s.platform = :ios, "9.3" - - s.source = { :git => "https://github.com/JanGorman/Hippolyte.git", :tag => s.version} - - s.source_files = "Classes", "Hippolyte/*.swift" - -end \ No newline at end of file diff --git a/Frameworks/Hippolyte/Hippolyte.xcodeproj/project.pbxproj b/Frameworks/Hippolyte/Hippolyte.xcodeproj/project.pbxproj deleted file mode 100644 index 72ec091..0000000 --- a/Frameworks/Hippolyte/Hippolyte.xcodeproj/project.pbxproj +++ /dev/null @@ -1,503 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 48; - objects = { - -/* Begin PBXBuildFile section */ - 7706E6661F822F2C00734A1D /* StubResponseBuilderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7706E6651F822F2C00734A1D /* StubResponseBuilderTests.swift */; }; - 7766CF9E1F652D8F00B717B2 /* URLHook.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7766CF9D1F652D8F00B717B2 /* URLHook.swift */; }; - 7766CFA01F652FD100B717B2 /* Matcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7766CF9F1F652FD100B717B2 /* Matcher.swift */; }; - 7766CFA21F65311200B717B2 /* URL+HippolyteAdditions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7766CFA11F65311200B717B2 /* URL+HippolyteAdditions.swift */; }; - 7766CFA41F654F1800B717B2 /* DataMatcherTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7766CFA31F654F1800B717B2 /* DataMatcherTests.swift */; }; - 7766CFA61F65515000B717B2 /* StringMatcherTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7766CFA51F65515000B717B2 /* StringMatcherTests.swift */; }; - 7766CFA81F6552B100B717B2 /* RegexMatcherTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7766CFA71F6552B100B717B2 /* RegexMatcherTests.swift */; }; - 7766CFAC1F65571800B717B2 /* StubRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7766CFAB1F65571800B717B2 /* StubRequestTests.swift */; }; - 77A290D81F62EADF001E70FA /* Hippolyte.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 77A290CE1F62EADF001E70FA /* Hippolyte.framework */; }; - 77A290DF1F62EADF001E70FA /* Hippolyte.h in Headers */ = {isa = PBXBuildFile; fileRef = 77A290D11F62EADF001E70FA /* Hippolyte.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 77A290E91F62EDF5001E70FA /* Hippolyte.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77A290E81F62EDF5001E70FA /* Hippolyte.swift */; }; - 77A290EB1F62EE40001E70FA /* StubRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77A290EA1F62EE40001E70FA /* StubRequest.swift */; }; - 77A290ED1F62EEC2001E70FA /* StubResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77A290EC1F62EEC2001E70FA /* StubResponse.swift */; }; - 77A290EF1F62F13E001E70FA /* HTTPClientHook.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77A290EE1F62F13E001E70FA /* HTTPClientHook.swift */; }; - 77A290F11F62F241001E70FA /* URLSessionHook.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77A290F01F62F241001E70FA /* URLSessionHook.swift */; }; - 77A2EA9D1F65589C0051E45A /* TestRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77A2EA9C1F65589C0051E45A /* TestRequest.swift */; }; - 77A2EA9F1F6561A30051E45A /* HippolyteTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77A2EA9E1F6561A30051E45A /* HippolyteTests.swift */; }; - 77B806641F63E33A0077A365 /* HTTPStubURLProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77B806631F63E33A0077A365 /* HTTPStubURLProtocol.swift */; }; - 77B806661F63E5670077A365 /* HTTPRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77B806651F63E5670077A365 /* HTTPRequest.swift */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 77A290D91F62EADF001E70FA /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 77A290C51F62EADF001E70FA /* Project object */; - proxyType = 1; - remoteGlobalIDString = 77A290CD1F62EADF001E70FA; - remoteInfo = Hippolyte; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 7706E6651F822F2C00734A1D /* StubResponseBuilderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StubResponseBuilderTests.swift; sourceTree = ""; }; - 7766CF9D1F652D8F00B717B2 /* URLHook.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLHook.swift; sourceTree = ""; }; - 7766CF9F1F652FD100B717B2 /* Matcher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Matcher.swift; sourceTree = ""; }; - 7766CFA11F65311200B717B2 /* URL+HippolyteAdditions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "URL+HippolyteAdditions.swift"; sourceTree = ""; }; - 7766CFA31F654F1800B717B2 /* DataMatcherTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataMatcherTests.swift; sourceTree = ""; }; - 7766CFA51F65515000B717B2 /* StringMatcherTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringMatcherTests.swift; sourceTree = ""; }; - 7766CFA71F6552B100B717B2 /* RegexMatcherTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RegexMatcherTests.swift; sourceTree = ""; }; - 7766CFAB1F65571800B717B2 /* StubRequestTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StubRequestTests.swift; sourceTree = ""; }; - 77A290CE1F62EADF001E70FA /* Hippolyte.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Hippolyte.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 77A290D11F62EADF001E70FA /* Hippolyte.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Hippolyte.h; sourceTree = ""; }; - 77A290D21F62EADF001E70FA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 77A290D71F62EADF001E70FA /* HippolyteTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = HippolyteTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 77A290DE1F62EADF001E70FA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 77A290E81F62EDF5001E70FA /* Hippolyte.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Hippolyte.swift; sourceTree = ""; }; - 77A290EA1F62EE40001E70FA /* StubRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StubRequest.swift; sourceTree = ""; }; - 77A290EC1F62EEC2001E70FA /* StubResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StubResponse.swift; sourceTree = ""; }; - 77A290EE1F62F13E001E70FA /* HTTPClientHook.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HTTPClientHook.swift; sourceTree = ""; }; - 77A290F01F62F241001E70FA /* URLSessionHook.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLSessionHook.swift; sourceTree = ""; }; - 77A2EA9C1F65589C0051E45A /* TestRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestRequest.swift; sourceTree = ""; }; - 77A2EA9E1F6561A30051E45A /* HippolyteTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HippolyteTests.swift; sourceTree = ""; }; - 77B806631F63E33A0077A365 /* HTTPStubURLProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HTTPStubURLProtocol.swift; sourceTree = ""; }; - 77B806651F63E5670077A365 /* HTTPRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HTTPRequest.swift; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 77A290CA1F62EADF001E70FA /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 77A290D41F62EADF001E70FA /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 77A290D81F62EADF001E70FA /* Hippolyte.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 77A290C41F62EADF001E70FA = { - isa = PBXGroup; - children = ( - 77A290D01F62EADF001E70FA /* Hippolyte */, - 77A290DB1F62EADF001E70FA /* HippolyteTests */, - 77A290CF1F62EADF001E70FA /* Products */, - ); - sourceTree = ""; - }; - 77A290CF1F62EADF001E70FA /* Products */ = { - isa = PBXGroup; - children = ( - 77A290CE1F62EADF001E70FA /* Hippolyte.framework */, - 77A290D71F62EADF001E70FA /* HippolyteTests.xctest */, - ); - name = Products; - sourceTree = ""; - }; - 77A290D01F62EADF001E70FA /* Hippolyte */ = { - isa = PBXGroup; - children = ( - 77A290D11F62EADF001E70FA /* Hippolyte.h */, - 77A290D21F62EADF001E70FA /* Info.plist */, - 77A290E81F62EDF5001E70FA /* Hippolyte.swift */, - 77A290EA1F62EE40001E70FA /* StubRequest.swift */, - 77A290EC1F62EEC2001E70FA /* StubResponse.swift */, - 77A290EE1F62F13E001E70FA /* HTTPClientHook.swift */, - 77A290F01F62F241001E70FA /* URLSessionHook.swift */, - 77B806631F63E33A0077A365 /* HTTPStubURLProtocol.swift */, - 77B806651F63E5670077A365 /* HTTPRequest.swift */, - 7766CF9D1F652D8F00B717B2 /* URLHook.swift */, - 7766CF9F1F652FD100B717B2 /* Matcher.swift */, - 7766CFA11F65311200B717B2 /* URL+HippolyteAdditions.swift */, - ); - path = Hippolyte; - sourceTree = ""; - }; - 77A290DB1F62EADF001E70FA /* HippolyteTests */ = { - isa = PBXGroup; - children = ( - 77A2EA9E1F6561A30051E45A /* HippolyteTests.swift */, - 7766CFA31F654F1800B717B2 /* DataMatcherTests.swift */, - 7766CFA51F65515000B717B2 /* StringMatcherTests.swift */, - 7766CFA71F6552B100B717B2 /* RegexMatcherTests.swift */, - 7766CFAB1F65571800B717B2 /* StubRequestTests.swift */, - 7706E6651F822F2C00734A1D /* StubResponseBuilderTests.swift */, - 77A2EA9C1F65589C0051E45A /* TestRequest.swift */, - 77A290DE1F62EADF001E70FA /* Info.plist */, - ); - path = HippolyteTests; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 77A290CB1F62EADF001E70FA /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 77A290DF1F62EADF001E70FA /* Hippolyte.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 77A290CD1F62EADF001E70FA /* Hippolyte */ = { - isa = PBXNativeTarget; - buildConfigurationList = 77A290E21F62EADF001E70FA /* Build configuration list for PBXNativeTarget "Hippolyte" */; - buildPhases = ( - 77A290C91F62EADF001E70FA /* Sources */, - 77A290CA1F62EADF001E70FA /* Frameworks */, - 77A290CB1F62EADF001E70FA /* Headers */, - 77A290CC1F62EADF001E70FA /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = Hippolyte; - productName = Hippolyte; - productReference = 77A290CE1F62EADF001E70FA /* Hippolyte.framework */; - productType = "com.apple.product-type.framework"; - }; - 77A290D61F62EADF001E70FA /* HippolyteTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 77A290E51F62EADF001E70FA /* Build configuration list for PBXNativeTarget "HippolyteTests" */; - buildPhases = ( - 77A290D31F62EADF001E70FA /* Sources */, - 77A290D41F62EADF001E70FA /* Frameworks */, - 77A290D51F62EADF001E70FA /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 77A290DA1F62EADF001E70FA /* PBXTargetDependency */, - ); - name = HippolyteTests; - productName = HippolyteTests; - productReference = 77A290D71F62EADF001E70FA /* HippolyteTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 77A290C51F62EADF001E70FA /* Project object */ = { - isa = PBXProject; - attributes = { - LastSwiftUpdateCheck = 0900; - LastUpgradeCheck = 0900; - ORGANIZATIONNAME = "Jan Gorman"; - TargetAttributes = { - 77A290CD1F62EADF001E70FA = { - CreatedOnToolsVersion = 9.0; - LastSwiftMigration = 0900; - ProvisioningStyle = Automatic; - }; - 77A290D61F62EADF001E70FA = { - CreatedOnToolsVersion = 9.0; - ProvisioningStyle = Automatic; - }; - }; - }; - buildConfigurationList = 77A290C81F62EADF001E70FA /* Build configuration list for PBXProject "Hippolyte" */; - compatibilityVersion = "Xcode 8.0"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 77A290C41F62EADF001E70FA; - productRefGroup = 77A290CF1F62EADF001E70FA /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 77A290CD1F62EADF001E70FA /* Hippolyte */, - 77A290D61F62EADF001E70FA /* HippolyteTests */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 77A290CC1F62EADF001E70FA /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 77A290D51F62EADF001E70FA /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 77A290C91F62EADF001E70FA /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 77A290F11F62F241001E70FA /* URLSessionHook.swift in Sources */, - 77A290ED1F62EEC2001E70FA /* StubResponse.swift in Sources */, - 77A290E91F62EDF5001E70FA /* Hippolyte.swift in Sources */, - 77A290EB1F62EE40001E70FA /* StubRequest.swift in Sources */, - 7766CF9E1F652D8F00B717B2 /* URLHook.swift in Sources */, - 77B806661F63E5670077A365 /* HTTPRequest.swift in Sources */, - 7766CFA21F65311200B717B2 /* URL+HippolyteAdditions.swift in Sources */, - 77A290EF1F62F13E001E70FA /* HTTPClientHook.swift in Sources */, - 7766CFA01F652FD100B717B2 /* Matcher.swift in Sources */, - 77B806641F63E33A0077A365 /* HTTPStubURLProtocol.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 77A290D31F62EADF001E70FA /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 77A2EA9F1F6561A30051E45A /* HippolyteTests.swift in Sources */, - 7706E6661F822F2C00734A1D /* StubResponseBuilderTests.swift in Sources */, - 7766CFA81F6552B100B717B2 /* RegexMatcherTests.swift in Sources */, - 7766CFA41F654F1800B717B2 /* DataMatcherTests.swift in Sources */, - 7766CFA61F65515000B717B2 /* StringMatcherTests.swift in Sources */, - 7766CFAC1F65571800B717B2 /* StubRequestTests.swift in Sources */, - 77A2EA9D1F65589C0051E45A /* TestRequest.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 77A290DA1F62EADF001E70FA /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 77A290CD1F62EADF001E70FA /* Hippolyte */; - targetProxy = 77A290D91F62EADF001E70FA /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin XCBuildConfiguration section */ - 77A290E01F62EADF001E70FA /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.3; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 77A290E11F62EADF001E70FA /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.3; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - VALIDATE_PRODUCT = YES; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - 77A290E31F62EADF001E70FA /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_IDENTITY = ""; - CODE_SIGN_STYLE = Automatic; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = Hippolyte/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.schnaub.Hippolyte; - PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; - SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - 77A290E41F62EADF001E70FA /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_IDENTITY = ""; - CODE_SIGN_STYLE = Automatic; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = Hippolyte/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.schnaub.Hippolyte; - PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; - SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Release; - }; - 77A290E61F62EADF001E70FA /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - CODE_SIGN_STYLE = Automatic; - INFOPLIST_FILE = HippolyteTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.schnaub.HippolyteTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - 77A290E71F62EADF001E70FA /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - CODE_SIGN_STYLE = Automatic; - INFOPLIST_FILE = HippolyteTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.schnaub.HippolyteTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 77A290C81F62EADF001E70FA /* Build configuration list for PBXProject "Hippolyte" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 77A290E01F62EADF001E70FA /* Debug */, - 77A290E11F62EADF001E70FA /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 77A290E21F62EADF001E70FA /* Build configuration list for PBXNativeTarget "Hippolyte" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 77A290E31F62EADF001E70FA /* Debug */, - 77A290E41F62EADF001E70FA /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 77A290E51F62EADF001E70FA /* Build configuration list for PBXNativeTarget "HippolyteTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 77A290E61F62EADF001E70FA /* Debug */, - 77A290E71F62EADF001E70FA /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 77A290C51F62EADF001E70FA /* Project object */; -} diff --git a/Frameworks/Hippolyte/Hippolyte.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Frameworks/Hippolyte/Hippolyte.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 1a927b7..0000000 --- a/Frameworks/Hippolyte/Hippolyte.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/Frameworks/Hippolyte/Hippolyte/HTTPClientHook.swift b/Frameworks/Hippolyte/Hippolyte/HTTPClientHook.swift deleted file mode 100644 index 7c1fd9a..0000000 --- a/Frameworks/Hippolyte/Hippolyte/HTTPClientHook.swift +++ /dev/null @@ -1,28 +0,0 @@ -// -// Copyright © 2017 Jan Gorman. All rights reserved. -// - -import Foundation - -public protocol HTTPClientHook { - - func load() - func unload() - func isEqual(to other: HTTPClientHook) -> Bool - -} - -extension HTTPClientHook where Self: Equatable { - - func isEqual(to other: HTTPClientHook) -> Bool { - if let o = other as? Self { - return o == self - } - return false - } - -} - -func ==(lhs: HTTPClientHook, rhs: HTTPClientHook) -> Bool { - return lhs.isEqual(to: rhs) -} diff --git a/Frameworks/Hippolyte/Hippolyte/HTTPRequest.swift b/Frameworks/Hippolyte/Hippolyte/HTTPRequest.swift deleted file mode 100644 index ed3f033..0000000 --- a/Frameworks/Hippolyte/Hippolyte/HTTPRequest.swift +++ /dev/null @@ -1,43 +0,0 @@ -// -// Copyright © 2017 Jan Gorman. All rights reserved. -// - -import Foundation - -public protocol HTTPRequest { - - var url: URL? { get } - var method: HTTPMethod? { get } - var headers: [String: String]? { get } - var body: Data? { get } - -} - -extension URLRequest: HTTPRequest { - - public var method: HTTPMethod? { - guard let method = httpMethod else { return nil } - return HTTPMethod(rawValue: method) - } - - public var headers: [String : String]? { - return allHTTPHeaderFields - } - - public var body: Data? { - guard let stream = httpBodyStream else { return httpBody } - - var data = Data() - stream.open() - let bufferSize = 4096 - let buffer = UnsafeMutablePointer.allocate(capacity: bufferSize) - while stream.hasBytesAvailable { - let read = stream.read(buffer, maxLength: bufferSize) - data.append(buffer, count: read) - } - buffer.deallocate(capacity: bufferSize) - stream.close() - return data - } - -} diff --git a/Frameworks/Hippolyte/Hippolyte/HTTPStubURLProtocol.swift b/Frameworks/Hippolyte/Hippolyte/HTTPStubURLProtocol.swift deleted file mode 100644 index 2f3c1e2..0000000 --- a/Frameworks/Hippolyte/Hippolyte/HTTPStubURLProtocol.swift +++ /dev/null @@ -1,58 +0,0 @@ -// -// Copyright © 2017 Jan Gorman. All rights reserved. -// - -import Foundation - -final class HTTPStubURLProtocol: URLProtocol { - - override class func canInit(with request: URLRequest) -> Bool { - guard let scheme = request.url?.scheme else { return false } - return ["http", "https"].contains(scheme) - } - - override class func canonicalRequest(for request: URLRequest) -> URLRequest { - return request - } - - override class func requestIsCacheEquivalent(_ a: URLRequest, to b: URLRequest) -> Bool { - return false - } - - override func startLoading() { - guard let stubbedResponse = try? Hippolyte.shared.response(for: request), let url = request.url else { return } - - let cookieStorage = HTTPCookieStorage.shared - cookieStorage.setCookies(HTTPCookie.cookies(withResponseHeaderFields: stubbedResponse.headers, for: url), - for: url, mainDocumentURL: url) - - if stubbedResponse.shouldFail { - client?.urlProtocol(self, didFailWithError: stubbedResponse.error!) - } else { - let statusCode = stubbedResponse.statusCode - let response = HTTPURLResponse(url: url, statusCode: statusCode, httpVersion: nil, - headerFields: stubbedResponse.headers) - - if statusCode < 300 || statusCode > 399 || statusCode == 304 || statusCode == 305 { - let body = stubbedResponse.body - client?.urlProtocol(self, didReceive: response!, cacheStoragePolicy: .notAllowed) - client?.urlProtocol(self, didLoad: body!) - client?.urlProtocolDidFinishLoading(self) - } else { - guard let location = stubbedResponse.headers["Location"], let url = URL(string: location), - let cookies = cookieStorage.cookies(for: url) else { return } - - var redirect = URLRequest(url: url) - redirect.allHTTPHeaderFields = HTTPCookie.requestHeaderFields(with: cookies) - - client?.urlProtocol(self, wasRedirectedTo: redirect, redirectResponse: response!) - let error = NSError(domain: NSCocoaErrorDomain, code: NSUserCancelledError, userInfo: nil) - client?.urlProtocol(self, didFailWithError: error) - } - } - } - - override func stopLoading() { - } - -} diff --git a/Frameworks/Hippolyte/Hippolyte/Hippolyte.h b/Frameworks/Hippolyte/Hippolyte/Hippolyte.h deleted file mode 100644 index dd96c1d..0000000 --- a/Frameworks/Hippolyte/Hippolyte/Hippolyte.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// Hippolyte.h -// Hippolyte -// -// Created by Jan Gorman1 on 08.09.17. -// Copyright © 2017 Jan Gorman. All rights reserved. -// - -#import - -//! Project version number for Hippolyte. -FOUNDATION_EXPORT double HippolyteVersionNumber; - -//! Project version string for Hippolyte. -FOUNDATION_EXPORT const unsigned char HippolyteVersionString[]; - -// In this header, you should import all the public headers of your framework using statements like #import - - diff --git a/Frameworks/Hippolyte/Hippolyte/Hippolyte.swift b/Frameworks/Hippolyte/Hippolyte/Hippolyte.swift deleted file mode 100644 index cef4c68..0000000 --- a/Frameworks/Hippolyte/Hippolyte/Hippolyte.swift +++ /dev/null @@ -1,93 +0,0 @@ -// -// Copyright © 2017 Jan Gorman. All rights reserved. -// - -import Foundation - -public enum HippolyteError: Error { - case unmatchedRequest -} - -open class Hippolyte { - - public static var shared = Hippolyte() - - public private(set) var stubbedRequests: [StubRequest] = [] - public private(set) var isStarted = false - - private var hooks: [HTTPClientHook] = [] - - private init() { - registerHook(URLHook()) - registerHook(URLSessionHook()) - } - - /// The start method to call for Hippolyte to start intercepting and stubbing HTTP calls - public func start() { - guard !isStarted else { return } - loadHooks() - isStarted = true - } - - private func loadHooks() { - hooks.forEach { $0.unload() } - } - - /// The stop method to tell Hippolyte to stop stubbing. - public func stop() { - unloadHooks() - clearStubs() - isStarted = false - } - - private func unloadHooks() { - hooks.forEach { $0.load() } - } - - /// Add a stubbed request - /// - /// - Parameter stubbedRequest: A configured `StubRequest` - public func add(stubbedRequest request: StubRequest) { - if let idx = stubbedRequests.index(of: request) { - stubbedRequests[idx] = request - return - } - stubbedRequests.append(request) - } - - /// Clear all stubs - public func clearStubs() { - stubbedRequests.removeAll() - } - - /// Register a hook - /// - /// - Parameter hook: A configured `HTTPClientHook` - public func registerHook(_ hook: HTTPClientHook) { - if !isHookRegistered(hook) { - hooks.append(hook) - } - } - - private func isHookRegistered(_ hook: HTTPClientHook) -> Bool { - for registeredHook in hooks { - if hook == registeredHook { - return true - } - } - return false - } - - /// Retrieve a stubbed response for an `HTTPRequest` - /// - /// - throws: A `.unmatchedRequest` for requests that haven't been registered before - /// - /// - Parameter request: The request to retrieve a response for - public func response(for request: HTTPRequest) throws -> StubResponse { - guard let response = stubbedRequests.first(where: { $0.matchesRequest(request) })?.response else { - throw HippolyteError.unmatchedRequest - } - return response - } - -} diff --git a/Frameworks/Hippolyte/Hippolyte/Info.plist b/Frameworks/Hippolyte/Hippolyte/Info.plist deleted file mode 100644 index 1007fd9..0000000 --- a/Frameworks/Hippolyte/Hippolyte/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSPrincipalClass - - - diff --git a/Frameworks/Hippolyte/Hippolyte/Matcher.swift b/Frameworks/Hippolyte/Hippolyte/Matcher.swift deleted file mode 100644 index b2668da..0000000 --- a/Frameworks/Hippolyte/Hippolyte/Matcher.swift +++ /dev/null @@ -1,115 +0,0 @@ -// -// Copyright © 2017 Jan Gorman. All rights reserved. -// - -import Foundation - -public class Matcher: Hashable { - - func matches(string: String?) -> Bool { - return false - } - - func matches(data: Data?) -> Bool { - return false - } - - func isEqual(to other: Matcher) -> Bool { - return false - } - - public var hashValue: Int { - return 0 - } - - public static func ==(lhs: Matcher, rhs: Matcher) -> Bool { - return lhs.isEqual(to: rhs) - } - -} - -public protocol Matcheable { - - func matcher() -> Matcher - -} - -public class StringMatcher: Matcher { - - let string: String - - public init(string: String) { - self.string = string - } - - public override func matches(string: String?) -> Bool { - return self.string == string - } - - public override func matches(data: Data?) -> Bool { - return self.string.data(using: .utf8) == data - } - - public override var hashValue: Int { - return string.hashValue - } - - override func isEqual(to other: Matcher) -> Bool { - if let o = other as? StringMatcher { - return o.string == string - } - return false - } - -} - -public class RegexMatcher: Matcher { - - let regex: NSRegularExpression - - public init(regex: NSRegularExpression) { - self.regex = regex - } - - public override func matches(string: String?) -> Bool { - guard let string = string else { return false } - return regex.numberOfMatches(in: string, options: [], range: NSRange(string.startIndex..., in: string)) > 0 - } - - public override var hashValue: Int { - return regex.hashValue - } - - override func isEqual(to other: Matcher) -> Bool { - if let o = other as? RegexMatcher { - return o.regex == regex - } - return false - } - -} - -public class DataMatcher: Matcher { - - let data: Data - - public init(data: Data) { - self.data = data - } - - public override func matches(data: Data?) -> Bool { - return self.data == data - } - - public override var hashValue: Int { - return data.hashValue - } - - override func isEqual(to other: Matcher) -> Bool { - if let o = other as? DataMatcher { - return o.data == data - } - return false - } - -} diff --git a/Frameworks/Hippolyte/Hippolyte/StubRequest.swift b/Frameworks/Hippolyte/Hippolyte/StubRequest.swift deleted file mode 100644 index c7918a0..0000000 --- a/Frameworks/Hippolyte/Hippolyte/StubRequest.swift +++ /dev/null @@ -1,118 +0,0 @@ -// -// Copyright © 2017 Jan Gorman. All rights reserved. -// - -import Foundation - -public enum HTTPMethod: String { - case GET, PUT, POST, DELETE -} - -public struct StubRequest: Hashable { - - public final class Builder { - - private var request: StubRequest! - - public init() { - } - - public func stubRequest(withMethod method: HTTPMethod, url: URL) -> Builder { - request = StubRequest(method: method, url: url) - return self - } - - public func stubRequest(withMethod method: HTTPMethod, urlMatcher: Matcher) -> Builder { - request = StubRequest(method: method, urlMatcher: urlMatcher) - return self - } - - public func addHeader(withKey key: String, value: String) -> Builder { - assert(request != nil) - request.setHeader(key: key, value: value) - return self - } - - public func addResponse(_ response: StubResponse) -> Builder { - assert(request != nil) - request.response = response - return self - } - - public func build() -> StubRequest { - return request - } - - } - - public let method: HTTPMethod - public private(set) var headers: [String: String] - public var response: StubResponse - public var bodyMatcher: Matcher? - - private let urlMatcher: Matcher - - /// Initialize a request with method and URL - /// - /// - Parameter method: The `HTTPMethod` to match - /// - Parameter url: The `URL` to match - public init(method: HTTPMethod, url: URL) { - self.init(method: method, urlMatcher: url.matcher()) - } - - /// Initialize a request with method and `Matcher` - /// - /// - Parameter method: The `HTTPMethod` to match - /// - Parameter url: The `Matcher` to use for URLs - public init(method: HTTPMethod, urlMatcher: Matcher) { - self.method = method - self.urlMatcher = urlMatcher - self.headers = [:] - self.response = StubResponse() - } - - public func matchesRequest(_ request: HTTPRequest) -> Bool { - return request.method == method && matchesUrl(request.url) && matchesHeaders(request.headers) - && matchesBody(request.body) - } - - private func matchesUrl(_ url: URL?) -> Bool { - return urlMatcher.matches(string: url?.absoluteString) - } - - private func matchesHeaders(_ headers: [String: String]?) -> Bool { - guard let otherHeaders = headers else { return self.headers.isEmpty } - for key in self.headers.keys { - guard let value = otherHeaders[key] else { return false } - if value != self.headers[key] { - return false - } - } - return true - } - - private func matchesBody(_ body: Data?) -> Bool { - guard let bodyMatcher = bodyMatcher, let body = body else { return true } - return bodyMatcher.matches(data: body) - } - - public mutating func setHeader(key: String, value: String) { - headers[key] = value - } - - public var hashValue: Int { - let bodyHash: Int - if let bodyMatcher = bodyMatcher { - bodyHash = bodyMatcher.hashValue - } else { - bodyHash = 0 - } - return method.hashValue ^ urlMatcher.hashValue ^ bodyHash ^ headers.count.hashValue - } - - public static func ==(lhs: StubRequest, rhs: StubRequest) -> Bool { - return lhs.method == rhs.method && lhs.urlMatcher == rhs.urlMatcher && lhs.headers == rhs.headers - && lhs.bodyMatcher == rhs.bodyMatcher - } - -} diff --git a/Frameworks/Hippolyte/Hippolyte/StubResponse.swift b/Frameworks/Hippolyte/Hippolyte/StubResponse.swift deleted file mode 100644 index 17ee37f..0000000 --- a/Frameworks/Hippolyte/Hippolyte/StubResponse.swift +++ /dev/null @@ -1,93 +0,0 @@ -// -// Copyright © 2017 Jan Gorman. All rights reserved. -// - -import Foundation - -public protocol HTTPStubResponse { - var statusCode: Int { get } - var headers: [String: String] { get } - var body: Data? { get } -} - -public struct StubResponse: HTTPStubResponse, Equatable { - - public final class Builder { - - private var response: StubResponse! - - public init() { - } - - public func defaultResponse() -> Builder { - response = StubResponse() - return self - } - - public func stubResponse(withStatusCode statusCode: Int) -> Builder { - response = StubResponse(statusCode: statusCode) - return self - } - - public func stubResponse(withError error: NSError) -> Builder { - response = StubResponse(error: error) - return self - } - - public func addBody(_ body: Data) -> Builder { - assert(response != nil) - response.body = body - return self - } - - public func addHeader(withKey key: String, value: String) -> Builder { - assert(response != nil) - response.headers[key] = value - return self - } - - public func build() -> StubResponse { - return response - } - - } - - public var statusCode: Int - public var headers: [String : String] - public var body: Data? - public let shouldFail: Bool - public let error: NSError? - - /// Initialize a default response with statusCode 200 and empty body - public init() { - self.init(statusCode: 200) - } - - /// Initialize a response with error to return - /// - /// - Parameter error: `NSError` to return when stubbing - public init(error: NSError) { - statusCode = -1 - headers = [:] - body = nil - shouldFail = true - self.error = error - } - - /// Initialize a response with a different statusCode - /// - /// - Parameter statusCode: The statusCode to use when stubbing - public init(statusCode: Int) { - self.statusCode = statusCode - body = "".data(using: .utf8)! - headers = [:] - shouldFail = false - error = nil - } - - public static func ==(lhs: StubResponse, rhs: StubResponse) -> Bool { - return lhs.statusCode == rhs.statusCode && lhs.headers == rhs.headers && lhs.body == rhs.body - && lhs.shouldFail == rhs.shouldFail && lhs.error == rhs.error - } - -} diff --git a/Frameworks/Hippolyte/Hippolyte/URL+HippolyteAdditions.swift b/Frameworks/Hippolyte/Hippolyte/URL+HippolyteAdditions.swift deleted file mode 100644 index 41bce72..0000000 --- a/Frameworks/Hippolyte/Hippolyte/URL+HippolyteAdditions.swift +++ /dev/null @@ -1,13 +0,0 @@ -// -// Copyright © 2017 Jan Gorman. All rights reserved. -// - -import Foundation - -extension URL: Matcheable { - - public func matcher() -> Matcher { - return StringMatcher(string: absoluteString) - } - -} diff --git a/Frameworks/Hippolyte/Hippolyte/URLHook.swift b/Frameworks/Hippolyte/Hippolyte/URLHook.swift deleted file mode 100644 index 3c414d8..0000000 --- a/Frameworks/Hippolyte/Hippolyte/URLHook.swift +++ /dev/null @@ -1,24 +0,0 @@ -// -// Copyright © 2017 Jan Gorman. All rights reserved. -// - -import Foundation - -final class URLHook: HTTPClientHook { - - func load() { - URLProtocol.registerClass(HTTPStubURLProtocol.self) - } - - func unload() { - URLProtocol.unregisterClass(HTTPStubURLProtocol.self) - } - - func isEqual(to other: HTTPClientHook) -> Bool { - if let o = other as? URLHook { - return o == self - } - return false - } - -} diff --git a/Frameworks/Hippolyte/Hippolyte/URLSessionHook.swift b/Frameworks/Hippolyte/Hippolyte/URLSessionHook.swift deleted file mode 100644 index 1fe3096..0000000 --- a/Frameworks/Hippolyte/Hippolyte/URLSessionHook.swift +++ /dev/null @@ -1,40 +0,0 @@ -// -// Copyright © 2017 Jan Gorman. All rights reserved. -// - -import Foundation - -final class URLSessionHook: HTTPClientHook { - - func isEqual(to other: HTTPClientHook) -> Bool { - if let o = other as? URLSessionHook { - return o == self - } - return false - } - - func load() { - guard let method = class_getInstanceMethod(originalClass(), originalSelector()), - let stub = class_getInstanceMethod(URLSessionHook.self, #selector(protocolClasses)) else { - fatalError("Couldn't load URLSessionHook") - } - method_exchangeImplementations(method, stub) - } - - private func originalClass() -> AnyClass? { - return NSClassFromString("__NSCFURLSessionConfiguration") ?? NSClassFromString("NSURLSessionConfiguration") - } - - private func originalSelector() -> Selector { - return #selector(getter: URLSessionConfiguration.protocolClasses) - } - - @objc private func protocolClasses() -> [AnyClass] { - return [HTTPStubURLProtocol.self] - } - - func unload() { - load() - } - -} diff --git a/Frameworks/Hippolyte/HippolyteTests/DataMatcherTests.swift b/Frameworks/Hippolyte/HippolyteTests/DataMatcherTests.swift deleted file mode 100644 index ac24d1b..0000000 --- a/Frameworks/Hippolyte/HippolyteTests/DataMatcherTests.swift +++ /dev/null @@ -1,39 +0,0 @@ -// -// Copyright © 2017 Jan Gorman. All rights reserved. -// - -import XCTest -import Hippolyte - -class DataMatcherTests: XCTestCase { - - func testMatchingDataMatches() { - let data = "data".data(using: .utf8)! - let matcher = DataMatcher(data: data) - - XCTAssertTrue(matcher.matches(data: data)) - } - - func testMismatchingDataDoesNotMatch() { - let data = "data".data(using: .utf8)! - let matcher = DataMatcher(data: data) - - XCTAssertFalse(matcher.matches(data: "other".data(using: .utf8)!)) - } - - func testInstancesWithSameDataMatch() { - let data = "data".data(using: .utf8)! - let matcher1 = DataMatcher(data: data) - let matcher2 = DataMatcher(data: data) - - XCTAssertEqual(matcher1, matcher2) - } - - func testInstancesWithDifferentDataDoNotMatch() { - let matcher1 = DataMatcher(data: "data".data(using: .utf8)!) - let matcher2 = DataMatcher(data: "other".data(using: .utf8)!) - - XCTAssertNotEqual(matcher1, matcher2) - } - -} diff --git a/Frameworks/Hippolyte/HippolyteTests/HippolyteTests.swift b/Frameworks/Hippolyte/HippolyteTests/HippolyteTests.swift deleted file mode 100644 index 1d32013..0000000 --- a/Frameworks/Hippolyte/HippolyteTests/HippolyteTests.swift +++ /dev/null @@ -1,77 +0,0 @@ -// -// Copyright © 2017 Jan Gorman. All rights reserved. -// - -import XCTest -import Hippolyte - -class HippolyteTests: XCTestCase { - - override func tearDown() { - super.tearDown() - Hippolyte.shared.stop() - } - - func testUnmatchedRequestThrows() { - let request = TestRequest(method: .GET, url: URL(string: "http://www.apple.com")!) - - XCTAssertThrowsError(try Hippolyte.shared.response(for: request)) - } - - func testMatchedRequest() { - let url = URL(string: "http://www.apple.com")! - var stub = StubRequest(method: .GET, url: url) - let response = StubResponse(statusCode: 404) - stub.response = response - Hippolyte.shared.add(stubbedRequest: stub) - - let request = TestRequest(method: .GET, url: url) - let result = try? Hippolyte.shared.response(for: request) - - XCTAssertEqual(result, response) - - Hippolyte.shared.clearStubs() - } - - func testStubIsReplaceable() { - let url = URL(string: "http://www.apple.com")! - var stub1 = StubRequest(method: .GET, url: url) - let response1 = StubResponse(statusCode: 404) - stub1.response = response1 - Hippolyte.shared.add(stubbedRequest: stub1) - - var stub2 = StubRequest(method: .GET, url: url) - let response2 = StubResponse(statusCode: 200) - stub2.response = response2 - Hippolyte.shared.add(stubbedRequest: stub2) - - let request = TestRequest(method: .GET, url: url) - let result = try? Hippolyte.shared.response(for: request) - - XCTAssertEqual(result, response2) - - Hippolyte.shared.clearStubs() - } - - func testItStubsRegularNetworkCall() { - let url = URL(string: "http://www.apple.com")! - var stub = StubRequest(method: .GET, url: url) - var response = StubResponse() - let body = "Hippolyte".data(using: .utf8)! - response.body = body - stub.response = response - Hippolyte.shared.add(stubbedRequest: stub) - - Hippolyte.shared.start() - - let expectation = self.expectation(description: "Stubs network call") - let task = URLSession.shared.dataTask(with: url) { data, _, _ in - XCTAssertEqual(data, body) - expectation.fulfill() - } - task.resume() - - wait(for: [expectation], timeout: 1) - } - -} diff --git a/Frameworks/Hippolyte/HippolyteTests/Info.plist b/Frameworks/Hippolyte/HippolyteTests/Info.plist deleted file mode 100644 index 6c40a6c..0000000 --- a/Frameworks/Hippolyte/HippolyteTests/Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - - diff --git a/Frameworks/Hippolyte/HippolyteTests/RegexMatcherTests.swift b/Frameworks/Hippolyte/HippolyteTests/RegexMatcherTests.swift deleted file mode 100644 index 1a6aef5..0000000 --- a/Frameworks/Hippolyte/HippolyteTests/RegexMatcherTests.swift +++ /dev/null @@ -1,41 +0,0 @@ -// -// Copyright © 2017 Jan Gorman. All rights reserved. -// - -import XCTest -import Hippolyte - -class RegexMatcherTests: XCTestCase { - - func testRegexMatches() { - let regex = try! NSRegularExpression(pattern: "Fo+", options: []) - let matcher = RegexMatcher(regex: regex) - - XCTAssertTrue(matcher.matches(string: "Foooo")) - XCTAssertTrue(matcher.matches(string: "Fo")) - } - - func testRegexWithWrongStringDoesNotMatch() { - let regex = try! NSRegularExpression(pattern: "Fo+", options: []) - let matcher = RegexMatcher(regex: regex) - - XCTAssertFalse(matcher.matches(string: "F")) - XCTAssertFalse(matcher.matches(string: "Wrong")) - } - - func testInstancesWithSameRegexMatch() { - let regex = try! NSRegularExpression(pattern: "Fo+", options: []) - let matcher1 = RegexMatcher(regex: regex) - let matcher2 = RegexMatcher(regex: regex) - - XCTAssertEqual(matcher1, matcher2) - } - - func testInstancesWithDifferentRegexesDoNotMatch() { - let matcher1 = RegexMatcher(regex: try! NSRegularExpression(pattern: "Fo+", options: [])) - let matcher2 = RegexMatcher(regex: try! NSRegularExpression(pattern: "Other", options: [])) - - XCTAssertNotEqual(matcher1, matcher2) - } - -} diff --git a/Frameworks/Hippolyte/HippolyteTests/StringMatcherTests.swift b/Frameworks/Hippolyte/HippolyteTests/StringMatcherTests.swift deleted file mode 100644 index 9225e7e..0000000 --- a/Frameworks/Hippolyte/HippolyteTests/StringMatcherTests.swift +++ /dev/null @@ -1,37 +0,0 @@ -// -// Copyright © 2017 Jan Gorman. All rights reserved. -// - -import XCTest -import Hippolyte - -class StringMatcherTests: XCTestCase { - - func testMatchingStringsMatch() { - let matcher = StringMatcher(string: "string") - - XCTAssertTrue(matcher.matches(string: "string")) - } - - func testMisMatchingStringsDoNotMatch() { - let matcher = StringMatcher(string: "string") - - XCTAssertFalse(matcher.matches(string: "other")) - } - - func testInstancesWithSameStringMatch() { - let string = "string" - let matcher1 = StringMatcher(string: string) - let matcher2 = StringMatcher(string: string) - - XCTAssertEqual(matcher1, matcher2) - } - - func testInstancesWithDifferentStringsDoNotMatch() { - let matcher1 = StringMatcher(string: "string") - let matcher2 = StringMatcher(string: "other") - - XCTAssertNotEqual(matcher1, matcher2) - } - -} diff --git a/Frameworks/Hippolyte/HippolyteTests/StubRequestTests.swift b/Frameworks/Hippolyte/HippolyteTests/StubRequestTests.swift deleted file mode 100644 index 830f78d..0000000 --- a/Frameworks/Hippolyte/HippolyteTests/StubRequestTests.swift +++ /dev/null @@ -1,102 +0,0 @@ -// -// Copyright © 2017 Jan Gorman. All rights reserved. -// - -import XCTest -import Hippolyte - -class StubRequestTests: XCTestCase { - - func testStubRequestsMatch() { - let stub = StubRequest(method: .GET, url: URL(string: "http://www.apple.com")!) - let other = StubRequest(method: .GET, url: URL(string: "http://www.apple.com")!) - - XCTAssertEqual(stub, other) - } - - func testStubRequestsWithDifferentMethodDoNotMatch() { - let stub = StubRequest(method: .GET, url: URL(string: "http://www.apple.com")!) - let other = StubRequest(method: .POST, url: URL(string: "http://www.apple.com")!) - - XCTAssertNotEqual(stub, other) - } - - func testStubRequestsWithDifferentUrlDoNotMatch() { - let stub = StubRequest(method: .GET, url: URL(string: "http://www.apple.com")!) - let other = StubRequest(method: .GET, url: URL(string: "http://www.google.com")!) - - XCTAssertNotEqual(stub, other) - } - - func testStubWithMatcherMatches() { - let matcher = RegexMatcher(regex: try! NSRegularExpression(pattern: "^http://www.apple.com", options: [])) - let stub = StubRequest(method: .GET, urlMatcher: matcher) - - let request1 = TestRequest(method: .GET, url: URL(string: "http://www.apple.com/iPhone")!) - XCTAssertTrue(stub.matchesRequest(request1)) - - let request2 = TestRequest(method: .GET, url: URL(string: "foohttp://www.apple.com/iPhone")!) - XCTAssertFalse(stub.matchesRequest(request2)) - } - - func testHeaderSubsetMatches() { - var stub = StubRequest(method: .GET, url: URL(string: "http://www.apple.com")!) - stub.setHeader(key: "X-Foo", value: "Bar") - - var request = TestRequest(method: .GET, url: URL(string: "http://www.apple.com")!) - request.setHeader(key: "X-Foo", value: "Bar") - request.setHeader(key: "X-Bar", value: "Foo") - - XCTAssertTrue(stub.matchesRequest(request)) - } - - func testHeaderSupersetDoesNotMatch() { - var stub = StubRequest(method: .GET, url: URL(string: "http://www.apple.com")!) - stub.setHeader(key: "X-Foo", value: "Bar") - stub.setHeader(key: "X-Bar", value: "Foo") - - var request = TestRequest(method: .GET, url: URL(string: "http://www.apple.com")!) - request.setHeader(key: "X-Foo", value: "Bar") - - XCTAssertFalse(stub.matchesRequest(request)) - } - - func testBodyMatches() { - var stub = StubRequest(method: .GET, url: URL(string: "http://www.apple.com")!) - stub.bodyMatcher = DataMatcher(data: "data".data(using: .utf8)!) - - var request = TestRequest(method: .GET, url: URL(string: "http://www.apple.com")!) - request.body = "data".data(using: .utf8)! - - XCTAssertTrue(stub.matchesRequest(request)) - } - - func testNilBodyMatches() { - let stub = StubRequest(method: .GET, url: URL(string: "http://www.apple.com")!) - - var request = TestRequest(method: .GET, url: URL(string: "http://www.apple.com")!) - request.body = "Foooo".data(using: .utf8)! - - XCTAssertTrue(stub.matchesRequest(request)) - } - - func testBuilderProducesStubs() { - let builder = StubRequest.Builder() - - let stub1 = builder.stubRequest(withMethod: .GET, url: URL(string: "http://www.apple.com")!) - .addHeader(withKey: "X-Foo", value: "Bar") - .addResponse(StubResponse()) - .build() - - XCTAssertNotNil(stub1) - - let matcher = RegexMatcher(regex: try! NSRegularExpression(pattern: "^http://www.apple.com", options: [])) - - let stub2 = builder.stubRequest(withMethod: .GET, urlMatcher: matcher) - .addHeader(withKey: "X-Foo", value: "Bar") - .build() - - XCTAssertNotNil(stub2) - } - -} diff --git a/Frameworks/Hippolyte/HippolyteTests/StubResponseBuilderTests.swift b/Frameworks/Hippolyte/HippolyteTests/StubResponseBuilderTests.swift deleted file mode 100644 index 20fec50..0000000 --- a/Frameworks/Hippolyte/HippolyteTests/StubResponseBuilderTests.swift +++ /dev/null @@ -1,27 +0,0 @@ -// -// Copyright © 2017 Jan Gorman. All rights reserved. -// - -import XCTest -import Hippolyte - -class StubResponseBuilderTests: XCTestCase { - - func testBuilderProducesStubs() { - let builder = StubResponse.Builder() - - let stub1 = builder.stubResponse(withStatusCode: 400).addHeader(withKey: "X-Foo", value: "Bar").build() - - XCTAssertNotNil(stub1) - XCTAssertEqual(stub1.statusCode, 400) - - let stub2 = builder.stubResponse(withError: NSError(domain: "Error", code: -1, userInfo: nil)) - .addBody("".data(using: .utf8)!) - .build() - - XCTAssertNotNil(stub2) - XCTAssertNotNil(stub2.error) - XCTAssertNotNil(stub2.body) - } - -} diff --git a/Frameworks/Hippolyte/HippolyteTests/TestRequest.swift b/Frameworks/Hippolyte/HippolyteTests/TestRequest.swift deleted file mode 100644 index 00252cf..0000000 --- a/Frameworks/Hippolyte/HippolyteTests/TestRequest.swift +++ /dev/null @@ -1,25 +0,0 @@ -// -// Copyright © 2017 Jan Gorman. All rights reserved. -// - -import Foundation -import Hippolyte - -struct TestRequest: HTTPRequest { - - var url: URL? - var method: HTTPMethod? - var headers: [String : String]? - var body: Data? - - init(method: HTTPMethod, url: URL) { - self.method = method - self.url = url - self.headers = [:] - } - - mutating func setHeader(key: String, value: String) { - headers?[key] = value - } - -} diff --git a/Frameworks/Hippolyte/LICENSE b/Frameworks/Hippolyte/LICENSE deleted file mode 100644 index b17c6b4..0000000 --- a/Frameworks/Hippolyte/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2017 JanGorman - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/Frameworks/Hippolyte/README.md b/Frameworks/Hippolyte/README.md deleted file mode 100644 index 03665dd..0000000 --- a/Frameworks/Hippolyte/README.md +++ /dev/null @@ -1,97 +0,0 @@ -# Hippolyte - -[![Build Status](https://travis-ci.org/JanGorman/Hippolyte.svg?branch=master)](https://travis-ci.org/JanGorman/Hippolyte) -[![codecov](https://codecov.io/gh/JanGorman/Hippolyte/branch/master/graph/badge.svg)](https://codecov.io/gh/JanGorman/Hippolyte) -[![Version](https://img.shields.io/cocoapods/v/Hippolyte.svg?style=flat)](http://cocoapods.org/pods/Hippolyte) -[![License](https://img.shields.io/cocoapods/l/Hippolyte.svg?style=flat)](http://cocoapods.org/pods/Hippolyte) -[![Platform](https://img.shields.io/cocoapods/p/Hippolyte.svg?style=flat)](http://cocoapods.org/pods/Hippolyte) - -An HTTP stubbing library written in Swift. - -## Requirements - -- Swift 4 -- iOS 9.3+ -- Xcode 9+ - -## Install - -Hippolyte is available on [Cocoapods](http://cocoapods.org). Add it to your `Podfile`'s test target: - -```ruby -pod 'Hippolyte' -``` - -## Usage - -To stub a request, first you need to create a `StubRequest` and `StubResponse`. You then register this stub with `Hippolyte` and tell it to intercept network requests by calling the `start()` method. - -```swift -func testStub() { - let url = URL(string: "http://www.apple.com")! - var stub = StubRequest(method: .GET, url: url) - var response = StubResponse() - let body = "Hippolyte".data(using: .utf8)! - response.body = body - stub.response = response - Hippolyte.shared.add(stubbedRequest: stub) - Hippolyte.shared.start() - - let expectation = self.expectation(description: "Stubs network call") - let task = URLSession.shared.dataTask(with: url) { data, _, _ in - XCTAssertEqual(data, body) - expectation.fulfill() - } - task.resume() - - wait(for: [expectation], timeout: 1) -} -``` - -It's also possible to configure a `StubRequest` to use a regular expression matcher to intercept URLs. The following example also shows a `StubResponse` that returns a certain status code: - -```swift -func testStub() throws { - let regex = try NSRegularExpression(pattern: "http://www.google.com/+", options: []) - var stub = StubRequest(method: .GET, urlMatcher: RegexMatcher(regex: regex)) - stub.response = StubResponse(statusCode: 404) - Hippolyte.shared.add(stubbedRequest: stub) - Hippolyte.shared.start() - - myFictionalDataSource.get(URL(string: "http://www.google.com/foo.html")!) { - … - } -} -``` - -There are convenient Builder classes for both requests and responses: - -```swift -func testStub() { - let response = StubResponse.Builder() - .stubResponse(withStatusCode: 204) - .addHeader(withKey: "X-Foo", value: "Bar") - .build() - let request = StubRequest.Builder() - .stubRequest(withMethod: .GET, url: URL(string: "http://www.apple.com")!) - .addResponse(response) - .build() - - … -} -``` - -Remember to tear down stubbing in your tests: - -```swift -override func tearDown() { - super.tearDown() - Hippolyte.shared.stop() -} -``` - -You can configure your stub response in a number of ways, such as having it return different HTTP status codes, headers, and errors. - -## License - -Hippolyte is released under the MIT license. See LICENSE for details