# Stadim QA
## Credentials
For this test the following credentials were used.
API key: AIzaSyBMowzq6alBOzjIknplXVCGNyn3aBwEXkY
JWT: Ask maurits@co-libry.be
customer_id: 8flK9Qr0
## Environment
All tests were performed on https://app.swaggerhub.com/apis-docs/co-libry/colibry-api/0.4#/Prediction/post_room_classification using co-libry's prod environment.
One exception was made for doing 10 consecutive calls. This was done with CURL in shell script.
## Room classification
CURL command:
```
curl -X 'GET' \
'http://127.0.0.1:8000/api/0.4/predict/cv?customer_id=8flK9Qr0&key=AIzaSyBMowzq6alBOzjIknplXVCGNyn3aBwEXkY' \
-H 'accept: application/json' \
-H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IjU4Zjg5N2ExMDJlYjNlYWE4NGM1ODVlZjVkZGY3NjkxMGE3NTNiZWY2YjljNmQ2YjViYzIxNzFlZGY2ZDljZmMifQ.eyJpYXQiOjE2MjcwNDA4MzUsImV4cCI6MTE2MjcwNDA4MzR9.Q7SgiLgkz-2Lz1Lz1JDP-NN077e9eXkzTLmXSamOlbYi1ZSG8tCWjxyW590z9pk3u6UYhWOpoPBaCkGMsaf7b-gsJ6sOHFb5P3OItn3vijQ-1GhTsfgxwIebnomYnA4rLcvxC2Yq3gVt95aRLnPoVV3470tO-LlP_cYBbsMTeQ8I_Imk1r0-bvmb0rsOe9NgQth8kJKJ8tckeDZJnSCOznDGSox83tzadRRGGSqN18Iveh8YZMaHkHb_HZjKO8N21KJSHH1lOscr33EGiwoum6L09sIuERrojSI2gr7sYwEbcNig_ZK0NLzeByW-jv6FvickU0YHnGZICWerfdLinQ' \
-H 'Content-Type: application/json' \
-d '{
"url": "https://storage.googleapis.com/co-libry-services-colibry-images-dev/153cea2f-49c2-49ff-ab3c-d48a518a718e_3"
}'
```
First try:
```
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>ERROR: The request could not be satisfied</TITLE>
</HEAD><BODY>
<H1>504 ERROR</H1>
<H2>The request could not be satisfied.</H2>
<HR noshade size="1px">
CloudFront attempted to establish a connection with the origin, but either the attempt failed or the origin closed the connection.
We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
<BR clear="all">
If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.
<BR clear="all">
<HR noshade size="1px">
<PRE>
Generated by cloudfront (CloudFront)
Request ID: ftIAoWXMMSKHjvJpqCxPpWPY5msZUkYshCyqvAy1H8wz8rGf8Yo9-A==
</PRE>
<ADDRESS>
</ADDRESS>
</BODY></HTML>
```
Second try:
```
{
"customer": "stadim",
"cv_type": "room_classification",
"derived": {
"properties": [
"frontyard"
],
"url": "https://storage.googleapis.com/co-libry-services-colibry-images-dev/153cea2f-49c2-49ff-ab3c-d48a518a718e_3"
},
"id": "56a725de-049a-49c1-a37f-2e8374cb6934",
"timestamp": "Mon, 20 Sep 2021 09:06:57 GMT",
"url": "https://storage.googleapis.com/co-libry-services-colibry-images-dev/153cea2f-49c2-49ff-ab3c-d48a518a718e_3"
}
```
Test with bad url
CURL command
```
curl -X 'POST' \
'https://production-co-libry.appspot.com/api/0.4/predict/cv/room_classification?customer_id=8flK9Qr0&key=AIzaSyBMowzq6alBOzjIknplXVCGNyn3aBwEXkY' \
-H 'accept: application/json' \
-H 'Authorization: Bearer ${JWT}' \
-H 'Content-Type: application/json' \
-d '{
"url": "hallo"
}'
```
first try:
```
{
"message": "Could not execute cv prediction"
}
```
Test 10x request
code:
```
#!/bin/bash
for ((i = 0 ; i < 10 ; i++)); do
curl -X 'POST' \
'https://production-co-libry.appspot.com/api/0.4/predict/cv/room_classification?customer_id=8flK9Qr0&key=AIzaSyBMowzq6alBOzjIknplXVCGNyn3aBwEXkY' \
-H 'accept: application/json' \
-H 'Authorization: Bearer ${JWT} \
-H 'Content-Type: application/json' \
-d '{
"url": "https://storage.googleapis.com/co-libry-services-colibry-images-dev/153cea2f-49c2-49ff-ab3c-d48a518a718e_3"
}'
done
```
output:
```
{"customer": "stadim", "cv_type": "room_classification", "derived": {"properties": ["frontyard"], "url": "https://storage.googleapis.com/co-libry-services-colibry-images-dev/153cea2f-49c2-49ff-ab3c-d48a518a718e_3"}, "id": "ee98848e-1785-4979-93d3-60bd925f9968", "timestamp": "Mon, 20 Sep 2021 09:22:39 GMT", "url": "https://storage.googleapis.com/co-libry-services-colibry-images-dev/153cea2f-49c2-49ff-ab3c-d48a518a718e_3"}
{"customer": "stadim", "cv_type": "room_classification", "derived": {"properties": ["frontyard"], "url": "https://storage.googleapis.com/co-libry-services-colibry-images-dev/153cea2f-49c2-49ff-ab3c-d48a518a718e_3"}, "id": "26cd7327-1e92-414c-a9a2-c94a97d6aea0", "timestamp": "Mon, 20 Sep 2021 09:22:40 GMT", "url": "https://storage.googleapis.com/co-libry-services-colibry-images-dev/153cea2f-49c2-49ff-ab3c-d48a518a718e_3"}
{"customer": "stadim", "cv_type": "room_classification", "derived": {"properties": ["frontyard"], "url": "https://storage.googleapis.com/co-libry-services-colibry-images-dev/153cea2f-49c2-49ff-ab3c-d48a518a718e_3"}, "id": "1c30d430-27f7-44eb-ad61-c486f691bc10", "timestamp": "Mon, 20 Sep 2021 09:22:41 GMT", "url": "https://storage.googleapis.com/co-libry-services-colibry-images-dev/153cea2f-49c2-49ff-ab3c-d48a518a718e_3"}
{"customer": "stadim", "cv_type": "room_classification", "derived": {"properties": ["frontyard"], "url": "https://storage.googleapis.com/co-libry-services-colibry-images-dev/153cea2f-49c2-49ff-ab3c-d48a518a718e_3"}, "id": "a153e02d-e41c-4648-a7b4-c22622b50ee2", "timestamp": "Mon, 20 Sep 2021 09:22:42 GMT", "url": "https://storage.googleapis.com/co-libry-services-colibry-images-dev/153cea2f-49c2-49ff-ab3c-d48a518a718e_3"}
{"customer": "stadim", "cv_type": "room_classification", "derived": {"properties": ["frontyard"], "url": "https://storage.googleapis.com/co-libry-services-colibry-images-dev/153cea2f-49c2-49ff-ab3c-d48a518a718e_3"}, "id": "853b5af4-2c7f-41e4-93e1-5c549a908cbd", "timestamp": "Mon, 20 Sep 2021 09:22:42 GMT", "url": "https://storage.googleapis.com/co-libry-services-colibry-images-dev/153cea2f-49c2-49ff-ab3c-d48a518a718e_3"}
{"customer": "stadim", "cv_type": "room_classification", "derived": {"properties": ["frontyard"], "url": "https://storage.googleapis.com/co-libry-services-colibry-images-dev/153cea2f-49c2-49ff-ab3c-d48a518a718e_3"}, "id": "3c80f4dd-5bae-4abf-9eb6-c38033c05ed3", "timestamp": "Mon, 20 Sep 2021 09:22:43 GMT", "url": "https://storage.googleapis.com/co-libry-services-colibry-images-dev/153cea2f-49c2-49ff-ab3c-d48a518a718e_3"}
{"customer": "stadim", "cv_type": "room_classification", "derived": {"properties": ["frontyard"], "url": "https://storage.googleapis.com/co-libry-services-colibry-images-dev/153cea2f-49c2-49ff-ab3c-d48a518a718e_3"}, "id": "37417aef-44bd-4f7a-adc6-cf1e20106c10", "timestamp": "Mon, 20 Sep 2021 09:22:43 GMT", "url": "https://storage.googleapis.com/co-libry-services-colibry-images-dev/153cea2f-49c2-49ff-ab3c-d48a518a718e_3"}
{"customer": "stadim", "cv_type": "room_classification", "derived": {"properties": ["frontyard"], "url": "https://storage.googleapis.com/co-libry-services-colibry-images-dev/153cea2f-49c2-49ff-ab3c-d48a518a718e_3"}, "id": "f0b46e32-962c-4fc4-8203-2fea8e9690d1", "timestamp": "Mon, 20 Sep 2021 09:22:44 GMT", "url": "https://storage.googleapis.com/co-libry-services-colibry-images-dev/153cea2f-49c2-49ff-ab3c-d48a518a718e_3"}
{"customer": "stadim", "cv_type": "room_classification", "derived": {"properties": ["frontyard"], "url": "https://storage.googleapis.com/co-libry-services-colibry-images-dev/153cea2f-49c2-49ff-ab3c-d48a518a718e_3"}, "id": "03ed6d9f-9003-4ed5-8471-00b94e82b84d", "timestamp": "Mon, 20 Sep 2021 09:22:44 GMT", "url": "https://storage.googleapis.com/co-libry-services-colibry-images-dev/153cea2f-49c2-49ff-ab3c-d48a518a718e_3"}
{"customer": "stadim", "cv_type": "room_classification", "derived": {"properties": ["frontyard"], "url": "https://storage.googleapis.com/co-libry-services-colibry-images-dev/153cea2f-49c2-49ff-ab3c-d48a518a718e_3"}, "id": "4866ee31-f337-4048-86f0-3b3d351d1cac", "timestamp": "Mon, 20 Sep 2021 09:22:45 GMT", "url": "https://storage.googleapis.com/co-libry-services-colibry-images-dev/153cea2f-49c2-49ff-ab3c-d48a518a718e_3"}
```
## Quality assesment
Test with valid url
CURL command:
```
curl -X 'POST' \
'https://production-co-libry.appspot.com/api/0.4/predict/cv/quality_assessment?customer_id=8flK9Qr0&key=AIzaSyBMowzq6alBOzjIknplXVCGNyn3aBwEXkY' \
-H 'accept: application/json' \
-H 'Authorization: Bearer ${JWT} \
-H 'Content-Type: application/json' \
-d '{
"url": "https://storage.googleapis.com/co-libry-services-colibry-images-dev/153cea2f-49c2-49ff-ab3c-d48a518a718e_3"
}'
```
first try:
```
{
"customer": "stadim",
"cv_type": "quality_assessment",
"derived": [
{
"image_id": "8f989de5-d8f1-4d72-a54b-71ac01d4e31d",
"mean_score_prediction": 4.659303307533264
}
],
"id": "55eac188-9334-467e-b806-7d3327644e97",
"timestamp": "Mon, 20 Sep 2021 09:13:57 GMT",
"url": "https://storage.googleapis.com/co-libry-services-colibry-images-dev/153cea2f-49c2-49ff-ab3c-d48a518a718e_3"
}
```
Test with bad url
CURL command:
```
curl -X 'POST' \
'https://production-co-libry.appspot.com/api/0.4/predict/cv/quality_assessment?customer_id=8flK9Qr0&key=AIzaSyBMowzq6alBOzjIknplXVCGNyn3aBwEXkY' \
-H 'accept: application/json' \
-H 'Authorization: Bearer ${JWT}' \
-H 'Content-Type: application/json' \
-d '{
"url": "hallo"
}'
```
first try:
```
{
"message": "Could not execute cv prediction"
}
```