Skip to content

Commit

Permalink
[#500] Trails-tests: Randomise GS1 Company Prefix.
Browse files Browse the repository at this point in the history
  • Loading branch information
a-stacey committed Aug 21, 2019
1 parent 65dcbb7 commit 2836f61
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion projects/trails/test/Mirza/Trails/Tests/Client.hs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,14 @@ import qualified Network.HTTP.Types.Status as NS
import Servant.API.ContentTypes
import Servant.Client

import System.Random

import Control.Exception (bracket)
import Control.Monad
import Data.Either (isLeft, isRight)
import Data.Foldable
import Data.List
import Data.Text (pack)
import Data.Time.Clock
import Data.UUID
import Data.UUID.V4
Expand Down Expand Up @@ -363,9 +367,10 @@ buildEntry :: IO TrailEntry
buildEntry = do
time <- liftIO getCurrentTime
uuid <- liftIO nextRandom
prefix <- pack <$> (sequence $ take 7 $ repeat $ randomRIO ('0', '9'))
let unsignedEntry = TrailEntry 1
(EntryTime time)
(GS1CompanyPrefix "0000001") -- TODO: Should randomise this.
(GS1CompanyPrefix prefix)
(EventId uuid)
[]
(SignaturePlaceholder "")
Expand Down
2 changes: 2 additions & 0 deletions projects/trails/trails.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,14 @@ test-suite trails-test
, http-types
, katip
, mtl
, random
, servant
, servant-client
, servant-client-core
, tasty
, tasty-hunit
, temporary
, text
, time
, uuid
default-language: Haskell2010
Expand Down

0 comments on commit 2836f61

Please sign in to comment.