From c14fea97ee69a931365154317bc685ee0367e6fa Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Sat, 12 Jan 2019 09:52:02 -0500 Subject: [PATCH] Re-enable some tests (#15) * Re-enable failing test * Get rid of the extra trailing quote * Re-enable and fix the commented-out tests --- src/Servant/PY/Internal.hs | 2 +- test/Servant/PY/InternalSpec.hs | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Servant/PY/Internal.hs b/src/Servant/PY/Internal.hs index 636c3ba..8d347b6 100644 --- a/src/Servant/PY/Internal.hs +++ b/src/Servant/PY/Internal.hs @@ -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 diff --git a/test/Servant/PY/InternalSpec.hs b/test/Servant/PY/InternalSpec.hs index 6da4a0b..7da10df 100644 --- a/test/Servant/PY/InternalSpec.hs +++ b/test/Servant/PY/InternalSpec.hs @@ -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 @@ -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` "/login-with-path-var-and-header/{id}/{Name}/{hungrig}" + docstring `shouldContain` "Args:" + docstring `shouldContain` "Returns:"