Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR for running CI #1

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ jobs:
cabal update
cabal build --only-dependencies --enable-tests --enable-benchmarks
- name: Build
run: cabal build --enable-tests --enable-benchmarks all
# We can't really keep this constraint here, since users aren't going to
# know they need to specify it. But we can at least have it to check that
# getting the flag specified is the only blocker to a successful build.
run: cabal build --enable-tests --enable-benchmarks all --constraint="cryptostore +use_crypton"
- name: Run tests
run: cabal test test:testsuite
# as above
run: cabal test test:testsuite --constraint="cryptostore +use_crypton"
14 changes: 7 additions & 7 deletions jwt.cabal
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
cabal-version: 1.16
-- Initial atlassian-jwt.cabal generated by cabal init. For further
-- documentation, see http://haskell.org/cabal/users-guide/

Expand All @@ -12,7 +13,6 @@ homepage: https://github.com/puffnfresh/haskell-jwt
bug-reports: https://github.com/puffnfresh/haskell-jwt/issues
category: Web
build-type: Simple
cabal-version: >=1.16
description:

JSON Web Token (JWT) is a compact URL-safe means of representing claims to be transferred between two parties.
Expand All @@ -33,7 +33,7 @@ library
exposed-modules: Web.JWT
other-modules: Data.Text.Extended, Data.ByteString.Extended
build-depends: base >= 4.8 && < 5
, cryptonite >= 0.6
, crypton >= 0.31
, cryptostore >= 0.2
, memory >= 0.8
, bytestring >= 0.10
Expand All @@ -47,8 +47,8 @@ library
, vector >= 0.7.1
, semigroups >= 0.15.4
, network-uri
, x509
, x509-store
, crypton-x509
, crypton-x509-store

hs-source-dirs: src
default-language: Haskell2010
Expand Down Expand Up @@ -81,7 +81,7 @@ test-suite testsuite
, lens
, HUnit
, QuickCheck >= 2.4.0.1
, cryptonite
, crypton
, cryptostore
, memory
, bytestring >= 0.10
Expand All @@ -95,8 +95,8 @@ test-suite testsuite
, vector >= 0.7.1
, semigroups >= 0.15.4
, network-uri
, x509
, x509-store
, crypton-x509
, crypton-x509-store

cpp-options: -DTEST

Expand Down
6 changes: 3 additions & 3 deletions tests/src/Web/JWTInteropTests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ prop_encode_decode_sub = shouldBeMaybeStringOrUri "sub" sub
prop_encode_decode_iss :: JWTClaimsSet -> Bool
prop_encode_decode_iss = shouldBeMaybeStringOrUri "iss" iss

shouldBeMaybeStringOrUri :: ToJSON a => T.Text -> (a -> Maybe StringOrURI) -> a -> Bool
shouldBeMaybeStringOrUri key' f claims' =
let json = toJSON claims' ^? key key'
shouldBeMaybeStringOrUri :: ToJSON a => String -> (a -> Maybe StringOrURI) -> a -> Bool
shouldBeMaybeStringOrUri key' f claims' =
let json = toJSON claims' ^? key (fromString key')
in json == (fmap (String . stringOrURIToText) $ f claims')

prop_encode_decode_aud :: JWTClaimsSet -> Bool
Expand Down
Loading