added unittest for seeding api

added get_material_deliveries to seeding api
started working on de api test
This commit is contained in:
DuSack1220 2022-10-01 17:37:24 +02:00
parent 6946ce9957
commit c325a2c7c2
2 changed files with 38 additions and 6 deletions

View file

@ -17,6 +17,7 @@ if api_override != "":
API_URL_GET_HEU = API_URL + "getHeuballen"
API_URL_GET_LOGISTIC_PLAN = API_URL + "getLogisticPlan"
API_URL_GET_MATERIAL_DELIVERIES = API_URL + "getMaterialDeliveries"
API_URL_GET_ROBOT_STATE = API_URL + "getRobotState"
@ -25,19 +26,19 @@ class Seeding:
"""
@staticmethod
def get_heu() -> Tuple[Dict, int]:
def get_heuballen() -> int:
"""Makes the /api/getHeuballen call to the api.
:return: Json Object and status code as returned by the api.
:rtype: Tuple[Dict, int]
:return: hueballencode as int.
:rtype: int
"""
res = requests.get(API_URL_GET_HEU)
result = json.loads(res.content)
logger.debug(f"Seeding.get_heu = {result}, status code = {res.status_code}")
return result
logger.debug(f"Seeding.get_heuballen = {result}, status code = {res.status_code}")
return result["heuballen"]
@staticmethod
def get_logistic_plan() -> Tuple[Dict, int]:
def get_logistic_plan() -> List:
"""Makes the /api/getLogisticPlan call to the api.
:return: Json Object and status code as returned by the api.
@ -48,6 +49,18 @@ class Seeding:
logger.debug(f"Seeding.get_logistic_plan = {result}, status code = {res.status_code}")
return result
@staticmethod
def get_material_deliveries() -> List:
"""Makes the /api/getMaterialDeliveries call to the api.
:return: Json Object and status code as returned by the api.
:rtype: List
"""
res = requests.get(API_URL_GET_LOGISTIC_PLAN)
result = json.loads(res.content)
logger.debug(f"Seeding.get_material_deliveries = {result}, status code = {res.status_code}")
return result
@staticmethod
def get_robot_state() -> Tuple[Dict, int]:
res = requests.get(API_URL_GET_ROBOT_STATE)