Beispiel #1
0
    def test_install_specific_sources(self, mock_install):
        """Verify individual dependencies can be installed."""
        mock_install.__name__ = "mock"

        cli.main(["install", "foo", "bar"])

        mock_install.assert_called_once_with("foo", "bar", root=None, depth=None, force=False, clean=False)
Beispiel #2
0
    def test_install_with_depth(self, mock_update):
        """Verify the 'install' command can be limited by depth."""
        mock_update.__name__ = "mock"

        cli.main(["install", "--depth", "5"])

        mock_update.assert_called_once_with(root=None, depth=5, force=False, clean=False)
Beispiel #3
0
    def test_list_no_dirty(self, mock_display):
        """Verify the 'list' command can be set to fail when dirty."""
        cli.main(['list', '--no-dirty'])

        mock_display.assert_called_once_with(root=None,
                                             depth=None,
                                             allow_dirty=False)
Beispiel #4
0
    def test_list_root(self, mock_display):
        """Verify the project's root can be specified."""
        cli.main(['list', '--root', 'mock/path/to/root'])

        mock_display.assert_called_once_with(root='mock/path/to/root',
                                             depth=None,
                                             allow_dirty=True)
Beispiel #5
0
    def test_main(self):
        """Verify the top-level command can be run."""
        mock_function = Mock(return_value=True)

        cli.main([], mock_function)

        mock_function.assert_called_once_with(root=None)
Beispiel #6
0
    def test_update(self, mock_update):
        """Verify the 'update' command can be run."""
        mock_update.__name__ = "mock"

        cli.main(["update"])

        mock_update.assert_called_once_with(root=None, depth=None, force=False, clean=False, recurse=False, lock=True)
Beispiel #7
0
    def test_list_no_dirty(self, mock_display):
        """Verify the 'list' command can be set to fail when dirty."""
        mock_display.__name__ = "mock"

        cli.main(["list", "--no-dirty"])

        mock_display.assert_called_once_with(root=None, depth=None, allow_dirty=False)
Beispiel #8
0
    def test_update_lock(self, mock_update):
        """Verify the 'update' command can enable locking."""
        cli.main(['update', '--lock'])

        mock_update.assert_called_once_with(
            root=None, depth=None,
            force=False, clean=False, recurse=False, lock=True)
Beispiel #9
0
    def test_list(self, mock_display):
        """Verify the 'list' command can be run."""
        mock_display.__name__ = "mock"

        cli.main(["list"])

        mock_display.assert_called_once_with(root=None, depth=None, allow_dirty=True)
Beispiel #10
0
    def test_list_root(self, mock_display):
        """Verify the project's root can be specified."""
        mock_display.__name__ = "mock"

        cli.main(["list", "--root", "mock/path/to/root"])

        mock_display.assert_called_once_with(root="mock/path/to/root", depth=None, allow_dirty=True)
Beispiel #11
0
    def test_uninstall_force(self, mock_uninstall):
        """Verify the 'uninstall' command can be forced."""
        mock_uninstall.__name__ = "mock"

        cli.main(["uninstall", "--force"])

        mock_uninstall.assert_called_once_with(root=None, force=True)
Beispiel #12
0
    def test_update_with_depth(self, mock_update):
        """Verify the 'update' command can be limited by depth."""
        mock_update.__name__ = "mock"

        cli.main(["update", "--depth", "5"])

        mock_update.assert_called_once_with(root=None, depth=5, force=False, clean=False, recurse=False, lock=True)
Beispiel #13
0
    def test_update_no_lock(self, mock_update):
        """Verify the 'update' command can be run without locking."""
        mock_update.__name__ = "mock"

        cli.main(["update", "--no-lock"])

        mock_update.assert_called_once_with(root=None, depth=None, force=False, clean=False, recurse=False, lock=False)
Beispiel #14
0
    def test_install_root(self, mock_install):
        """Verify the project's root can be specified."""
        cli.main(['install', '--root', 'mock/path/to/root'])

        mock_install.assert_called_once_with(
            root='mock/path/to/root', depth=None,
            force=False, fetch=False, clean=False)
Beispiel #15
0
    def test_update_with_depth(self, mock_update):
        """Verify the 'list' command can be limited by depth."""
        mock_update.__name__ = "mock"

        cli.main(["list", "--depth", "5"])

        mock_update.assert_called_once_with(root=None, depth=5, allow_dirty=True)
Beispiel #16
0
    def test_update_with_depth(self, mock_update):
        """Verify the 'update' command can be limited by depth."""
        cli.main(['update', '--depth', '5'])

        mock_update.assert_called_once_with(
            root=None, depth=5,
            force=False, clean=False, recurse=False, lock=None)
Beispiel #17
0
    def test_install(self, mock_install):
        """Verify the 'install' command can be run."""
        mock_install.__name__ = "mock"

        cli.main(["install"])

        mock_install.assert_called_once_with(root=None, depth=None, force=False, clean=False)
Beispiel #18
0
    def test_main(self):
        """Verify the top-level command can be run."""
        mock_function = Mock(return_value=True)

        cli.main([], mock_function)

        mock_function.assert_called_once_with(root=None)
Beispiel #19
0
    def test_install_root(self, mock_install):
        """Verify the project's root can be specified."""
        mock_install.__name__ = "mock"

        cli.main(["install", "--root", "mock/path/to/root"])

        mock_install.assert_called_once_with(root="mock/path/to/root", depth=None, force=False, clean=False)
Beispiel #20
0
    def test_update_recursive(self, mock_update):
        """Verify the 'update' command can be run recursively."""
        cli.main(['update', '--all'])

        mock_update.assert_called_once_with(
            root=None, depth=None,
            force=False, clean=False, recurse=True, lock=None)
Beispiel #21
0
    def test_install_force(self, mock_install):
        """Verify dependencies can be force-installed."""
        mock_install.__name__ = "mock"

        cli.main(["install", "--force"])

        mock_install.assert_called_once_with(root=None, depth=None, force=True, clean=False)
Beispiel #22
0
    def test_update_with_depth(self, mock_update):
        """Verify the 'list' command can be limited by depth."""
        cli.main(['list', '--depth', '5'])

        mock_update.assert_called_once_with(root=None,
                                            depth=5,
                                            allow_dirty=True)
Beispiel #23
0
    def test_install_clean(self, mock_install):
        """Verify dependency cleaning can be enabled."""
        mock_install.__name__ = "mock"

        cli.main(["install", "--clean"])

        mock_install.assert_called_once_with(root=None, depth=None, force=False, clean=True)
Beispiel #24
0
    def test_list(self, mock_display):
        """Verify the 'list' command can be run."""
        cli.main(['list'])

        mock_display.assert_called_once_with(root=None,
                                             depth=None,
                                             allow_dirty=True)
Beispiel #25
0
    def test_install_specific_sources(self, mock_install):
        """Verify individual dependencies can be installed."""
        cli.main(['install', 'foo', 'bar'])

        mock_install.assert_called_once_with(
            'foo', 'bar', root=None, depth=None,
            force=False, fetch=False, clean=False)
Beispiel #26
0
    def test_install_with_depth_invalid(self, mock_update):
        """Verify depths below 1 are rejected."""
        mock_update.__name__ = "mock"

        with pytest.raises(SystemExit):
            cli.main(["install", "--depth", "0"])
        with pytest.raises(SystemExit):
            cli.main(["install", "--depth", "-1"])
Beispiel #27
0
 def test_update_no_lock(self, mock_update):
     """Verify the 'update' command can be run without locking."""
     cli.main(['update', '--no-lock'])
     mock_update.assert_called_once_with(root=None,
                                         force=False,
                                         clean=False,
                                         recurse=False,
                                         lock=False)
Beispiel #28
0
    def test_install_fetch(self, mock_install):
        """Verify fetching can be enabled."""
        cli.main(['install', '--fetch'])

        mock_install.assert_called_once_with(root=None,
                                             depth=None,
                                             force=False,
                                             fetch=True,
                                             clean=False)
Beispiel #29
0
    def test_install_clean(self, mock_install):
        """Verify dependency cleaning can be enabled."""
        cli.main(['install', '--clean'])

        mock_install.assert_called_once_with(root=None,
                                             depth=None,
                                             force=False,
                                             fetch=False,
                                             clean=True)
Beispiel #30
0
    def test_install_force(self, mock_install):
        """Verify dependencies can be force-installed."""
        cli.main(['install', '--force'])

        mock_install.assert_called_once_with(root=None,
                                             depth=None,
                                             force=True,
                                             fetch=False,
                                             clean=False)
Beispiel #31
0
    def test_install_root(self, mock_install):
        """Verify the project's root can be specified."""
        cli.main(['install', '--root', 'mock/path/to/root'])

        mock_install.assert_called_once_with(root='mock/path/to/root',
                                             depth=None,
                                             force=False,
                                             fetch=False,
                                             clean=False)
Beispiel #32
0
    def test_install_with_depth(self, mock_update):
        """Verify the 'install' command can be limited by depth."""
        cli.main(['install', '--depth', '5'])

        mock_update.assert_called_once_with(root=None,
                                            depth=5,
                                            force=False,
                                            fetch=False,
                                            clean=False)
Beispiel #33
0
    def test_install(self, mock_install):
        """Verify the 'install' command can be run."""
        cli.main(['install'])

        mock_install.assert_called_once_with(root=None,
                                             depth=None,
                                             force=False,
                                             fetch=False,
                                             clean=False)
Beispiel #34
0
    def test_update_lock(self, mock_update):
        """Verify the 'update' command can enable locking."""
        cli.main(['update', '--lock'])

        mock_update.assert_called_once_with(root=None,
                                            depth=None,
                                            force=False,
                                            clean=False,
                                            recurse=False,
                                            lock=True)
Beispiel #35
0
    def test_update_recursive(self, mock_update):
        """Verify the 'update' command can be run recursively."""
        cli.main(['update', '--all'])

        mock_update.assert_called_once_with(root=None,
                                            depth=None,
                                            force=False,
                                            clean=False,
                                            recurse=True,
                                            lock=None)
Beispiel #36
0
    def test_update_with_depth(self, mock_update):
        """Verify the 'update' command can be limited by depth."""
        cli.main(['update', '--depth', '5'])

        mock_update.assert_called_once_with(root=None,
                                            depth=5,
                                            force=False,
                                            clean=False,
                                            recurse=False,
                                            lock=None)
Beispiel #37
0
    def test_install_specific_sources(self, mock_install):
        """Verify individual dependencies can be installed."""
        cli.main(['install', 'foo', 'bar'])

        mock_install.assert_called_once_with('foo',
                                             'bar',
                                             root=None,
                                             depth=None,
                                             force=False,
                                             fetch=False,
                                             clean=False)
Beispiel #38
0
 def test_main_none(self):
     """Verify it's an error to specify no command."""
     with pytest.raises(SystemExit):
         cli.main([])
Beispiel #39
0
 def test_main_interrupt(self):
     """Verify a command can be interrupted."""
     with pytest.raises(SystemExit):
         cli.main([], Mock(side_effect=KeyboardInterrupt))
Beispiel #40
0
 def test_main_help(self):
     """Verify the help text can be displayed."""
     with pytest.raises(SystemExit):
         cli.main(['--help'])
Beispiel #41
0
 def test_level(self, arg, verbosity):
     """Verify verbose level can be set."""
     cli.main([arg] if arg else [], self.mock_function)
     assert verbosity == _Config.verbosity
Beispiel #42
0
 def test_install_with_depth_invalid(self):
     """Verify depths below 1 are rejected."""
     with pytest.raises(SystemExit):
         cli.main(['install', '--depth', '0'])
     with pytest.raises(SystemExit):
         cli.main(['install', '--depth', '-1'])
Beispiel #43
0
    def test_uninstall(self, mock_uninstall):
        """Verify the 'uninstall' command can be run."""
        cli.main(['uninstall'])

        mock_uninstall.assert_called_once_with(root=None, force=False)
Beispiel #44
0
    def test_uninstall_force(self, mock_uninstall):
        """Verify the 'uninstall' command can be forced."""
        cli.main(['uninstall', '--force'])

        mock_uninstall.assert_called_once_with(root=None, force=True)
Beispiel #45
0
 def test_main_interrupt(self):
     """Verify a command can be interrupted."""
     with pytest.raises(SystemExit):
         cli.main([], Mock(side_effect=KeyboardInterrupt))
Beispiel #46
0
 def with_dependencies(lock):
     cli.main(['lock', 'foo', 'bar'])
     lock.assert_called_once_with('foo', 'bar', root=None)
Beispiel #47
0
 def test_main_help(self):
     """Verify the help text can be displayed."""
     with pytest.raises(SystemExit):
         cli.main(['--help'])
Beispiel #48
0
    def test_install_force(self, mock_install):
        """Verify dependencies can be force-installed."""
        cli.main(['install', '--force'])

        mock_install.assert_called_once_with(
            root=None, depth=None, force=True, fetch=False, clean=False)
Beispiel #49
0
 def test_main_none(self):
     """Verify it's an error to specify no command."""
     with pytest.raises(SystemExit):
         cli.main([])
Beispiel #50
0
 def test_level(self, arg, verbosity):
     """Verify verbose level can be set."""
     cli.main([arg] if arg else [], self.mock_function)
     assert verbosity == _Config.verbosity
Beispiel #51
0
 def test_main_error(self):
     """Verify runtime errors are handled."""
     with pytest.raises(SystemExit):
         cli.main([], Mock(side_effect=RuntimeError))
Beispiel #52
0
    def test_uninstall_root(self, mock_uninstall):
        """Verify the project's root can be specified."""
        cli.main(['uninstall', '--root', 'mock/path/to/root'])

        mock_uninstall.assert_called_once_with(root='mock/path/to/root',
                                               force=False)
Beispiel #53
0
    def test_install_clean(self, mock_install):
        """Verify dependency cleaning can be enabled."""
        cli.main(['install', '--clean'])

        mock_install.assert_called_once_with(
            root=None, depth=None, force=False, fetch=False, clean=True)
Beispiel #54
0
 def test_main_error(self):
     """Verify runtime errors are handled."""
     with pytest.raises(SystemExit):
         cli.main([], Mock(side_effect=RuntimeError))
Beispiel #55
0
    def test_install_fetch(self, mock_install):
        """Verify fetching can be enabled."""
        cli.main(['install', '--fetch'])

        mock_install.assert_called_once_with(
            root=None, depth=None, force=False, fetch=True, clean=False)
Beispiel #56
0
 def test_update_lock_conflict(self):
     """Verify the 'update' command cannot specify both locking options."""
     with pytest.raises(SystemExit):
         cli.main(['update', '--lock', '--no-lock'])
Beispiel #57
0
 def with_no_arguments(lock):
     cli.main(['lock'])
     lock.assert_called_once_with(root=None)
Beispiel #58
0
 def test_main_fail(self):
     """Verify error in commands are detected."""
     with pytest.raises(SystemExit):
         cli.main([], Mock(return_value=False))