some cli tests
This commit is contained in:
parent
e231228721
commit
44bb2cf5e4
35
tests/test_cli.py
Normal file
35
tests/test_cli.py
Normal file
@ -0,0 +1,35 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import sys
|
||||
import os
|
||||
import pytest
|
||||
import argparse
|
||||
|
||||
sys.path.append("..")
|
||||
import waybackpy.cli as cli # noqa: E402
|
||||
from waybackpy.wrapper import Url # noqa: E402
|
||||
|
||||
def test_save():
|
||||
obj = Url("https://pypi.org/user/akamhy/", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/600.8.9 (KHTML, like Gecko) Version/8.0.8 Safari/600.8.9")
|
||||
cli._save(obj)
|
||||
|
||||
def test_get():
|
||||
args = argparse.Namespace(get='oldest')
|
||||
obj = Url("https://pypi.org/user/akamhy/", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/600.8.9 (KHTML, like Gecko) Version/8.0.8 Safari/600.8.9")
|
||||
cli._get(obj, args)
|
||||
args = argparse.Namespace(get='newest')
|
||||
cli._get(obj, args)
|
||||
args = argparse.Namespace(get='url')
|
||||
cli._get(obj, args)
|
||||
|
||||
def test_oldest():
|
||||
obj = Url("https://pypi.org/user/akamhy/", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/600.8.9 (KHTML, like Gecko) Version/8.0.8 Safari/600.8.9")
|
||||
cli._oldest(obj)
|
||||
|
||||
def test_newest():
|
||||
obj = Url("https://pypi.org/user/akamhy/", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/600.8.9 (KHTML, like Gecko) Version/8.0.8 Safari/600.8.9")
|
||||
cli._newest(obj)
|
||||
|
||||
def test_near():
|
||||
args = argparse.Namespace(year=2020, month=6, day=1, hour=1, minute=1)
|
||||
obj = Url("https://pypi.org/user/akamhy/", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/600.8.9 (KHTML, like Gecko) Version/8.0.8 Safari/600.8.9")
|
||||
cli._near(obj, args)
|
Loading…
Reference in New Issue
Block a user