File: test_remote.py

package info (click to toggle)
yarsync 0.1.1%2Bdeb-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 624 kB
  • sloc: python: 1,905; makefile: 13
file content (27 lines) | stat: -rw-r--r-- 881 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# -*- coding: utf-8 -*-
import os
import pytest
import subprocess

from yarsync import YARsync
from yarsync.yarsync import (
    CONFIG_ERROR, COMMAND_ERROR,
    SYS_EXIT_ERROR
)


def test_remote_add(capfd, origin_test_dir, test_dir_ys_bad_permissions):
    # remote is added fine
    # bad permissions don't affect .ys config
    os.chdir(test_dir_ys_bad_permissions)
    ys = YARsync("yarsync remote add origin".split() + [origin_test_dir])
    # remote "origin" is already added in origin_test_dir.
    # adding remote with same name is forbidden
    returncode = ys()
    assert returncode == COMMAND_ERROR
    captured = capfd.readouterr()
    assert "! remote origin exists, break." in captured.err
    # we disabled stdout in the fixture.
    assert not captured.out
    # # It seems this is captured from the fixture.
    # # assert "Remote origin added." in captured.out