From b068c9144aea08eb24a48d4cb2e8bfa40f2e58cb Mon Sep 17 00:00:00 2001 From: Marco Zeisler Date: Thu, 17 Jun 2021 21:20:26 +0200 Subject: [PATCH] added mocks for testing --- .../shared/dse_shared_libs/mock/__init__.py | 0 .../shared/dse_shared_libs/mock/datetime.py | 11 +++++ .../dse_shared_libs/mock/rabbit_mq_mocks.py | 43 +++++++++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 components/shared/dse_shared_libs/mock/__init__.py create mode 100644 components/shared/dse_shared_libs/mock/datetime.py create mode 100644 components/shared/dse_shared_libs/mock/rabbit_mq_mocks.py diff --git a/components/shared/dse_shared_libs/mock/__init__.py b/components/shared/dse_shared_libs/mock/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/components/shared/dse_shared_libs/mock/datetime.py b/components/shared/dse_shared_libs/mock/datetime.py new file mode 100644 index 0000000..e7b40ec --- /dev/null +++ b/components/shared/dse_shared_libs/mock/datetime.py @@ -0,0 +1,11 @@ +class MyDate: + timestamp = None + + @classmethod + def set_timestamp(cls, timestamp): + cls.timestamp = timestamp + + @classmethod + def now(cls): + return cls.timestamp + diff --git a/components/shared/dse_shared_libs/mock/rabbit_mq_mocks.py b/components/shared/dse_shared_libs/mock/rabbit_mq_mocks.py new file mode 100644 index 0000000..a6a551d --- /dev/null +++ b/components/shared/dse_shared_libs/mock/rabbit_mq_mocks.py @@ -0,0 +1,43 @@ +class MyQueue: + @property + def queue(self): + return None + + +class MyMethod: + method = MyQueue() + + +class MyChannel: + @staticmethod + def exchange_declare(*args, **kwargs): + return None + + @staticmethod + def queue_declare(*args, **kwargs): + return MyMethod + + @staticmethod + def queue_bind(*args, **kwargs): + return None + + @staticmethod + def basic_consume(*args, **kwargs): + return None + + @staticmethod + def basic_publish(*args, **kwargs): + return None + + @staticmethod + def start_consuming(*args, **kwargs): + return None + + +class MyBlockingConnection: + def __init__(self, *args, **kwargs): + ... + + @staticmethod + def channel(): + return MyChannel()