Merge branch '42-working-test-case-into-readme' into 'master'
authorMichael Winsauer <e1429715@student.tuwien.ac.at>
Thu, 13 Dec 2018 10:25:12 +0000 (11:25 +0100)
committerMichael Winsauer <e1429715@student.tuwien.ac.at>
Thu, 13 Dec 2018 10:25:12 +0000 (11:25 +0100)
#42 document test cases into readme

Closes #42

See merge request aic18/G6T4!35

service-analysis/README.md
service-reporting/README.md
service-twitter/README.md

index a4d4cc4e353fb4f1c5096c55508c5167e4c4d627..aa0e4c0772c79291ce555724e6d964b9738404eb 100644 (file)
@@ -39,6 +39,9 @@ JSON string may contain more value-key pairs than 'text', but 'text' is needed f
 - pip
   -> indicoio
   -> flask
-  -> flask_restfut
+  -> flask_restful
+
 ### commands
 - `python3.7 sentiment_analysis.py`
+- positive sentiment test example: `curl -vs -H 'content-type: application/json' -X POST http://localhost:8081 -d '[{"text":"happy birthday, i love you"}]'`
+- negative sentiment test example: `curl -vs -H 'content-type: application/json' -X POST http://localhost:8081 -d '[{"text":"i hate you, please die"}]'`
index 49640ff5533c2410012dd38bf6f42f4d2a7463fc..cc0a95af51f9c75a74a886936479064816d3f0f4 100644 (file)
@@ -41,4 +41,10 @@ Term(string `Name`, double `Sentiment`)
 - .net core 2.2
 - download [libwkhtml library](https://github.com/rdvojmoc/DinkToPdf/tree/master/v0.12.4) depending on your operating system and put it into `service-reporting` root folder
 ### commands
-- `dotnet run`
\ No newline at end of file
+- `dotnet run`
+
+## Tests
+- successfull pdf as application/json: `curl -X POST  http://localhost:8083/generatePDF  -H 'Content-Type: application/json'  -d '[ { "name": "A bad term", "sentiment": 0.1 }, { "name": "Another bad term", "sentiment": 0.3 }, { "name": "A neutral term", "sentiment": 0.5 }, { "name": "A good term", "sentiment": 0.65 }, { "name": "Another good term", "sentiment": 0.9 } ] ' -vs > test1.pdf`
+- successfull pdf as application/base64: `curl -X POST http://localhost:8083/generatePDF -H 'Accept: application/base64' -H 'Content-Type: application/json' -d '[ { "name": "A bad term", "sentiment": 0.1 }, { "name": "Another bad term", "sentiment": 0.3 }, { "name": "A neutral term", "sentiment": 0.5 }, { "name": "A good term", "sentiment": 0.65 }, { "name": "Another good term", "sentiment": 0.9 } ] ' -vs | base64 -d > test2.pdf`
+- invalid sentiment value: `curl -X POST http://localhost:8083/generatePDF -H 'Content-Type: application/json' -d '[ { "name": "Term with invalid sentiment value", "sentiment": 12 } ] ' -vs && echo`
+- invalid json structure: `curl -X POST http://localhost:8083/generatePDF -H 'Content-Type: application/json' -d '[ { "name1": "A term with invalid json format", "sentiment": 0.5 } ] ' -vs && echo`
\ No newline at end of file
index a2f641be631efbb33897bf85a1fc2d3e8075bfc2..79630d0cfc7c5f3905d53be74da11ca4e624addf 100644 (file)
@@ -1,15 +1,24 @@
 # Twitter Service
 
 
+
 ## API
 
-You can use the search under: [http://localhost:8084/search/tweets.json?q=Google](http://localhost:8080/search/tweets.json?q=Google)
+You can use the search under [http://localhost:8084/search/tweets.json?q=Google](http://localhost:8080/search/tweets.json?q=Google)
 where `q` is your search string.
 
 It mainly mirrors the search API from Twitter. My implementation contains some basic fields with the same names as in
 the official API. If you need more, please let me know.
 
 
+### Example
+
+`curl -vs http://localhost:8084/search/tweets.json?q=Google `
+
+Pipe it into e.g. `jq` for a more readable output.
+
+
+
 ## API Keys
 
 Unfortunately you have to provide your own API Keys, as sharing them is forbidden. In the worst case there would be five