def test_get_time_since_last_connection_display_returns_empty_string_when_time_since_last_connection_is_none( self, garden_factory): garden = garden_factory.build(last_connection_time=None) formatter = GardenFormatter(garden) ret_val = formatter.get_time_since_last_connection_display() assert ret_val == ''
def test_get_time_since_last_connection_display_returns_the_duration_rounded_to_days( self, garden_factory): days = 3 duration = timedelta(days=days, hours=2, seconds=1) garden = garden_factory.build( last_connection_time=datetime.now(pytz.UTC) - duration) formatter = GardenFormatter(garden) ret_val = formatter.get_time_since_last_connection_display() assert ret_val == f'updated {days} days ago'