Пример #1
0
 def test_copy_to_deflist(self, caplog, id_and_name_to):
     caplog.set_level(logging.DEBUG)
     c = "{} --to {} --copy {}".format(id_and_name_to.name, "とりあえずマイリスト", VIDEO_ID)
     try:
         nicotools.main(param(c))
     except utils.MylistAPIError as error:
         if not error.ok:
             print(error, file=sys.stderr)
Пример #2
0
 def test_del_from_deflist(self, caplog):
     caplog.set_level(logging.DEBUG)
     c = "{} --delete {}".format("とりあえずマイリスト", VIDEO_ID)
     try:
         nicotools.main(param(c))
     except utils.MylistAPIError as error:
         if not error.ok:
             print(error, file=sys.stderr)
Пример #3
0
 def test_show_everything_tsv(self, caplog):
     caplog.set_level(logging.DEBUG)
     c = "* --show --everything"
     try:
         nicotools.main(param(c))
     except utils.MylistAPIError as error:
         if not error.ok:
             print(error, file=sys.stderr)
Пример #4
0
 def test_list_not_exists_and_create_special_characters_name(self, instance):
     c = "{} --show".format(INSANE_NAME)
     with pytest.raises(SystemExit):
         nicotools.main(param(c))
     instance.create_mylist(INSANE_NAME)
     # 作ったばかりなのでマイリストIDは、手持ちの中で最大。
     insane_id = max(instance.mylists)
     instance.purge_mylist(insane_id, confident=True)
Пример #5
0
    def test_delete_not_existing_items(self):
        c = "とりあえずマイリスト --add {}".format(VIDEO_ID)
        assert nicotools.main(param(c))

        c = "とりあえずマイリスト --delete {}".format(VIDEO_ID)
        assert nicotools.main(param(c))
        c = "とりあえずマイリスト --delete {}".format(VIDEO_ID)
        assert nicotools.main(param(c)) is False
Пример #6
0
 def test_create_purge(self, id_and_name):
     with tempfile.TemporaryDirectory(prefix=__name__) as tmpdirname:
         # c = "{} --create".format(id_and_name.name)
         # assert nicotools.main(param(c))
         c = "{} --id --export --out {}_export.txt".format(
             id_and_name.id, os.path.join(tmpdirname, id_and_name.name))
         assert nicotools.main(param(c))
         c = "{} --id --show".format(id_and_name.id)
         assert nicotools.main(param(c))
         c = "{} --id --show --show --out {}_show.txt".format(
             id_and_name.id, os.path.join(tmpdirname, id_and_name.name))
         assert nicotools.main(param(c))
         c = "{} --id --purge --yes".format(id_and_name.id)
         assert nicotools.main(param(c))
Пример #7
0
 def test_nicoml_del_2(self, caplog, id_and_name):
     caplog.set_level(logging.DEBUG)
     c = "{} --delete * --yes".format(id_and_name.name)
     try:
         assert nicotools.main(param(c))
     except utils.MylistAPIError as error:
         if not error.ok:
             print(error, file=sys.stderr)
Пример #8
0
 def test_nicoml_add_1(self, caplog, id_and_name):
     caplog.set_level(logging.DEBUG)
     c = "{} --add {}".format(id_and_name.name, VIDEO_ID)
     try:
         assert nicotools.main(param(c))
     except utils.MylistAPIError as error:
         if not error.ok:
             print(error, file=sys.stderr)
Пример #9
0
 def send_param(self, cond, **kwargs):
     if isinstance(cond, str):
         cond = "download -l {_mail} -p {_pass} -d {save_dir} --loglevel DEBUG " + cond
         params = {
             "_mail": AUTH_N[0],
             "_pass": AUTH_N[1],
             "save_dir": SAVE_DIR_1,
             "video_id": " ".join(rand(0))
         }
         params.update(kwargs)
         arg = cond.format(**params).split(" ")
     else:
         arg = cond
     return nicotools.main(arg, async_=is_async)
Пример #10
0
 def send_param(self, cond, **kwargs):
     if is_async:
         cond = "download --nomulti -l {_mail} -p {_pass} -d {save_dir} --loglevel DEBUG " + cond
         time.sleep(1)
     else:
         cond = "download -l {_mail} -p {_pass} -d {save_dir} --loglevel DEBUG " + cond
     params = {
         "_mail": AUTH_N[0],
         "_pass": AUTH_N[1],
         "save_dir": SAVE_DIR_1,
         "video_id": " ".join(rand(0))
     }
     params.update(kwargs)
     return nicotools.main(cond.format(**params).split(" "),
                           async_=is_async)
Пример #11
0
 def test_no_args(self):
     with pytest.raises(SystemExit):
         nicotools.main(self.make_param(cond=None))
Пример #12
0
 def test_invalid_directory_on_windows(self):
     if os.name == "nt":
         with pytest.raises(SystemExit):
             nicotools.main(self.make_param("-c {video_id}",
                                            save_dir="nul"))
Пример #13
0
 def test_without_commands(self):
     with pytest.raises(SystemExit):
         nicotools.main(self.make_param("{video_id}"))
Пример #14
0
 def test_video_dmc_more(self):
     cond = "--limit 10 -v {video_id}"
     assert nicotools.main(self.make_param(cond))
Пример #15
0
 def test_video_dmc(self):
     cond = "-v {video_id}"
     assert nicotools.main(self.make_param(cond))
Пример #16
0
 def test_copy_to_same(self):
     with pytest.raises(SystemExit):
         c = "{} --copy * --to {}".format("なまえ", "なまえ")
         nicotools.main(param(c))
Пример #17
0
 def test_invalid_videoid(self):
     with pytest.raises(SystemExit):
         nicotools.main(self.make_param(["download", "-c", "sm9", "hello"]))
Пример #18
0
 def close(cls):
     # 終わったら片付けるための関数
     c = "{} --purge --id --yes".format(cls.id)
     nicotools.main(param(c))
Пример #19
0
 def test_export_meta(self):
     c = "* --export"
     assert nicotools.main(param(c))
Пример #20
0
 def test_show_meta_table(self):
     c = "* --show --show"
     assert nicotools.main(param(c))
Пример #21
0
 def test_no_commands(self):
     with pytest.raises(SystemExit):
         c = "とりあえずマイリスト"
         nicotools.main(param(c))
Пример #22
0
 def test_delete_ambiguous(self):
     with pytest.raises(SystemExit):
         c = "とりあえずマイリスト --delete sm9 *"
         nicotools.main(param(c))
Пример #23
0
 def test_copy_without_to(self):
     with pytest.raises(SystemExit):
         c = "とりあえずマイリスト --copy *"
         nicotools.main(param(c))
Пример #24
0
 def test_one_arg(self):
     with pytest.raises(SystemExit):
         nicotools.main(self.make_param(["download"]))
Пример #25
0
 def test_what_command(self):
     with pytest.raises(SystemExit):
         nicotools.main(self.make_param(["download", "-c", "sm9", "-w"]))
Пример #26
0
 def test_add_all(self):
     with pytest.raises(SystemExit):
         c = "とりあえずマイリスト --add *"
         nicotools.main(param(c))
Пример #27
0
 def test_notexisting(self):
     cond = "-v {video_id}"
     assert nicotools.main(self.make_param(cond, video_id="sm3"))
Пример #28
0
 def test_purge_deflist(self):
     with pytest.raises(SystemExit):
         c = "とりあえずマイリスト --purge"
         nicotools.main(param(c))
Пример #29
0
 def test_video_smile(self):
     cond = "--smile -v {video_id}"
     assert nicotools.main(self.make_param(cond))
Пример #30
0
 def test_show_everything_table(self):
     c = "* --show --show --everything"
     assert nicotools.main(param(c))