Commit b3ce1bdb authored by nateatkins's avatar nateatkins
Browse files

Removed unit tests that were used to debug the problem. Testing is covered in...

Removed unit tests that were used to debug the problem.  Testing is covered in the tools/cli_test_v4.sh script.
parent a83f7796
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -208,7 +208,7 @@ class CreateMixin(object):
class UpdateMixin(object):
    def _check_missing_update_attrs(self, data):
        required, optional = self.get_update_attrs()
        # Remove the id field from the required list as it has been moved to the http path.
        # Remove the id field from the required list as it was previously moved to the http path.
        required = tuple(filter(lambda k: k != self._obj_cls._id_attr, required))
        missing = []
        for attr in required:
+0 −59
Original line number Diff line number Diff line
from gitlab import cli
import pytest
import sys

PROJECT_ID = 9460322


def test_project_variable(capsys):
    key = "junk1"
    value1 = "car"
    value2 = "bus"

    with pytest.raises(SystemExit) as exit_exc:
        cmd_line = f"gitlab project-variable list --project-id {PROJECT_ID}"
        print("--->", cmd_line)
        sys.argv = cmd_line.split()
        cli.main()
    out, err = capsys.readouterr()

    if key not in out:
        with pytest.raises(SystemExit) as exit_exc:
            cmd_line = f"gitlab project-variable create --project-id {PROJECT_ID} --key {key} --value {value1}"
            print("--->", cmd_line)
            sys.argv = cmd_line.split()
            cli.main()
    out, err = capsys.readouterr()

    with pytest.raises(SystemExit) as exit_exc:
        cmd_line = f"gitlab project-variable get --project-id {PROJECT_ID} --key {key}"
        print("--->", cmd_line)
        sys.argv = cmd_line.split()
        cli.main()
    out, err = capsys.readouterr()

    with pytest.raises(SystemExit) as exit_exc:
        cmd_line = f"gitlab project-variable update --project-id {PROJECT_ID} --key {key} --value {value2}"
        print("--->", cmd_line)
        sys.argv = cmd_line.split()
        cli.main()
    out, err = capsys.readouterr()
    assert key in out
    assert value2 in out

    with pytest.raises(SystemExit) as exit_exc:
        cmd_line = f"gitlab project-variable list --project-id {PROJECT_ID}"
        print("--->", cmd_line)
        sys.argv = cmd_line.split()
        cli.main()
    out, _ = capsys.readouterr()

    if key in out:
        with pytest.raises(SystemExit) as exit_exc:
            cmd_line = f"gitlab project-variable delete --project-id {PROJECT_ID} --key {key}"
            print("--->", cmd_line)
            sys.argv = cmd_line.split()
            cli.main()
    out, _ = capsys.readouterr()

    pass
 No newline at end of file

tools/cli_test_v4.sh

100644 → 100755
+0 −0

File mode changed from 100644 to 100755.