def test_usersync_repo_dir_perms(self, spawn): # and repo dir perms if it does exist with mock.patch('os.stat') as stat: stat.return_value = mock.Mock(st_uid=1234, st_gid=5678) o = base.Syncer(self.repo_path, f"http://foo/bar.git", usersync=True) stat.assert_called() assert o.uid == 1234 assert o.gid == 5678
def test_split_users(self): o = base.Syncer(self.repo_path, "http://dar") assert o.uid == os.getuid() assert o.uri == "http://dar" o = base.Syncer(self.repo_path, f"http://{existing_user}::@site") assert o.uid == existing_uid assert o.uri == "http://site" o = base.Syncer(self.repo_path, f"http://{existing_user}::foon@site") assert o.uid == existing_uid assert o.uri == "http://foon@site" o = base.Syncer(self.repo_path, f"{existing_user}::foon@site") assert o.uid == existing_uid assert o.uri == "foon@site" with pytest.raises(base.MissingLocalUser): base.Syncer(self.repo_path, f"foo_nonexistent_user::foon@site")
def test_usersync_portage_perms(self, spawn): # sync uses portage perms if repo dir doesn't exist o = base.Syncer(self.repo_path, f"http://foo/bar.git", usersync=True) o.uid == os_data.portage_uid o.gid == os_data.portage_gid
def test_usersync_disabled(self, spawn): o = base.Syncer(self.repo_path, f"http://foo/bar.git", usersync=False) o.uid == os_data.uid o.gid == os_data.gid