Repository: borgbackup/borg

Issue:
test methods in wrong test class
check for 1.1-maint and master branch:

it seems that there are some test methods in `RemoteArchiverTestCase` that should be rather in the `ArchiverTestCase` class (which is inherited by `RemoteArchiverTestCase`).

idea:
- most tests should be in the base class `ArchiverTestCase`
- the remote tests class should contain tests that only make sense for remote repos
- the remote tests class might contain some test overrides for tests that do not work remotely, but would normally be inherited from the base class
- 


Discussion:
@hexagonrecursion can you have a look? you added one there (and maybe there already was a bad one there already).
Did a quick experiment, this is how it should look like:

```
$ pytest -vk do_not_mention

src/borg/testsuite/archiver.py::ArchiverTestCase::test_do_not_mention_archive_if_you_can_not_find_repo PASSED                                                                                      [ 33%]
src/borg/testsuite/archiver.py::ArchiverTestCaseBinary::test_do_not_mention_archive_if_you_can_not_find_repo SKIPPED (no borg.exe available)                                                       [ 66%]
src/borg/testsuite/archiver.py::RemoteArchiverTestCase::test_do_not_mention_archive_if_you_can_not_find_repo PASSED     
```
IIRC I put the test there because the bug it reproduces only affected remote archives. I think I did not understand at the time that regular tests are executed for remote archives too. I'll move test_do_not_mention_archive_if_you_can_not_find_repo to ArchiverTestCase.

* test_remote_repo_restrict_to_path and test_remote_repo_restrict_to_repository are in the right class - restrictions are only supported for remote repos
* test_strip_components_doesnt_leak asserts that this line is not triggered:
    https://github.com/borgbackup/borg/blob/56a75ee691f529374e0aba6c6b1a0db1c689b34b/src/borg/remote.py#L619
    this too only applies to remote repositories

Resolving patch:
diff --git a/src/borg/testsuite/archiver.py b/src/borg/testsuite/archiver.py
--- a/src/borg/testsuite/archiver.py
+++ b/src/borg/testsuite/archiver.py
@@ -3499,6 +3499,13 @@ def patched_setxattr_EACCES(*args, **kwargs):
             with patch.object(xattr, 'setxattr', patched_setxattr_EACCES):
                 self.cmd('extract', self.repository_location + '::test', exit_code=EXIT_WARNING)
 
+    def test_do_not_mention_archive_if_you_can_not_find_repo(self):
+        """https://github.com/borgbackup/borg/issues/6014"""
+        archive = self.repository_location + '-this-repository-does-not-exist' + '::test'
+        output = self.cmd('info', archive, exit_code=2, fork=True)
+        self.assert_in('this-repository-does-not-exist', output)
+        self.assert_not_in('this-repository-does-not-exist::test', output)
+
 
 @unittest.skipUnless('binary' in BORG_EXES, 'no borg.exe available')
 class ArchiverTestCaseBinary(ArchiverTestCase):
@@ -3910,7 +3917,7 @@ def test_config(self):
     def test_migrate_lock_alive(self):
         pass
 
-    def test_strip_components_doesnt_leak(self):
+    def test_remote_repo_strip_components_doesnt_leak(self):
         self.cmd('init', '--encryption=repokey', self.repository_location)
         self.create_regular_file('dir/file', contents=b"test file contents 1")
         self.create_regular_file('dir/file2', contents=b"test file contents 2")
@@ -3932,13 +3939,6 @@ def test_strip_components_doesnt_leak(self):
                 res = self.cmd('extract', "--debug", self.repository_location + '::test', '--strip-components', '0')
                 self.assert_true(marker not in res)
 
-    def test_do_not_mention_archive_if_you_can_not_find_repo(self):
-        """https://github.com/borgbackup/borg/issues/6014"""
-        archive = self.repository_location + '-this-repository-does-not-exist' + '::test'
-        output = self.cmd('info', archive, exit_code=2, fork=True)
-        self.assert_in('this-repository-does-not-exist', output)
-        self.assert_not_in('this-repository-does-not-exist::test', output)
-
 
 class ArchiverCorruptionTestCase(ArchiverTestCaseBase):
     def setUp(self):


Test patch: