From 1ec5b213ad40228c1e2e7aba6b998d7fb9783540 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Tue, 8 Jan 2019 13:44:44 -0800 Subject: [PATCH] snapshot: Minor styling fixes - Avoid use of _ in functional steps. - flake8 fixes. Signed-off-by: Sunil Mohan Adapa --- functional_tests/features/storage_snapshots.feature | 12 ++++++------ functional_tests/step_definitions/system.py | 7 +++---- plinth/modules/snapshot/views.py | 8 ++++---- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/functional_tests/features/storage_snapshots.feature b/functional_tests/features/storage_snapshots.feature index b56ad2bff..24be0d5fc 100644 --- a/functional_tests/features/storage_snapshots.feature +++ b/functional_tests/features/storage_snapshots.feature @@ -29,13 +29,13 @@ Scenario: Create a snapshot Then there should be 1 snapshot in the list Scenario: Configure snapshots - Given snapshots are configured with free_space 30, timeline snapshots disabled, software snapshots disabled, hourly limit 10, daily limit 3, weekly limit 2, monthly limit 2, yearly limit 0 - When I configure snapshots with free_space 20, timeline snapshots enabled, software snapshots enabled, hourly limit 3, daily limit 2, weekly limit 1, monthly limit 1, yearly limit 1 - Then snapshots should be configured with free_space 20, timeline snapshots enabled, software snapshots enabled, hourly limit 3, daily limit 2, weekly limit 1, monthly limit 1, yearly limit 1 + Given snapshots are configured with free space 30, timeline snapshots disabled, software snapshots disabled, hourly limit 10, daily limit 3, weekly limit 2, monthly limit 2, yearly limit 0 + When I configure snapshots with free space 20, timeline snapshots enabled, software snapshots enabled, hourly limit 3, daily limit 2, weekly limit 1, monthly limit 1, yearly limit 1 + Then snapshots should be configured with free space 20, timeline snapshots enabled, software snapshots enabled, hourly limit 3, daily limit 2, weekly limit 1, monthly limit 1, yearly limit 1 Scenario: Backup and restore snapshot - When I configure snapshots with free_space 30, timeline snapshots disabled, software snapshots disabled, hourly limit 10, daily limit 3, weekly limit 2, monthly limit 2, yearly limit 0 + When I configure snapshots with free space 30, timeline snapshots disabled, software snapshots disabled, hourly limit 10, daily limit 3, weekly limit 2, monthly limit 2, yearly limit 0 And I create a backup of the snapshot app data - And I configure snapshots with free_space 20, timeline snapshots enabled, software snapshots enabled, hourly limit 3, daily limit 2, weekly limit 1, monthly limit 1, yearly limit 1 + And I configure snapshots with free space 20, timeline snapshots enabled, software snapshots enabled, hourly limit 3, daily limit 2, weekly limit 1, monthly limit 1, yearly limit 1 And I restore the snapshot app data backup - Then snapshots should be configured with free_space 30, timeline snapshots disabled, software snapshots disabled, hourly limit 10, daily limit 3, weekly limit 2, monthly limit 2, yearly limit 0 + Then snapshots should be configured with free space 30, timeline snapshots disabled, software snapshots disabled, hourly limit 10, daily limit 3, weekly limit 2, monthly limit 2, yearly limit 0 diff --git a/functional_tests/step_definitions/system.py b/functional_tests/step_definitions/system.py index 9f016508c..93da25537 100644 --- a/functional_tests/step_definitions/system.py +++ b/functional_tests/step_definitions/system.py @@ -108,7 +108,7 @@ def verify_snapshot_count(browser, count): @given( parsers.parse( - 'snapshots are configured with free_space {free_space:d}, timeline ' + 'snapshots are configured with free space {free_space:d}, timeline ' 'snapshots {timeline_enabled:w}, software snapshots ' '{software_enabled:w}, hourly limit {hourly:d}, daily limit {daily:d}' ', weekly limit {weekly:d}, monthly limit {monthly:d}, yearly limit ' @@ -125,7 +125,7 @@ def snapshot_given_set_configuration(browser, free_space, timeline_enabled, @when( parsers.parse( - 'I configure snapshots with free_space {free_space:d}, ' + 'I configure snapshots with free space {free_space:d}, ' 'timeline snapshots {timeline_enabled:w}, ' 'software snapshots {software_enabled:w}, hourly limit {hourly:d}, ' 'daily limit {daily:d}, weekly limit {weekly:d}, monthly limit ' @@ -142,7 +142,7 @@ def snapshot_set_configuration(browser, free_space, timeline_enabled, @then( parsers.parse( - 'snapshots should be configured with free_space {free_space:d}, ' + 'snapshots should be configured with free space {free_space:d}, ' 'timeline snapshots {timeline_enabled:w}, software snapshots ' '{software_enabled:w}, hourly limit {hourly:d}, daily limit ' '{daily:d}, weekly limit {weekly:d}, monthly limit {monthly:d}, ' @@ -152,7 +152,6 @@ def snapshot_assert_configuration(browser, free_space, timeline_enabled, monthly, yearly): timeline_enabled = (timeline_enabled == 'enabled') software_enabled = (software_enabled == 'enabled') - print(system.snapshot_get_configuration(browser)) assert (free_space, timeline_enabled, software_enabled, hourly, daily, weekly, monthly, yearly) == system.snapshot_get_configuration(browser) diff --git a/plinth/modules/snapshot/views.py b/plinth/modules/snapshot/views.py index 8d14d22e2..33954ff06 100644 --- a/plinth/modules/snapshot/views.py +++ b/plinth/modules/snapshot/views.py @@ -100,10 +100,10 @@ def update_configuration(request, old_status, new_status): if old_status[key] != new_status[key]: if 'limit' in key: return stamp.format('0-{}'.format(new_status[key])) - else: - return stamp.format(new_status[key]) - else: - return None + + return stamp.format(new_status[key]) + + return None config = filter( None,