Skip to content

Commit

Permalink
Re-enable some tests (#15)
Browse files Browse the repository at this point in the history
* Re-enable failing test

* Get rid of the extra trailing quote

* Re-enable and fix the commented-out tests
  • Loading branch information
exarkun authored and erewok committed Jan 12, 2019
1 parent 33ec1f9 commit c14fea9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/Servant/PY/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ buildDocString (UnTypedPythonRequest req) opts returnVal = buildDocString' req o
where args = capturesToFormatArgs $ req ^.. reqUrl.path.traverse

buildDocString' :: forall f. Req f -> CommonGeneratorOptions -> [Text] -> Text -> Text
buildDocString' req opts args returnVal = T.toUpper method <> " \"" <> url <> "\n"
buildDocString' req opts args returnVal = T.toUpper method <> " /" <> url <> "\n"
<> includeArgs <> "\n\n"
<> indent' <> "Returns:\n"
<> indent' <> indent' <> returnVal
Expand Down
26 changes: 13 additions & 13 deletions test/Servant/PY/InternalSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ internalSpec = describe "Internal" $ do

describe "functions that operate on Req objects" $ do
let captureList = listFromAPI (Proxy :: Proxy NoTypes) (Proxy :: Proxy NoContent) captureApi
-- it "should correctly find captures" $ do
-- let captured = captures . head $ captureList
-- captured `shouldBe` ["id", "Name", "hungrig"]
it "should correctly find captures" $ do
let captured = captures . head $ map UnTypedPythonRequest captureList
captured `shouldBe` ["id", "Name", "hungrig"]

-- let reqList = listFromAPI (Proxy :: Proxy NoTypes) (Proxy :: Proxy NoContent) testApi
-- it "should not incorrectly find captures" $ do
-- let captured = captures . head $ reqList
-- captured `shouldBe` []
let reqList = listFromAPI (Proxy :: Proxy NoTypes) (Proxy :: Proxy NoContent) testApi
it "should not incorrectly find captures" $ do
let captured = captures . head $ map UnTypedPythonRequest reqList
captured `shouldBe` []

let req = head captureList
let pathParts = req ^.. reqUrl.path.traverse
Expand All @@ -135,9 +135,9 @@ internalSpec = describe "Internal" $ do
segmentToStr (head pathParts) == "login-with-path-var-and-header"
it "should do segment-to-str in formatting braces for a capture" $
segmentToStr (last pathParts) == "{hungrig}"
-- it "should build a doctstring that looks like a regular Python docstring" $ do
-- let docstring = buildDocString req customOptions
-- docstring `shouldContain` "POST"
-- docstring `shouldContain` makePyUrl' pathParts
-- docstring `shouldContain` "Args:"
-- docstring `shouldContain` "Returns:"
it "should build a doctstring that looks like a regular Python docstring" $ do
let docstring = buildDocString (UnTypedPythonRequest req) customOptions ""
docstring `shouldContain` "POST"
docstring `shouldContain` "/#-with-path-var-and-header/{id}/{Name}/{hungrig}"
docstring `shouldContain` "Args:"
docstring `shouldContain` "Returns:"

0 comments on commit c14fea9

Please # to comment.