uranusjr commented on a change in pull request #18973:
URL: https://github.com/apache/airflow/pull/18973#discussion_r735295257
##########
File path: tests/api_connexion/schemas/test_xcom_schema.py
##########
@@ -29,169 +29,165 @@
from airflow.utils.session import create_session, provide_session
+class MockXcomCollectionItem:
+ DEFAULT_TIME = '2005-04-02T21:00:00+00:00'
+ DEFAULT_TIME_PARSED = parse_execution_date(DEFAULT_TIME)
+
+ def __init__(self):
+ self.example_ref = uuid.uuid4()
+ self.key: str = f'test_key_{self.example_ref}'
+ self.timestamp: datetime.datetime = self.DEFAULT_TIME_PARSED
+ self.execution_date: datetime.datetime = self.DEFAULT_TIME_PARSED
+ self.task_id = f'test_task_id_{self.example_ref}'
+ self.dag_id = f'test_dag_{self.example_ref}'
+
+ @property
+ def as_xcom(self):
+ return XCom(
+ key=self.key,
+ timestamp=self.timestamp,
+ execution_date=self.execution_date,
+ task_id=self.task_id,
+ dag_id=self.dag_id,
+ )
+
+ @property
+ def deserialized_xcom(self):
+ return {
+ 'key': self.key,
+ 'timestamp': self.DEFAULT_TIME,
+ 'execution_date': self.DEFAULT_TIME,
+ 'task_id': self.task_id,
+ 'dag_id': self.dag_id,
+ }
+
+ @property
+ def from_dump_xcom(self):
Review comment:
Not sure, partly because I find the whole MockXcom thing confusing. It
feels like we are turning those tests just checking if these mocks are
implemented correctly, rather than testing the actualy xcom functionalities.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]