Example #1
0
    def test_sensor_reading_job_no_notifications_within_four_hours(
            self, sensormodule, sqlalchemy):
        tests.fixtures.mock_sensors = [mocks.MockDigitalAbnormalSensor]

        sensormodule.sensor_reading_job()
        sensormodule.sensor_reading_job()

        sensor_persistence = NotificationPersistenceService()

        assert len(sensor_persistence.all()) == 1
Example #2
0
    def test_sensor_reading_job_no_notifications_within_four_hours(
            self, sensormodule, sqlalchemy):
        tests.fixtures.mock_sensors = [mocks.MockDigitalAbnormalSensor]

        sensormodule.sensor_reading_job()
        sensormodule.sensor_reading_job()

        sensor_persistence = NotificationPersistenceService()

        assert len(sensor_persistence.all()) == 1
Example #3
0
    def test_sensor_reading_job_notifications_after_four_hours(
            self, sensormodule, sqlalchemy):
        tests.fixtures.mock_sensors = [mocks.MockDigitalAbnormalSensor]

        sensor_persistence = NotificationPersistenceService()

        sensormodule.sensor_reading_job()

        notification = sensor_persistence.get_newest_notification(
            'digital abnormal')
        notification.timestamp = datetime(1970, 1, 1)
        sensor_persistence.update(notification)

        sensormodule.sensor_reading_job()

        assert len(sensor_persistence.all()) == 2
Example #4
0
    def test_sensor_reading_job_notifications_after_four_hours(
            self, sensormodule, sqlalchemy):
        tests.fixtures.mock_sensors = [mocks.MockDigitalAbnormalSensor]

        sensor_persistence = NotificationPersistenceService()

        sensormodule.sensor_reading_job()

        notification = sensor_persistence.get_newest_notification(
            'digital abnormal')
        notification.timestamp = datetime(1970, 1, 1)
        sensor_persistence.update(notification)

        sensormodule.sensor_reading_job()

        assert len(sensor_persistence.all()) == 2