SIENTIAPDE-1193
Enhance timestamp handling in Redis and CoreScouter workflows by updating to DATETIME_FORMAT_MS_WITH_TZ. Modify tests to reflect new timestamp format, ensuring consistency across data structures and improving overall datetime management.
This commit is contained in:
@@ -96,7 +96,7 @@ async def test_load_latest_data_none_last_data_timestamp(mongodb_activity):
|
||||
'name': 'test1',
|
||||
'value': 1,
|
||||
'inserted_at': datetime.strptime(
|
||||
'2023-01-01 12:00:00.000000', DATETIME_FORMAT_MS_WITH_TZ)
|
||||
'2023-01-01 12:00:00.000000+0000', DATETIME_FORMAT_MS_WITH_TZ)
|
||||
}
|
||||
]
|
||||
|
||||
@@ -122,7 +122,7 @@ async def test_load_latest_data_none_last_data_timestamp(mongodb_activity):
|
||||
0: 1
|
||||
},
|
||||
'inserted_at': {
|
||||
0: '2023-01-01 12:00:00.000000'
|
||||
0: '2023-01-01 12:00:00.000000+0000'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,14 +138,14 @@ async def test_load_latest_data_not_none_last_data_timestamp(mongodb_activity):
|
||||
'name': 'test1',
|
||||
'value': 1,
|
||||
'inserted_at': datetime.strptime(
|
||||
'2023-01-01 12:00:00.000000', DATETIME_FORMAT_MS_WITH_TZ)
|
||||
'2023-01-01 12:00:00.000000+0000', DATETIME_FORMAT_MS_WITH_TZ)
|
||||
}
|
||||
]
|
||||
|
||||
result = await mongodb_activity.load_latest_data({
|
||||
'metadata': {'workflow_name': 'test_pipeline', 'schedule_name': 'test_schedule'},
|
||||
'collection_name': 'test_collection',
|
||||
'last_data_timestamp': '2023-01-01 12:00:00.000000'
|
||||
'last_data_timestamp': '2023-01-01 12:00:00.000000+0000'
|
||||
})
|
||||
|
||||
mongodb_activity.database.__getitem__.assert_called_once_with(
|
||||
@@ -155,7 +155,7 @@ async def test_load_latest_data_not_none_last_data_timestamp(mongodb_activity):
|
||||
{
|
||||
'inserted_at': {
|
||||
'$gt': datetime.strptime(
|
||||
'2023-01-01 12:00:00.000000', DATETIME_FORMAT_MS_WITH_TZ)
|
||||
'2023-01-01 12:00:00.000000+0000', DATETIME_FORMAT_MS_WITH_TZ)
|
||||
}
|
||||
},
|
||||
{"_id": 0}
|
||||
@@ -169,7 +169,7 @@ async def test_load_latest_data_not_none_last_data_timestamp(mongodb_activity):
|
||||
0: 1
|
||||
},
|
||||
'inserted_at': {
|
||||
0: '2023-01-01 12:00:00.000000'
|
||||
0: '2023-01-01 12:00:00.000000+0000'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ async def test_load_latest_data_error(mongodb_activity):
|
||||
await mongodb_activity.load_latest_data({
|
||||
'metadata': {'workflow_name': 'test_pipeline', 'schedule_name': 'test_schedule'},
|
||||
'collection_name': 'test_collection',
|
||||
'last_data_timestamp': '2023-01-01 12:00:00.000000'
|
||||
'last_data_timestamp': '2023-01-01 12:00:00.000000+0000'
|
||||
})
|
||||
except Exception as e:
|
||||
assert str(e) == 'test'
|
||||
|
||||
Reference in New Issue
Block a user