Skip to content

Commit f0c76f3

Browse files
committed
feat: enum as a query
1 parent 2aa15eb commit f0c76f3

13 files changed

Lines changed: 221 additions & 75 deletions

File tree

‎Tests.py‎

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
from python_helper import TestHelper
2-
# TestHelper.run(__file__)
3-
TestHelper.run(
4-
__file__,
5-
runOnly = [
6-
# 'EnumAnnotationTest.enum_withSuccess',
7-
# 'EnumAnnotationTest.otherEnum_withSuccess',
8-
# 'EnumAnnotationTest.python_framework_status',
9-
# 'EnumAnnotationTest.enumName',
10-
# 'EnumAnnotationTest.enumName_badImplementation',
11-
# 'EnumAnnotationTest.map_whenArgIsNone',
12-
# 'EnumAnnotationTest.Enum_whenHaveMoreThanOneInnerValue',
13-
# 'EnumAnnotationTest.Enum_dot_map',
14-
'EnumAnnotationTest.Enum_str'
15-
]
16-
)
2+
TestHelper.run(__file__)
3+
174
# TestHelper.run(
185
# __file__,
196
# runOnly = [
20-
# 'TestApiTest.appRun_withSuccess'
7+
# 'TestApiTest.appRun_whenEnvironmentIsLocalFromLocalConfig_withSuccess_1'
8+
# ]
9+
# )
10+
# TestHelper.run(
11+
# __file__,
12+
# runOnly = [
13+
# 'EnumAnnotationTest.enum_withSuccess',
14+
# 'EnumAnnotationTest.otherEnum_withSuccess',
15+
# 'EnumAnnotationTest.python_framework_status',
16+
# 'EnumAnnotationTest.enumName',
17+
# 'EnumAnnotationTest.enumName_badImplementation',
18+
# 'EnumAnnotationTest.map_whenArgIsNone',
19+
# 'EnumAnnotationTest.Enum_whenHaveMoreThanOneInnerValue',
20+
# 'EnumAnnotationTest.Enum_dot_map',
21+
# 'EnumAnnotationTest.Enum_str',
22+
# 'EnumAnnotationTest.Enum_strInOutput'
2123
# ]
2224
# )
2325
# TestHelper.run(

‎python_framework/api/src/annotation/EnumAnnotation.py‎

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,12 @@ def isEnumItem(possibleEnumItem) :
9393
log.error(isEnumItem, f'Not possible to evaluate. Returning {itIs} by default', exception)
9494
return itIs
9595

96-
def Enum(instanceLog=False, associateReturnsTo = ENUM_VALUE_AS_STRING_KEY) :
96+
def Enum(instanceLog=False, associateReturnsTo=ENUM_VALUE_AS_STRING_KEY) :
9797
def Wrapper(OuterEnum, *args, **kwargs):
9898
def __raiseBadImplementation__(enumValue, enum=None) :
9999
raise Exception(f'Not possible to implement "{enumValue}" enum value in {enum} enum')
100100
def __raiseEnumValueNotImplemented__(enumValue, enumClass=None, enumEqList=None, enumMap=None) :
101-
raise Exception(f'Not possible to retrieve "{enumValue}" enum value from {ReflectionHelper.getName(enumClass)}: {enumEqList} enum. Enum.__enumMap__ = {enumMap}')
101+
raise Exception(f'Not possible to retrieve "{enumValue}" of type: {type(enumValue)} enum value from {ReflectionHelper.getName(enumClass)}: {enumEqList} enum. Enum.__enumMap__ = {enumMap}')
102102
if instanceLog :
103103
log.log(Enum,f'''wrapping {OuterEnum.__name__}''')
104104
class InnerEnum(OuterEnum, EnumClass):
@@ -123,11 +123,17 @@ def __init__(self,*args,**kwargs):
123123
# print(f'type({attribute}): {type(attribute)}')
124124
association = ReflectionHelper.getAttributeOrMethod(attribute, self.__associateReturnsTo__, muteLogs=True)
125125
if type(association) is type(None) :
126+
# print('type(association) is type(None)')
126127
ReflectionHelper.setAttributeOrMethod(attribute, ENUM_VALUE_AS_STRING_KEY, ENUM_ITEM_CLASS_DICTIONARY.get(type(enumValue))(enumValue))
127128
nativeClassDataList = ReflectionHelper.getAttributeDataList(type(enumValue)())
129+
# print(f'type({enumValue}): {type(enumValue)}, type({type(enumValue)}()): {type(type(enumValue)())}')
128130
else :
131+
# print('not type(association) is type(None)')
129132
ReflectionHelper.setAttributeOrMethod(attribute, ENUM_VALUE_AS_STRING_KEY, ENUM_ITEM_CLASS_DICTIONARY.get(type(association))(association))
130133
nativeClassDataList = ReflectionHelper.getAttributeDataList(type(association)())
134+
# print(f'type({association}): {type(association)}, type({type(association)}()): {type(type(association)())}')
135+
# print()
136+
attribute.enumValue.enumName = enumValue
131137
ReflectionHelper.setAttributeOrMethod(attribute, ENUM_NAME_AS_STRING_KEY, enumValue)
132138
if isinstance(attribute, EnumItem) :
133139
# print(attribute, attribute.enumName, attribute)
@@ -148,10 +154,12 @@ def __init__(self,*args,**kwargs):
148154
ReflectionHelper.setAttributeOrMethod(attribute.enumValue, ENUM_AS_STRING_KEY, self)
149155
if ObjectHelper.isEmpty(OuterEnum.__enumEqList__) :
150156
for attribute, value in attributeDataList :
151-
if str(attribute.enumValue) not in ENUM_STATIC_METHOD_NAME_LIST :
152-
valueAsString = str(attribute.enumValue)
157+
# print(f'type({value}): {type(value)}')
158+
# print(f'type({attribute}): {type(attribute)}')
159+
valueAsString = str(attribute.enumValue)
160+
if valueAsString not in ENUM_STATIC_METHOD_NAME_LIST :
153161
if valueAsString not in self.__enumMap__ :
154-
self.__enumMap__[valueAsString] = attribute
162+
self.__enumMap__[valueAsString] = attribute.enumValue ###- ReflectionHelper.getAttributeOrMethod(attribute, valueAsString, muteLogs=True) ###- attribute
155163
else :
156164
__raiseBadImplementation__(valueAsString, enum=self)
157165
if value not in self.__enumMap__ :
@@ -179,8 +187,12 @@ def map(enumItemOrEnumItemValue) :
179187
if ObjectHelper.isNone(enumItemOrEnumItemValue) :
180188
return enumItemOrEnumItemValue
181189
else :
190+
# try :
191+
# print(f'''not ReflectionHelper.hasAttributeOrMethod({enumItemOrEnumItemValue}, 'enumName') --> {str(enumItemOrEnumItemValue)}''')
192+
# except :
193+
# print(f'''ReflectionHelper.hasAttributeOrMethod({enumItemOrEnumItemValue}, 'enumName') --> {enumItemOrEnumItemValue.enumName}''')
182194
mappedEnum = OuterEnum.__enumMap__.get(str(enumItemOrEnumItemValue) if not ReflectionHelper.hasAttributeOrMethod(enumItemOrEnumItemValue, 'enumName') else enumItemOrEnumItemValue.enumName)
183-
return mappedEnum if ObjectHelper.isNotNone(mappedEnum) else __raiseEnumValueNotImplemented__(enumItemOrEnumItemValue, enumClass=OuterEnum, enumEqList=OuterEnum().__enumEqList__, enumMap=OuterEnum().__enumMap__)
195+
return mappedEnum if ObjectHelper.isNotNone(mappedEnum) else __raiseEnumValueNotImplemented__(enumItemOrEnumItemValue, enumClass=OuterEnum, enumEqList=OuterEnum.__enumEqList__, enumMap=OuterEnum.__enumMap__)
184196
ReflectionHelper.overrideSignatures(InnerEnum, OuterEnum)
185197
return InnerEnum
186198
return Wrapper

‎python_framework/api/src/enumeration/HttpStatus.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class HttpStatusEnumeration() :
3535
BAD_REQUEST = EnumItem(value = 400)
3636
UNAUTHORIZED = EnumItem(value = 401)
3737
REQUIRED = EnumItem(value = 402)
38-
FORBIDEN = EnumItem(value = 403)
38+
FORBIDDEN = EnumItem(value = 403)
3939
NOT_FOUND = EnumItem(value = 404)
4040
METHOD_NOT_ALLOWED = EnumItem(value = 405)
4141
NOT_ACCEPTABLE = EnumItem(value = 406)

‎python_framework/api/test/TestApiTest.py‎

Lines changed: 72 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import subprocess, psutil
88

99
CURRENT_PATH = str(Path(__file__).parent.absolute())
10-
ESTIMATED_BUILD_TIME_IN_SECONDS = 5
10+
ESTIMATED_BUILD_TIME_IN_SECONDS = 4
1111

1212
def killProcesses(givenProcess) :
1313
try :
@@ -79,13 +79,15 @@ def getProcess(command, path, muteLogs=False) :
7979
TEST_CONTROLLER = '/test-controller'
8080
TEST_BATCH_CONTROLLER = f'{TEST_CONTROLLER}/batch'
8181

82+
GET_ACTUATOR_HEALTH_CONTROLLER_TEST = '/test/actuator/health'
83+
8284
GET_NONE_ONE = f'{TEST_CONTROLLER}/all-fine-if-its-none'
8385
POST_PAYLOAD_ONE = f'{TEST_CONTROLLER}/payload-validation-test'
8486
GET_NONE_ONE_BATCH = f'{TEST_BATCH_CONTROLLER}/all-fine-if-its-none'
8587
POST_PAYLOAD_ONE_BATCH = f'{TEST_BATCH_CONTROLLER}/payload-validation-test'
8688

8789
@Test()
88-
def appRun_whenEnvironmentIsLocalFromLocalConfig_withSuccess() :
90+
def appRun_whenEnvironmentIsLocalFromLocalConfig_withSuccess_0() :
8991
# arrange
9092
muteLogs = False
9193
serverPort = 5001
@@ -171,24 +173,45 @@ def appRun_whenEnvironmentIsLocalFromLocalConfig_withSuccess() :
171173
)
172174
assert 400 == responsePostSendPayloadListBatch.status_code
173175

176+
killProcesses(process)
177+
178+
@Test()
179+
def appRun_whenEnvironmentIsLocalFromLocalConfig_withSuccess_1() :
180+
# arrange
181+
muteLogs = False
182+
serverPort = 5002
183+
process = getProcess(
184+
f'flask run --host=localhost --port={serverPort}',
185+
f'{CURRENT_PATH}{EnvironmentHelper.OS_SEPARATOR}apitests{EnvironmentHelper.OS_SEPARATOR}testone',
186+
muteLogs = muteLogs
187+
)
188+
BASE_URL = f'http://localhost:{serverPort}/local-test-api'
189+
time.sleep(ESTIMATED_BUILD_TIME_IN_SECONDS)
190+
191+
# act
192+
responseGetHealth = requests.post(BASE_URL + GET_ACTUATOR_HEALTH_CONTROLLER_TEST, json={'status': 'UP'})
193+
194+
# assert
195+
assert ObjectHelper.equals(
196+
[{'status':'UP'}],
197+
responseGetHealth.json()
198+
)
199+
assert 200 == responseGetHealth.status_code
174200

175201
killProcesses(process)
176202

177-
# @Test(
178-
# environmentVariables={
179-
# SettingHelper.ACTIVE_ENVIRONMENT: 'dev'
180-
# }
181-
# )
182-
# def appRun_whenEnvironmentIsDev_withSuccess() :
203+
204+
# @Test()
205+
# def appRun_whenEnvironmentIsLocalFromLocalConfig_withSuccess_2() :
183206
# # arrange
184207
# muteLogs = False
185-
# serverPort = 5002
208+
# serverPort = 5003
186209
# process = getProcess(
187210
# f'flask run --host=localhost --port={serverPort}',
188211
# f'{CURRENT_PATH}{EnvironmentHelper.OS_SEPARATOR}apitests{EnvironmentHelper.OS_SEPARATOR}testone',
189212
# muteLogs = muteLogs
190213
# )
191-
# BASE_URL = f'http://localhost:{serverPort}/dev-test-api'
214+
# BASE_URL = f'http://localhost:{serverPort}/local-test-api'
192215
# payload = {'me':'and you'}
193216
# payloadList = [payload]
194217
# time.sleep(ESTIMATED_BUILD_TIME_IN_SECONDS)
@@ -210,42 +233,47 @@ def appRun_whenEnvironmentIsLocalFromLocalConfig_withSuccess() :
210233
# responseGetHealth.json()
211234
# )
212235
# assert 200 == responseGetHealth.status_code
213-
# killProcesses(process)
214236
#
215-
# @Test(
216-
# environmentVariables={
217-
# SettingHelper.ACTIVE_ENVIRONMENT: 'prod'
218-
# }
219-
# )
220-
# def appRun_whenEnvironmentIsProd_withSuccess() :
221-
# # arrange
222-
# muteLogs = False
223-
# serverPort = 5003
224-
# process = getProcess(
225-
# f'flask run --host=localhost --port={serverPort}',
226-
# f'{CURRENT_PATH}{EnvironmentHelper.OS_SEPARATOR}apitests{EnvironmentHelper.OS_SEPARATOR}testone',
227-
# muteLogs = muteLogs
237+
# {'message': 'OK'}
238+
# {'message': 'Something bad happened. Please, try again later', 'timestamp': '2021-03-18 21:43:47.299735'}
239+
# {'message': 'Bad request', 'timestamp': '2021-03-18 21:43:47.405736'}
240+
# {'me': 'and you'}
241+
# {'message': 'Something bad happened. Please, try again later', 'timestamp': '2021-03-18 21:43:47.636759'}
242+
# {'message': 'Bad request', 'timestamp': '2021-03-18 21:43:47.767735'}
243+
# assert ObjectHelper.equals(
244+
# {'message': 'OK'},
245+
# responseGetNone.json()
228246
# )
229-
# BASE_URL = f'http://localhost:{serverPort}/test-api'
230-
# payload = {'me':'and you'}
231-
# payloadList = [payload]
232-
# time.sleep(ESTIMATED_BUILD_TIME_IN_SECONDS)
233-
#
234-
# # act
235-
# responseGetHealth = requests.get(BASE_URL + GET_ACTUATOR_HEALTH_CONTROLLER)
236-
#
237-
# responseGetNone = requests.get(BASE_URL + GET_NONE_ONE)
238-
# responseGetNoneBatch = requests.post(BASE_URL + GET_NONE_ONE_BATCH, json=payload)
239-
#
240-
# responsePostSendPayload = requests.post(BASE_URL + POST_PAYLOAD_ONE, json=payload)
241-
# responsePostSendPayloadList = requests.post(BASE_URL + POST_PAYLOAD_ONE, json=payloadList)
242-
# responsePostSendPayloadBatch = requests.post(BASE_URL + POST_PAYLOAD_ONE_BATCH, json=payload)
243-
# responsePostSendPayloadListBatch = requests.post(BASE_URL + POST_PAYLOAD_ONE_BATCH, json=payloadList)
244-
#
245-
# # assert
247+
# assert 200 == responseGetNone.status_code
246248
# assert ObjectHelper.equals(
247-
# {'status':'UP'},
248-
# responseGetHealth.json()
249+
# {'message': 'Something bad happened. Please, try again later', 'timestamp': '2021-03-18 21:43:47.299735'},
250+
# responseGetNoneBatch.json(),
251+
# ignoreKeyList=['timestamp']
249252
# )
250-
# assert 200 == responseGetHealth.status_code
253+
# assert 500 == responseGetNoneBatch.status_code
254+
# assert ObjectHelper.equals(
255+
# {'message': 'Bad request', 'timestamp': '2021-03-18 21:43:47.405736'},
256+
# responsePostSendPayload.json(),
257+
# ignoreKeyList=['timestamp']
258+
# )
259+
# assert 400 == responsePostSendPayload.status_code
260+
# assert ObjectHelper.equals(
261+
# {'message': 'Something bad happened. Please, try again later', 'timestamp': '2021-03-19 08:36:20.925177'},
262+
# responsePostSendPayloadList.json(),
263+
# ignoreKeyList=['timestamp']
264+
# )
265+
# assert 500 == responsePostSendPayloadList.status_code
266+
# assert ObjectHelper.equals(
267+
# {'message': 'Something bad happened. Please, try again later', 'timestamp': '2021-03-18 21:43:47.636759'},
268+
# responsePostSendPayloadBatch.json(),
269+
# ignoreKeyList=['timestamp']
270+
# )
271+
# assert 500 == responsePostSendPayloadBatch.status_code
272+
# assert ObjectHelper.equals(
273+
# {'message': 'Bad request', 'timestamp': '2021-03-18 21:43:47.767735'},
274+
# responsePostSendPayloadListBatch.json(),
275+
# ignoreKeyList=['timestamp']
276+
# )
277+
# assert 400 == responsePostSendPayloadListBatch.status_code
278+
#
251279
# killProcesses(process)

‎python_framework/api/test/api/src/annotation/EnumAnnotationTest.py‎

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -369,10 +369,10 @@ class MyEnumTest :
369369
thirdTestExteption = e
370370

371371
# assert
372-
print(str(firstTestExteption))
373-
print(str(secondTestExteption))
372+
# print(str(firstTestExteption))
373+
# print(str(secondTestExteption))
374374
assert '''Not possible to implement "ONE" enum value in MyEnumTest: ['ONE(value:ONE)'] enum''' == str(firstTestExteption)
375-
assert '''Not possible to retrieve "another" enum value from MyOtherEnumTest: ['ONE(value:ONE)', 'TWO(value:TWO)'] enum. Enum.__enumMap__ = {'ONE': ONE, 'TWO': TWO}''' == str(secondTestExteption)
375+
assert '''Not possible to retrieve "another" of type: <class 'str'> enum value from MyOtherEnumTest: ['ONE(value:ONE)', 'TWO(value:TWO)'] enum. Enum.__enumMap__ = {'ONE': 'ONE', 'TWO': 'TWO'}''' == str(secondTestExteption)
376376
assert "'EnumItem' object has no attribute 'enumValue'" == str(thirdTestExteption)
377377

378378
@Test(environmentVariables={
@@ -545,6 +545,9 @@ class MyThirdEnumTest :
545545
assert 'ABC' == str(SIMPLE_ENUM.map(SIMPLE_ENUM.map('ABC')))
546546
assert 'ABC' == str(SIMPLE_ENUM.map(SIMPLE_ENUM.ABC))
547547
assert 'None' == str(SIMPLE_ENUM.map(SIMPLE_ENUM.map(None)))
548+
assert shouldBe_DEF == shouldBe_DEF_asWell
549+
assert not shouldBe_DEF == shouldBe_None
550+
assert not shouldBe_None == shouldBe_DEF_asWell
548551

549552
assert 'ONE' == str(MY_ENUM_TEST.ONE)
550553
assert 'TWO' == str(MY_ENUM_TEST.TWO)
@@ -566,3 +569,41 @@ class MyThirdEnumTest :
566569
assert str(4) == str(MY_THIRD_ENUM_TEST.map(MY_THIRD_ENUM_TEST.map(4)))
567570
assert str(3) == str(MY_THIRD_ENUM_TEST.map('THREE'))
568571
assert str(4) == str(MY_THIRD_ENUM_TEST.map(MY_THIRD_ENUM_TEST.map('FOUR')))
572+
573+
@Test(environmentVariables={
574+
SettingHelper.ACTIVE_ENVIRONMENT : SettingHelper.LOCAL_ENVIRONMENT,
575+
**FULL_LOG_HELPER_SETTINGS
576+
}
577+
)
578+
def Enum_strInOutput() :
579+
# arrange
580+
@Enum(instanceLog=False)
581+
class SimpleEnum :
582+
ABC = EnumItem()
583+
DEF = EnumItem()
584+
SIMPLE_ENUM = SimpleEnum()
585+
@Enum(instanceLog=False)
586+
class MyEnumTest :
587+
ONE = EnumItem(value='one', otherValue=1)
588+
TWO = EnumItem(value='two', otherValue=2)
589+
MY_ENUM_TEST = MyEnumTest()
590+
@Enum(associateReturnsTo='otherValue', instanceLog=False)
591+
class MyThirdEnumTest :
592+
THREE = EnumItem(value='three', otherValue=3)
593+
FOUR = EnumItem(value='four', otherValue=4)
594+
MY_THIRD_ENUM_TEST = MyThirdEnumTest()
595+
596+
# act and assert
597+
assert f'''{[SIMPLE_ENUM.map('DEF')]}''' == "['DEF']"
598+
assert str(type(SIMPLE_ENUM.map('DEF'))) == '''<class 'python_framework.api.src.annotation.EnumAnnotation.EnumItemStr'>'''
599+
assert f'''{[SIMPLE_ENUM.map(SIMPLE_ENUM.DEF)]}''' == "['DEF']"
600+
assert str(type(SIMPLE_ENUM.map(SIMPLE_ENUM.DEF))) == '''<class 'python_framework.api.src.annotation.EnumAnnotation.EnumItemStr'>'''
601+
a = [SIMPLE_ENUM.map('DEF')]
602+
b = [SIMPLE_ENUM.map(SIMPLE_ENUM.DEF)]
603+
assert f'''{a}''' == "['DEF']"
604+
assert str(type(a[0])) == '''<class 'python_framework.api.src.annotation.EnumAnnotation.EnumItemStr'>'''
605+
assert f'''{b}''' == "['DEF']"
606+
assert str(type(b[0])) == '''<class 'python_framework.api.src.annotation.EnumAnnotation.EnumItemStr'>'''
607+
608+
print(MY_THIRD_ENUM_TEST)
609+
print(type(MY_THIRD_ENUM_TEST))
16 KB
Binary file not shown.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from python_framework.api.src.enumeration.HttpStatus import HttpStatus
2+
from python_framework.api.src.service.flask.FlaskManager import Controller, ControllerMethod
3+
from python_framework.api.src.dto import ActuatorHealthDto
4+
5+
import EnumAsQueryDto
6+
7+
@Controller(url='/test/actuator/health', tag='HealthCheckTest', description='HealthCheck controller test')
8+
class ActuatorHealthTestController:
9+
10+
@ControllerMethod(
11+
requestClass=EnumAsQueryDto.EnumAsQueryRequestDto,
12+
# requestClass=[dict],
13+
responseClass=[[ActuatorHealthDto.ActuatorHealthResponseDto]],
14+
logResponse=True
15+
)
16+
def post(self, dto):
17+
# HttpStatus.map(dto['status'])
18+
# EnumAsQueryDto.EnumAsQueryRequestDto(HttpStatus.map(dto['status']))
19+
return self.service.status.findAllByStatus(dto), HttpStatus.OK
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from python_framework.api.src.service.flask.FlaskManager import Converter, ConverterMethod
2+
from python_framework.api.src.model import ActuatorHealth
3+
from python_framework.api.src.dto import ActuatorHealthDto
4+
5+
@Converter()
6+
class ActuatorHealthTestConverter:
7+
8+
@ConverterMethod(
9+
requestClass=[[ActuatorHealth.ActuatorHealth]],
10+
responseClass=[[ActuatorHealthDto.ActuatorHealthResponseDto]]
11+
)
12+
def fromModelListToResponseDtoList(self, modelList, dtoList) :
13+
return dtoList
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from python_framework.api.src.enumeration.ActuatorHealthStatus import ActuatorHealthStatus
2+
3+
class EnumAsQueryRequestDto:
4+
def __init__(self,
5+
status = None
6+
):
7+
self.status = ActuatorHealthStatus.map(status)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from python_helper import ObjectHelper
2+
from python_framework.api.src.service.flask.FlaskManager import Repository
3+
from python_framework.api.src.model import ActuatorHealth
4+
5+
@Repository(model = ActuatorHealth.ActuatorHealth)
6+
class ActuatorHealthTestRepository:
7+
8+
def findAllByStatus(self, status) :
9+
modelList = []
10+
if ObjectHelper.isNotNone(status) :
11+
modelList = self.repository.session.query(self.model).filter(self.model.status == status).all()
12+
self.repository.session.commit()
13+
return modelList

0 commit comments

Comments
 (0)