aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Harder <radhermit@gmail.com>2019-02-11 18:11:52 -0600
committerTim Harder <radhermit@gmail.com>2019-02-11 18:11:52 -0600
commit403265e18cd38b546df808598b62e03757d5011c (patch)
treeb3ffd50970f3e5b5c4772a10587c16ef178fdd97 /tests/sync
parenttests/sync/test_base: various clean ups (diff)
downloadpkgcore-403265e18cd38b546df808598b62e03757d5011c.tar.gz
pkgcore-403265e18cd38b546df808598b62e03757d5011c.tar.bz2
pkgcore-403265e18cd38b546df808598b62e03757d5011c.zip
tests/sync/test_base: add basic usersync test for ExternalSyncer
Diffstat (limited to 'tests/sync')
-rw-r--r--tests/sync/test_base.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/sync/test_base.py b/tests/sync/test_base.py
index eaee0d73..9fb34043 100644
--- a/tests/sync/test_base.py
+++ b/tests/sync/test_base.py
@@ -89,6 +89,22 @@ class TestExternalSyncer(object):
assert o.uri == 'http://dar'
assert o.binary == 'foo'
+ @mock.patch('snakeoil.process.spawn.spawn')
+ def test_usersync(self, spawn, find_binary):
+ # fake external syncer
+ class FooSyncer(base.ExternalSyncer):
+ binary = 'foo'
+
+ # fake that the external binary exists
+ find_binary.side_effect = lambda x: x
+
+ o = FooSyncer(self.repo_path, 'http://dar')
+ o.uid = 1234
+ o.gid = 2345
+ o._spawn('cmd', pipes={})
+ assert spawn.call_args[1]['uid'] == o.uid
+ assert spawn.call_args[1]['gid'] == o.gid
+
@mock.patch('snakeoil.process.find_binary', return_value='git')
@mock.patch('snakeoil.process.spawn.spawn')