Ejemplo n.º 1
0
def test_compute_if_should_backup_with_a_time_interval_policy_and_no_backups():
    memory_adapter = MemoryRepositoryAdapter(backups=[])
    backups = Repository(adapter=memory_adapter).fetch()
    policy = TimeIntervalBackupPolicy(
        interval=24*60*60
    )
    should = policy.should_backup(backups)
    assert should is True
Ejemplo n.º 2
0
def test_compute_if_should_backup_with_a_time_interval_policy(clock, interval, expected):
    memory_adapter = MemoryRepositoryAdapter(backups=mockbackups)
    backups = Repository(adapter=memory_adapter).fetch()

    policy = TimeIntervalBackupPolicy(
        interval=interval
    )
    Clock.monkey_now(clock)
    should = policy.should_backup(backups)
    Clock.monkey_now(False)

    assert should == expected