def test_extract_pixiv_other(): info = { "url": "https://www.pixiv.net/contest/fgo3", "time": "2019-07-28 15:04" } info_type, info_id = id_extractor.extract_pixiv_id(info) assert info_type == "other" assert info_id == -1
def test_extract_pixiv_art_id_format2(): info = { "url": "https://www.pixiv.net/en/artworks/77296788", "time": "2019-10-14 11:16", } info_type, info_id = id_extractor.extract_pixiv_id(info) assert info_type == "art" assert info_id == 77296788
def test_extract_pixiv_artist_id_user(): info = { "url": "https://www.pixiv.net/en/users/4429013", "time": "2020-02-22 10:40", } info_type, info_id = id_extractor.extract_pixiv_id(info) assert info_type == "artist" assert info_id == 4429013
def test_extract_pixiv_artist_id(): info = { "url": "http://www.pixiv.net/member.php?id=13044818", "time": "2017-02-02 11:30", } info_type, info_id = id_extractor.extract_pixiv_id(info) assert info_type == "artist" assert info_id == 13044818
def test_extract_pixiv_artist_id_with_fbclid(): info = { "url": "https://www.pixiv.net/member.php?id=673438&fbclid=IwAR1VTliqx9EzHFea4dXZ6giVCd7nRNR35Qs--b0tPnb0sad3HmZPB4ie-rE", "time": "2018-12-20 15:39", } info_type, info_id = id_extractor.extract_pixiv_id(info) assert info_type == "artist" assert info_id == 673438
def test_extract_pixiv_art_id_format2_with_fbclid(): info = { "url": "https://www.pixiv.net/en/artworks/76963557?fbclid=IwAR0fnjsiiOyx7cq3N3GoV567zIXnfiJbI5RPbiI9iXyg00rIhnh3WjmNOms", "time": "2019-09-25 11:44", } info_type, info_id = id_extractor.extract_pixiv_id(info) assert info_type == "art" assert info_id == 76963557
def test_extract_pixiv_art_id_format1_with_fbclid(): info = { "url": "https://www.pixiv.net/member_illust.php?mode=medium&illust_id=64864399&fbclid=IwAR1GGyuBkLsh454q7bXOj9t77cvpEkL8JVDoUoxT6ySFJp19zg5xJMWL94g", "time": "2018-08-25 12:13", } info_type, info_id = id_extractor.extract_pixiv_id(info) assert info_type == "art" assert info_id == 64864399
def test_extract_pixiv_art_id_format1(): info = { "url": "http://www.pixiv.net/member_illust.php?mode=medium&illust_id=61230245", "time": "2017-02-01 23:06", } info_type, info_id = id_extractor.extract_pixiv_id(info) assert info_type == "art" assert info_id == 61230245
def test_extract_pixiv_no_url(): info = {} info_type, info_id = id_extractor.extract_pixiv_id(info) assert info_type == "other" assert info_id == -1
def test_extract_pixiv_bad_url(): info = {"url": "apaowievz;xlcnwpoeaijsd"} info_type, info_id = id_extractor.extract_pixiv_id(info) assert info_type == "other" assert info_id == -1