git.iko.soy/typeable/bloodhound
on master help sign in
26 lines 910 B history raw
1{-# LANGUAGE OverloadedStrings #-}
3module Test.Templates where
5import Test.Common
6import Test.Import
8spec :: Spec
9spec =
10 describe "template API" $ do
11 it "can create a template" $ withTestEnv $ do
12 let idxTpl = IndexTemplate (TemplatePattern "tweet-*") (Just (IndexSettings (ShardCount 1) (ReplicaCount 1))) [toJSON TweetMapping]
13 resp <- putTemplate idxTpl (TemplateName "tweet-tpl")
14 liftIO $ validateStatus resp 200
16 it "can detect if a template exists" $ withTestEnv $ do
17 exists <- templateExists (TemplateName "tweet-tpl")
18 liftIO $ exists `shouldBe` True
20 it "can delete a template" $ withTestEnv $ do
21 resp <- deleteTemplate (TemplateName "tweet-tpl")
22 liftIO $ validateStatus resp 200
24 it "can detect if a template doesn't exist" $ withTestEnv $ do
25 exists <- templateExists (TemplateName "tweet-tpl")
26 liftIO $ exists `shouldBe` False