Commit 552781bf authored by Stavros-Anastasios Charismiadis's avatar Stavros-Anastasios Charismiadis
Browse files

Fix bugs in Events API. All tests succeed

parent fd5925bd
Loading
Loading
Loading
Loading
Loading
+7 −12
Original line number Diff line number Diff line
@@ -10,36 +10,31 @@ def clean_empty(d):
        return {
            k: v
            for k, v in ((k, clean_empty(v)) for k, v in d.items())
            if v
            if v is not None or v == 0
        }
    if isinstance(d, list):
        return [v for v in map(clean_empty, d) if v]
        return [v for v in map(clean_empty, d) if v is not None or v == 0]
    return d


def dict_to_camel_case(my_dict):


        result = {}

        for attr, value in my_dict.items():

            if len(attr.split('_')) != 1:
                my_key = ''.join(word.title() for word in attr.split('_'))
                my_key= ''.join([my_key[0].lower(), my_key[1:]])

            else:
                my_key = attr
            if isinstance(value, list):
                result[my_key] = list(map(
                    lambda x: dict_to_camel_case(x) if isinstance(x, dict) else x, value ))

            elif hasattr(value, "to_dict"):
                result[my_key] = dict_to_camel_case(value)

            elif isinstance(value, dict):
                value = dict_to_camel_case(value)
                result[my_key] = value
            else:
                result[my_key] = value

        return result


+1 −1
Original line number Diff line number Diff line
@@ -99,7 +99,7 @@ class LoggingInvocationOperations(Resource):
                    current_app.logger.info(event)
                    invocation_log_base['logs']=[log.to_dict()]
                    invocationLogs=[invocation_log_base]
                    RedisEvent(event,"invocationLogs",invocationLogs).send_event()
                    RedisEvent(event,"invocation_logs",invocationLogs).send_event()

            current_app.logger.debug("After log check")