def test_configure_keeplogs(): run('.conf keeplogs yes') run('message one', _user='******') assert run('.seen seentest') == lex.seen.last(text='message one') run('.conf keeplogs no') run('message two', _user='******') assert run('.seen seentest') == lex.seen.last(text='message one')
def test_onpage_not_found(): # this test should not be run under normal circumstances # as it is extremely time-consuming, requiring retrieval of over 300 # pages and taking over 10 minutes to run. return assert run('.onpage blahblhablah') == [ lex.onpage.working, lex.onpage.not_found]
def test_showtells_have_tells(): run('.tell user st1') run('.tell user st2') run('.tell user st3') assert run('.st', _user='******') == [ lex.tell.new(count=3), lex.tell.get(text='st1'), lex.tell.get(text='st2'), lex.tell.get(text='st3')]
def test_showtells_have_tells(): run('.tell user st1') run('.tell user st2') run('.tell user st3') assert run('.st', _user='******') == [ lex.tell.new(count=3), lex.tell.get(text='st1'), lex.tell.get(text='st2'), lex.tell.get(text='st3') ]
def test_quote_add(): assert run('.q add user quote1') == lex.quote.added assert run('.q add user quote2') == lex.quote.added assert run('.q add user quote3') == lex.quote.added assert run('.q add user quote4') == lex.quote.added assert run('.q add user2 quote5') == lex.quote.added assert run('.q add user2 quote6') == lex.quote.added
def test_quote_add(): assert run('.q add user quote1') == lex.quote.added assert run('.q add user quote2') == lex.quote.added assert run('.q add user quote3') == lex.quote.added assert run('.q add user quote4') == lex.quote.added assert run('.q add user2 quote5') == lex.quote.added assert run('.q add user2 quote6') == lex.quote.added
def test_memo_count(): assert run('.memo count') == lex.memo.count
def test_memo_not_found(): assert run('?user4') == lex.memo.not_found
def test_memo_delete_not_found(): assert run('.memo del user5') == lex.memo.not_found
def test_unused_simple(): assert run('.unused') == lex.unused.found(slot='scp-2258')
def test_memo_append(): assert run('.memo append user1 part2') == lex.memo.appended assert run('?user1') == lex.memo.get(text='memo1 part2')
def test_tell_multiple(): for i in range(50): run('!tell user test number', i) tells = run('-', _user='******') assert tells[0] == lex.tell.new(count=50) assert tells[1:] == [lex.tell.get for _ in range(50)]
def test_masstell_new_syntax(): assert run('.masstell user1 user2 user3 | new masstell') == lex.tell.send
def test_author_simple(): # the call to scp here is a code smell # run results should be always compared to lex objects directly # if they can't be, it means the output is too complicated assert run('.au anq') == lex.author.summary(name='anqxyr')
def test_author_ambiguous(): assert run('.au gears') == lex.unclear( options=['Dr Gears', 'TwistedGears'])
def test_unused_count(): assert run('.unused -c') == lex.unused.count(count=1217)
def test_unused_series(): assert run('.unused -c -s 1 2 3') == lex.unused.count(count=217)
def test_unused_divisible(): assert run('.unused -d 10 -s 3') == lex.unused.not_found
def test_unused_prime(): assert run('.unused -p') == lex.unused.found(slot='scp-2287')
def test_unused_last(): assert run('.unused -l') == lex.unused.found(slot='scp-3999')
def test_alert_echo_one(): assert run('.al echo') == lex.alert.echo(text='first alert')
def test_outbound_empty(): run('.out -p') assert run('.out') == lex.outbound.empty
def test_alert_set_past(): assert run('.al set 2000-01-01 mmm') == lex.alert.past
def test_outbound_simple(): run('.tell user test3') assert run('.out') == lex.outbound.count(count=1, users={'user'})
def test_outbound_empty(): run('.out -p') assert run('.out') == lex.outbound.empty
def test_memo_get_quick_case_insensitive(): assert run('?USER1') == lex.memo.get(text='memo1')
def test_masstell_arg_conflict(): assert ( run('.masstell user1 | text --cc user2') == lex.masstell.arg_conflict)
def test_search_fullname(): assert run('.s -f 1') == scp.show_page(page('1'))
def test_author_not_found(): assert run('.au fakeauthorname') == lex.author.not_found
def test_tell_no_new_tells(): assert not run('-')
def test_memo_get(): assert run('.memo user1') == lex.memo.get(text='memo1')
def test_author_default(): assert run('.au', _user='******') == lex.author.summary(name='anqxyr')
def test_memo_get_quick(): assert run('?user1') == lex.memo.get(text='memo1')
def test_author_showmore(): run('.au Jack') assert run('.sm 3') == lex.author.summary
def test_memo_add_case_insensitive(): run('.memo add USER3 memo3') assert run('?user3') == lex.memo.get(text='memo3')
def test_authordetails_showmore(): run('.ad Jack') assert run('.sm 3')
def test_memo_append_case_insensitive(): assert run('.MEMO APPEND USER1 part3') == lex.memo.appended assert run('?user1') == lex.memo.get(text='memo1 part2 part3')
def test_scp_lookup_simple(): assert run('scp-1200') == lex.page_lookup.summary
def test_memo_delete(): assert run('.memo del user1') == lex.memo.deleted(text='memo1 part2 part3') assert run('?user1') == lex.memo.not_found
def test_scp_lookup_not_found(): assert run('scp-7548') == lex.page_lookup.not_found
def test_tell_case_insensitive(): run('!tell USERNAME test2') assert run('-', _user='******') == [ lex.tell.new(count=1), lex.tell.get(name='test-user', text='test2') ]
def test_search_simple(): assert run('.s белки') == scp.show_page(page('scp-2797'))
def test_alert_set(): assert run('.al set 2d first alert') == lex.alert.set
def test_search_no_args(): assert run('.s') == lex.search.noargs
def test_alert_set_date(): assert run('.al set 2030-01-01 blahhhh') == lex.alert.set
def test_search_case_insensitive(): assert run('.s БЕЛКИ') == scp.show_page(page('scp-2797'))
def test_alert_echo_multiple(): run('.al set 1d 1') run('.al set 2d 2') run('.al set 3d 3') run('.al set 4d 4') run('.al set 5d 5') assert run('.al echo') == [ lex.alert.echo, lex.alert.echo, lex.alert.echo, lex.alert.echo, lex.alert.more(count=3) ]
def test_search_rating_simple(): assert run('.s -r >250') == lex.search.default(count=260)
def test_showtells_no_new(): assert run('.st') == lex.tell.no_new
def test_search_rating_range(): assert run('.s -r 80..120') == lex.search.default(count=915)
def test_masstell(): assert (run('.masstell --cc user1 user2 user3 user4 --text MASSTELL', _user='******') == lex.tell.send) assert run('.out', _user='******') == lex.outbound.count(count=4)
def test_search_tags_simple(): assert run('.s -t keter') == lex.search.default(count=374)
def test_masstell_syntax_mix(): assert run('.masstell | text --cc user1 user2') == lex.tell.send assert run('.masstell user1 user2 --text more text') == lex.tell.send
def test_search_author(): assert run('.s -a anqxyr') == lex.search.default(count=25)
def test_masstell_missing_args(): assert run('.masstell') == lex.masstell.missing_args assert run('.masstell --cc name') == lex.masstell.missing_args assert run('.masstell --text text') == lex.masstell.missing_args
def test_search_created_exact_date(): assert run('.s -c 2015-10-01') == scp.show_page(page('scp-2523'))
def test_outbound_simple(): run('.tell user test3') assert run('.out') == lex.outbound.count(count=1, users={'user'})
def test_seach_created_year_and_month(): assert run('.s -c 2015-10') == lex.search.default(count=33)