Exemple #1
0
 def test_valid_time_delta_valid_seconds(self):
     for jitter in [' 82s ', '82 s', '82 sec', '82seconds  ']:
         delta = datetime.timedelta(seconds=82)
         assert_equal(
             delta,
             config_utils.valid_time_delta(
                 jitter,
                 self.context,
             ),
         )
Exemple #2
0
 def test_valid_time_delta_valid_minutes(self):
     for jitter in ['10m', '10 m', '10   min', '  10minutes']:
         delta = datetime.timedelta(seconds=600)
         assert_equal(
             delta,
             config_utils.valid_time_delta(
                 jitter,
                 self.context,
             ),
         )
Exemple #3
0
 def test_valid_time_delta_valid_minutes(self):
     for jitter in ['10m', '10 m', '10   min', '  10minutes']:
         delta = datetime.timedelta(seconds=600)
         assert_equal(
             delta,
             config_utils.valid_time_delta(
                 jitter,
                 self.context,
             ),
         )
Exemple #4
0
 def test_valid_time_delta_valid_seconds(self):
     for jitter in [' 82s ', '82 s', '82 sec', '82seconds  ']:
         delta = datetime.timedelta(seconds=82)
         assert_equal(
             delta,
             config_utils.valid_time_delta(
                 jitter,
                 self.context,
             ),
         )
Exemple #5
0
def valid_interval_scheduler(config,  config_context):
    def build_config(delta):
        return ConfigIntervalScheduler(timedelta=delta, jitter=config.jitter)

    interval_key = config.value.strip()
    if interval_key in TIME_INTERVAL_SHORTCUTS:
        return build_config(TIME_INTERVAL_SHORTCUTS[interval_key])

    return build_config(
        config_utils.valid_time_delta(config.value, config_context))
 def test_valid_time_delta_valid_minutes(self):
     for jitter in ["10m", "10 m", "10   min", "  10minutes"]:
         delta = datetime.timedelta(seconds=600)
         assert_equal(delta, config_utils.valid_time_delta(jitter, self.context))
 def test_valid_time_delta_valid_seconds(self):
     for jitter in [" 82s ", "82 s", "82 sec", "82seconds  "]:
         delta = datetime.timedelta(seconds=82)
         assert_equal(delta, config_utils.valid_time_delta(jitter, self.context))