Skip to content

Commit

Permalink
match timestamp format in test
Browse files Browse the repository at this point in the history
  • Loading branch information
danielfromearth committed Nov 8, 2024
1 parent ac968de commit 522262f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/test_harmony.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from datetime import datetime
import json
from shutil import rmtree
import sys
Expand All @@ -6,7 +7,7 @@
from unittest.mock import patch
from os import environ
from pathlib import Path
from urllib.parse import urlsplit, unquote
from urllib.parse import urlsplit

from netCDF4 import Dataset
import pytest
Expand Down Expand Up @@ -75,14 +76,13 @@ def test_service_invoke(self):
self.assertEqual(item['bbox'], [-4, -3, 4, 3])
self.assertEqual(properties['start_datetime'], '2020-01-01T00:00:00+00:00')
self.assertEqual(properties['end_datetime'], '2020-01-05T23:59:59+00:00')

# -- Asset Verification --
data = item['assets']['data']
collection_name = in_message['sources'][0]['collection']

# Sanity checks on metadata
self.assertTrue(data['href'].endswith(f"{properties['end_datetime']}_{collection_name}_merged.nc4"))
self.assertTrue(data['title'].endswith(f"{properties['end_datetime']}_{collection_name}_merged.nc4"))
self.assertTrue(data['href'].endswith(f"{datetime.fromisoformat(properties['end_datetime']).strftime("%Y%m%dT%H%M%SZ")}_{collection_name}_merged.nc4"))
self.assertTrue(data['title'].endswith(f"{datetime.fromisoformat(properties['end_datetime']).strftime("%Y%m%dT%H%M%SZ")}_{collection_name}_merged.nc4"))
self.assertEqual(data['type'], 'application/x-netcdf4')
self.assertEqual(data['roles'], ['data'])

Expand Down

0 comments on commit 522262f

Please sign in to comment.