<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">import unittest
import datetime
from mm_stats.utils.get_timestamps import (
    get_oshdb_timestamp,
    get_user_contributions_per_country_timestamp,
    check_oshdb_processing_timestamp
)


class TestSessionsToPsql(unittest.TestCase):
    """The Unittest Class."""

    def setUp(self):
        """Set up directory and tests schema in postgres."""
        # get last month in DB with country stats
        self.data_timestamp = datetime.datetime.strptime("2021-09-01", "%Y-%m-%d").date()
        # get timestamp of OSM data in OSHDB
        self.oshdb_timestamp_invalid = datetime.datetime.strptime("2021-10-07", "%Y-%m-%d").date()
        self.oshdb_timestamp_valid = datetime.datetime.strptime("2021-11-07", "%Y-%m-%d").date()

    def tearDown(self):
        """Clean up and drop sessions table in postgres."""
        pass

    def test_check_oshdb_processing_timestamp_true(self):
        """Test if timestamp is valid."""
        self.assertTrue(
            check_oshdb_processing_timestamp(self.oshdb_timestamp_valid, self.data_timestamp)
        )

    def test_check_oshdb_processing_timestamp_false(self):
        """Test if timestamp is invalid."""
        self.assertFalse(
            check_oshdb_processing_timestamp(self.oshdb_timestamp_invalid, self.data_timestamp)
        )

    def test_check_oshdb_processing_timestamp(self):
        """Test if timestamp is invalid."""
        oshdb_timestamp = get_oshdb_timestamp().date()
        data_timestamp = get_user_contributions_per_country_timestamp().date()
        begin_timestamp = check_oshdb_processing_timestamp(oshdb_timestamp, data_timestamp)


if __name__ == "__main__":
    unittest.main()
</pre></body></html>