Exemplo n.º 1
0
    def test_credentials(self, mocks):
        scan_m, options_m, lens_m, creds_m, dis_m, en_m, st_m = mocks
        options_m.return_value = Namespace(command="credentials",
                                           username="******",
                                           password="******")

        _main()

        scan_m.assert_not_called()
        lens_m.add.assert_not_called()
        lens_m.add_custom.assert_not_called()
        lens_m.list.assert_not_called()
        lens_m.get_last.assert_not_called()
        creds_m.assert_called_once_with(username="******", password="******")
Exemplo n.º 2
0
    def test_now(self, mocks):
        scan_m, options_m, lens_m, creds_m, dis_m, en_m, st_m = mocks
        options_m.return_value = Namespace(command="now")
        _main()

        scan_m.assert_not_called()
        lens_m.add.assert_called_once_with(delta_days=0)
        lens_m.add_custom.assert_not_called()
        lens_m.list.assert_not_called()
        lens_m.get_last.assert_not_called()
        creds_m.assert_not_called()
        dis_m.assert_not_called()
        en_m.assert_not_called()
        st_m.assert_not_called()
Exemplo n.º 3
0
    def test_show_status(self, mocks):
        scan_m, options_m, lens_m, creds_m, dis_m, en_m, st_m = mocks
        options_m.return_value = Namespace(command="status")

        _main()

        scan_m.assert_not_called()
        lens_m.add.assert_not_called()
        lens_m.add_custom.assert_not_called()
        lens_m.list.assert_not_called()
        lens_m.get_last.assert_not_called()
        creds_m.assert_not_called()
        dis_m.assert_not_called()
        en_m.assert_not_called()
        st_m.assert_called()
Exemplo n.º 4
0
    def test_from_str(self, mocks):
        scan_m, options_m, lens_m, creds_m, dis_m, en_m, st_m = mocks
        options_m.return_value = Namespace(string="some-str",
                                           command="from-str")
        _main()

        scan_m.assert_not_called()
        lens_m.add.assert_not_called()
        lens_m.add_custom.assert_called_once_with("some-str")
        lens_m.list.assert_not_called()
        lens_m.get_last.assert_not_called()
        creds_m.assert_not_called()
        dis_m.assert_not_called()
        en_m.assert_not_called()
        st_m.assert_not_called()
Exemplo n.º 5
0
    def test_last(self, mocks):
        scan_m, options_m, lens_m, creds_m, dis_m, en_m, st_m = mocks
        options_m.return_value = Namespace(command="last")

        with pytest.raises(SystemExit):
            _main()

        scan_m.assert_not_called()
        lens_m.add.assert_not_called()
        lens_m.add_custom.assert_not_called()
        lens_m.list.assert_not_called()
        lens_m.get_last.assert_called_once_with()
        creds_m.assert_not_called()
        dis_m.assert_not_called()
        en_m.assert_not_called()
        st_m.assert_not_called()