Index: /branches/ipp-259_genericise_backups/tools/backups/backup_test.py
===================================================================
--- /branches/ipp-259_genericise_backups/tools/backups/backup_test.py	(revision 40950)
+++ /branches/ipp-259_genericise_backups/tools/backups/backup_test.py	(revision 40951)
@@ -8,5 +8,5 @@
 import backups.utils.errors as errs
 from backups.backup import Backup
-from backups.utils.config_parse_helper import ConfigSchema
+from backups.utils.config_parse_helper import ConfigSchema, ConfigSchemaSection, ConfigSchemaLine
 
 TEST_DEFAULT_CONFIG_FILE = os.path.join(os.path.dirname(__file__), 'testing/backup_test.config')
@@ -486,5 +486,5 @@
             backy._run_rsync()
 
-    def test_rsync_requires_dash_r_arg_for_copying_dirs(self, tmpdir):
+    def test_rsync_requires_dash_r_arg_for_copying_only_dirs(self, tmpdir):
         config = make_default_config(tmpdir, ['bck1', 'bck2'])
         source = os.path.join(tmpdir, "some_dir")
@@ -521,4 +521,65 @@
         assert os.path.exists(expected1dir)
         assert os.path.exists(expected2dir)
+
+    def test_rsync_with_delete_after_options(self, tmpdir):
+        config = make_default_config(tmpdir, ['bck1', 'bck2'])
+        source_dir = os.path.join(tmpdir, "some_dir")
+        source_file1 = os.path.join(source_dir, "file1")
+        source_file2 = os.path.join(source_dir, "file2")
+        source_file3 = os.path.join(source_dir, "file3")
+        config['RSYNC'] = \
+        { 'sources' : f"{source_dir}"
+        , 'additional_args' : "-v -z -r --progress"
+        }
+
+        os.makedirs(source_dir)
+        Path(source_file1).touch()
+        Path(source_file2).touch()
+        Path(source_file3).touch()
+
+        schema = ConfigSchema(None)
+        schema.add_section(bckup.DEFAULT_SCHEMA_SECTION)
+        schema.add_section(bckup.RSYNC_SCHEMA_SECTION)
+
+        backy = Backup(config, schema)
+
+        expected1dir  = os.path.join(tmpdir, 'bck1', 'some_dir', 'file1')
+        expected2dir  = os.path.join(tmpdir, 'bck1', 'some_dir', 'file2')
+        expected3dir  = os.path.join(tmpdir, 'bck1', 'some_dir', 'file3')
+        assert not os.path.exists(expected1dir)
+        assert not os.path.exists(expected2dir)
+        assert not os.path.exists(expected3dir)
+        backy._run_rsync()
+        print(expected1dir)
+        assert os.path.exists(expected1dir)
+        assert os.path.exists(expected2dir)
+        assert os.path.exists(expected3dir)
+
+        # Delete two files, create a new one.
+        os.remove(source_file2)
+        os.remove(source_file3)
+        source_file4 = os.path.join(source_dir, "file4")
+        Path(source_file4).touch()
+        expected4dir = os.path.join(tmpdir, 'bck1', 'some_dir', 'file4')
+
+        # Rsync will add 4, and 2 and 3 should still exist
+        backy._run_rsync()
+        assert os.path.exists(expected1dir)
+        assert os.path.exists(expected2dir)
+        assert os.path.exists(expected3dir)
+        assert os.path.exists(expected4dir)
+
+        # with delete after option removed files are cleaned up
+        config['RSYNC'] = \
+        { 'sources' : f"{source_dir}"
+        , 'additional_args' : '-v -z -r --delete-after'
+        }
+        backy = Backup(config, schema)
+        backy._run_rsync()
+        assert os.path.exists(expected1dir)
+        assert not os.path.exists(expected2dir)
+        assert not os.path.exists(expected3dir)
+        assert os.path.exists(expected4dir)
+
 
 
Index: /branches/ipp-259_genericise_backups/tools/backups/confluence_backup.py
===================================================================
--- /branches/ipp-259_genericise_backups/tools/backups/confluence_backup.py	(revision 40950)
+++ /branches/ipp-259_genericise_backups/tools/backups/confluence_backup.py	(revision 40951)
@@ -93,6 +93,6 @@
 
 def main():
-    jb = ConfluenceBackup()
-    jb.run_backup()
+    cb = ConfluenceBackup()
+    cb.run_backup()
 
 
