Skip to content
This repository has been archived by the owner on Jun 17, 2021. It is now read-only.

Commit

Permalink
Revert "Fix Credentials Manager Test (auth0#325)"
Browse files Browse the repository at this point in the history
This reverts commit 5b9d6f3.
  • Loading branch information
sam-w committed Mar 11, 2020
1 parent 38a2f62 commit 9c56ccc
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 21 deletions.
21 changes: 12 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2
jobs:
build-iOS-Swift-5.1:
macos:
xcode: "11.2.0"
xcode: "11.0.0"
shell: /bin/bash --login -eo pipefail
environment:
LC_ALL: en_US.UTF-8
Expand All @@ -11,6 +11,9 @@ jobs:
HOMEBREW_TEMP: ~/homebrew-temp
HOMEBREW_NO_AUTO_UPDATE: 1
steps:
- run:
name: Set Ruby Version
command: echo "ruby-2.5" > ~/.ruby-version
- checkout
- run: |
brew install swiftlint
Expand All @@ -26,18 +29,12 @@ jobs:
SCHEME: Auth0.iOS
DEVICE: iPhone 8
FASTLANE_EXPLICIT_OPEN_SIMULATOR: 2
- run: |
slather
mkdir /tmp/artifacts
cp ./fastlane/test_output/* /tmp/artifacts/
cp ./cobertura.xml /tmp/artifacts/
bash <(curl -s https://codecov.io/bash) -J Auth0 -f ./cobertura.xml
- save_cache:
key: dependency-cache
paths:
- Carthage/Build
- store_artifacts:
path: /tmp/artifacts
- store_test_results:
path: fastlane/test_output
build-iOS-Swift-5.0:
macos:
xcode: "10.3.0"
Expand All @@ -63,10 +60,14 @@ jobs:
SCHEME: Auth0.iOS
DEVICE: iPhone 8
FASTLANE_EXPLICIT_OPEN_SIMULATOR: 2
- run: |
bash <(curl -s https://codecov.io/bash) -J 'Auth0'
- save_cache:
key: dependency-cache
paths:
- Carthage/Build
- store_test_results:
path: fastlane/test_output
build-iOS-Swift-4.2:
macos:
xcode: "10.3.0"
Expand Down Expand Up @@ -97,6 +98,8 @@ jobs:
key: dependency-cache
paths:
- Carthage/Build
- store_test_results:
path: fastlane/test_output
build-iOS-Swift-4.0:
macos:
xcode: "10.3.0"
Expand Down
4 changes: 0 additions & 4 deletions .slather.yml

This file was deleted.

2 changes: 0 additions & 2 deletions Auth0.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2122,7 +2122,6 @@
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_GENERATE_TEST_COVERAGE_FILES = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
Expand Down Expand Up @@ -2182,7 +2181,6 @@
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_GENERATE_TEST_COVERAGE_FILES = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
Expand Down
9 changes: 6 additions & 3 deletions Auth0/CredentialsManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -195,17 +195,20 @@ public struct CredentialsManager {

func hasExpired(_ credentials: Credentials) -> Bool {

var hasATExpired = true
var hasIDTExpired = true

if let expiresIn = credentials.expiresIn {
if expiresIn < Date() { return true }
if expiresIn > Date() { hasATExpired = false }
}

if let token = credentials.idToken,
let tokenDecoded = decode(jwt: token),
let exp = tokenDecoded["exp"] as? Double {
if Date(timeIntervalSince1970: exp) < Date() { return true }
if Date(timeIntervalSince1970: exp) > Date() { hasIDTExpired = false }
}

return false
return hasATExpired || hasIDTExpired
}
}

Expand Down
2 changes: 1 addition & 1 deletion Auth0Tests/CredentialsManagerSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ class CredentialsManagerSpec: QuickSpec {
expect(credentialsManager.hasValid()).to(beTrue())
}

it("should not be valid when at valid and id token expired") {
fit("should not be valid when at valid and id token expired") {
let credentials = Credentials(accessToken: AccessToken, tokenType: TokenType, idToken: ExpiredToken, refreshToken: nil, expiresIn: Date(timeIntervalSinceNow: ExpiresIn))
expect(credentialsManager.store(credentials: credentials)).to(beTrue())
expect(credentialsManager.hasValid()).to(beFalse())
Expand Down
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ source 'https://rubygems.org'

gem 'fastlane'
gem 'semantic', '~> 1.5'
gem 'slather'

plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
eval_gemfile(plugins_path) if File.exist?(plugins_path)
Expand Down
2 changes: 1 addition & 1 deletion fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ platform :ios do
device: device,
clean: true,
skip_build: true,
code_coverage: true
output_types: 'junit'
)
end

Expand Down
2 changes: 2 additions & 0 deletions fastlane/Scanfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ scheme "Auth0.iOS"
devices ["iPhone 8"]

clean true

output_types "html"

0 comments on commit 9c56ccc

Please sign in to comment.