def assert_sample_nzb(f): assert f.poster == 'Joe Bloggs ([email protected])' assert f.date == parse_date(1071674882) assert f.subject == "Here's your file! abc-mr2a.r01 (1/2)" assert sorted(f.groups) == sorted(['alt.binaries.newzbin', 'alt.binaries.mojo']) first_segment = sorted(f.segments, key=lambda s: s.number)[0] assert first_segment.bytes == 102394 assert first_segment.number == 1 assert first_segment.message_id == '*****@*****.**' second_segment = sorted(f.segments, key=lambda s: s.number)[1] assert second_segment.bytes == 4501 assert second_segment.number == 2 assert second_segment.message_id == '*****@*****.**'
def assert_sample_nzb(f): assert f.poster == 'Joe Bloggs ([email protected])' assert f.date == parse_date(1071674882) assert f.subject == "Here's your file! abc-mr2a.r01 (1/2)" assert sorted(f.groups) == sorted( ['alt.binaries.newzbin', 'alt.binaries.mojo']) first_segment = sorted(f.segments, key=lambda s: s.number)[0] assert first_segment.bytes == 102394 assert first_segment.number == 1 assert first_segment.message_id == '*****@*****.**' second_segment = sorted(f.segments, key=lambda s: s.number)[1] assert second_segment.bytes == 4501 assert second_segment.number == 2 assert second_segment.message_id == '*****@*****.**'
def test_parse_date(): parser = BaseNZBParser() date = parse_date("1071674882") assert date == datetime.date(2003, 12, 17)