Example #1
0
def test_get_good_infohashes_bad_infohash(mixed_infohashes):
    scraper_ = scraper.Scraper(infohashes=["88334ec1d90afe94a22c6de575626"])
    assert scraper_.get_good_infohashes() == []
    scraper_ = scraper.Scraper(infohashes=mixed_infohashes)
    assert scraper_.get_good_infohashes() == [
        "88334ec1d90afe94a22c6de5756268599f5f8ea2",
        "5b6a484a018beed4d01f2f57e6d029a4190a9d04",
    ]
Example #2
0
def scraper_basic():
    """
    Returns scraper instance initialized with trackers and infohashes.
    """
    scraper_ = scraper.Scraper(
        trackers=["udp://bt2.archive.org:6969"],
        infohashes=["73C36F980F5B1A40348678036575CCC1E0BB0E4E"],
    )
    scraper_.connection = Connection("bt2.archive.org", 6969, 10)

    # Use together
    scraper_.connect_response = b"\x00\x00\x00\x00\x00\x008@P\x87\xe0m\x108\xf6r"
    scraper_.transaction_id = 14400  # fixed in return value of socket.recv
    scraper_.connection_id = (
        5802853403918399090  #  fixed in return value of socket.recv
    )

    return scraper_
Example #3
0
def test_get_good_infohashes_string_type_with_multiple_commas(good_infohashes):
    scraper_ = scraper.Scraper(
        infohashes="88334ec1d90afe94a22c6de5756268599f5f8ea2,5b6a484a018beed4d01f2f57e6d029a4190a9d04, , ,"
    )
    assert scraper_.get_good_infohashes() == good_infohashes
Example #4
0
def test_get_good_infohashes_with_multiple_infohashes(good_infohashes):
    scraper_ = scraper.Scraper(infohashes=good_infohashes)
    assert scraper_.get_good_infohashes() == good_infohashes
Example #5
0
def test_get_good_infohashes_single_infohash(good_infohashes):
    scraper_ = scraper.Scraper(infohashes=good_infohashes[0])
    assert scraper_.get_good_infohashes() == [good_infohashes[0]]
Example #6
0
def test_get_good_infohashes_empty_list():
    scraper_ = scraper.Scraper(infohashes=[])
    assert scraper_.get_good_infohashes() == []
Example #7
0
def test_get_good_infohashes():
    scraper_ = scraper.Scraper()
    assert scraper_.get_good_infohashes() == []