def check_admin_input(n): """Tests admin with incorrect password""" line = parser.partition_raw(":StealthyLoner!foo@bar PRIVMSG SLPyBot :foo foo") response = parser.admin_input(line) if n > 0: assert response[0] == ('send_data', 'PRIVMSG StealthyLoner :You have been configured as admin, but you did not provide the correct password') assert response[1] == ('send_data', 'PRIVMSG StealthyLoner :You have ' + str(n) + ' tries left.') else: assert response[0] == ('send_data', 'PRIVMSG StealthyLoner :Sorry :(')
def test_admin_input_no_command(): """Tests admin with no command""" line = parser.partition_raw(":StealthyLoner!foo@bar PRIVMSG SLPyBot :mummo123") response = parser.admin_input(line) assert response == [('send_data', 'PRIVMSG StealthyLoner :Please provide a command')]
def test_admin_input_incorrect_admin(): """Tests admin with incorrect name""" line = parser.partition_raw(":foobar!foo@bar PRIVMSG SLPyBot :mummo123 foo") response = parser.admin_input(line) assert response == [('send_data', 'PRIVMSG foobar :This operation is not allowed by you')]