mirror of https://github.com/progval/Limnoria.git
Compare commits
10 Commits
b5e33c94f7
...
cbc2274179
Author | SHA1 | Date | |
---|---|---|---|
Aminda Suomalainen ⚧ | cbc2274179 | ||
Valentin Lorentz | f65089af86 | ||
Valentin Lorentz | 07834620f3 | ||
Valentin Lorentz | d435442b39 | ||
Valentin Lorentz | 6758c00363 | ||
Valentin Lorentz | 943f39745d | ||
Valentin Lorentz | c8030be71a | ||
Valentin Lorentz | 03c638705f | ||
GMDSantana | 03a3777129 | ||
Mikaela Suomalainen | c389be4f37 |
|
@ -15,14 +15,10 @@ Last rule: you shouldn't add a mandatory dependency. Limnoria does not
|
|||
come with any (besides Python), so please try to keep all dependencies
|
||||
optional.
|
||||
|
||||
[Style Guidelines]:https://limnoria.readthedocs.io/en/latest/develop/style.html
|
||||
[Style Guidelines]:https://docs.limnoria.net/develop/style.html
|
||||
|
||||
## Sending patches
|
||||
|
||||
When you send a pull request, **send it to the testing branch**.
|
||||
It will be merged to master when it's considered to be stable enough to be
|
||||
supported.
|
||||
|
||||
Don't fear that you spam Limnoria by sending many pull requests. According
|
||||
to @ProgVal, it's easier for them to accept pull requests than to
|
||||
cherry-pick everything manually.
|
||||
|
@ -32,6 +28,6 @@ is very appreciated.
|
|||
|
||||
See also [Contributing to Limnoria] at [Limnoria documentation].
|
||||
|
||||
[Contributing to Limnoria]:https://limnoria.readthedocs.io/en/latest/contribute/index.html
|
||||
[Contributing to Limnoria]:https://docs.limnoria.net/contribute/index.html
|
||||
|
||||
[Limnoria documentation]:https://limnoria.readthedocs.io/
|
||||
[Limnoria documentation]:https://docs.limnoria.net/
|
||||
|
|
|
@ -50,6 +50,7 @@ class AdminTestCase(PluginTestCase):
|
|||
self.irc.feedMsg(ircmsgs.join('#Baz', prefix=self.prefix))
|
||||
getAfterJoinMessages()
|
||||
self.assertRegexp('channels', '#bar, #Baz, and #foo')
|
||||
self.assertNotRegexp('config networks.test.channels', '.*#foo.*')
|
||||
|
||||
def testIgnoreAddRemove(self):
|
||||
self.assertNotError('admin ignore add foo!bar@baz')
|
||||
|
@ -87,13 +88,16 @@ class AdminTestCase(PluginTestCase):
|
|||
ircdb.users.delUser(u.id)
|
||||
|
||||
def testJoin(self):
|
||||
m = self.getMsg('join #foo')
|
||||
self.assertEqual(m.command, 'JOIN')
|
||||
self.assertEqual(m.args[0], '#foo')
|
||||
m = self.getMsg('join #foo key')
|
||||
self.assertEqual(m.command, 'JOIN')
|
||||
self.assertEqual(m.args[0], '#foo')
|
||||
self.assertEqual(m.args[1], 'key')
|
||||
try:
|
||||
m = self.getMsg('join #foo')
|
||||
self.assertEqual(m.command, 'JOIN')
|
||||
self.assertEqual(m.args[0], '#foo')
|
||||
m = self.getMsg('join #foo key')
|
||||
self.assertEqual(m.command, 'JOIN')
|
||||
self.assertEqual(m.args[0], '#foo')
|
||||
self.assertEqual(m.args[1], 'key')
|
||||
finally:
|
||||
conf.supybot.networks.test.channels.setValue('')
|
||||
|
||||
def testNick(self):
|
||||
try:
|
||||
|
@ -107,10 +111,13 @@ class AdminTestCase(PluginTestCase):
|
|||
self.assertError('admin capability add %s owner' % self.nick)
|
||||
|
||||
def testJoinOnOwnerInvite(self):
|
||||
self.irc.feedMsg(ircmsgs.invite(conf.supybot.nick(), '#foo', prefix=self.prefix))
|
||||
m = self.getMsg(' ')
|
||||
self.assertEqual(m.command, 'JOIN')
|
||||
self.assertEqual(m.args[0], '#foo')
|
||||
try:
|
||||
self.irc.feedMsg(ircmsgs.invite(conf.supybot.nick(), '#foo', prefix=self.prefix))
|
||||
m = self.getMsg(' ')
|
||||
self.assertEqual(m.command, 'JOIN')
|
||||
self.assertEqual(m.args[0], '#foo')
|
||||
finally:
|
||||
conf.supybot.networks.test.channels.setValue('')
|
||||
|
||||
def testNoJoinOnUnprivilegedInvite(self):
|
||||
try:
|
||||
|
@ -121,6 +128,7 @@ class AdminTestCase(PluginTestCase):
|
|||
'Error: "somecommand" is not a valid command.')
|
||||
finally:
|
||||
world.testing = True
|
||||
self.assertNotRegexp('config networks.test.channels', '.*#foo.*')
|
||||
|
||||
def testAcmd(self):
|
||||
self.irc.feedMsg(ircmsgs.join('#foo', prefix=self.prefix))
|
||||
|
|
|
@ -991,9 +991,14 @@ class Channel(callbacks.Plugin):
|
|||
network = conf.supybot.networks.get(irc.network)
|
||||
network.channels().remove(channel)
|
||||
except KeyError:
|
||||
pass
|
||||
if channel not in irc.state.channels:
|
||||
irc.error(_('I\'m not in %s.') % channel, Raise=True)
|
||||
if channel not in irc.state.channels:
|
||||
# Not configured AND not in the channel
|
||||
irc.error(_('I\'m not in %s.') % channel, Raise=True)
|
||||
else:
|
||||
if channel not in irc.state.channels:
|
||||
# Configured, but not in the channel
|
||||
irc.reply(_('%s removed from configured join list.') % channel)
|
||||
return
|
||||
reason = (reason or self.registryValue("partMsg", channel, irc.network))
|
||||
reason = ircutils.standardSubstitute(irc, msg, reason)
|
||||
irc.queueMsg(ircmsgs.part(channel, reason))
|
||||
|
|
|
@ -108,8 +108,9 @@ def isReadOnly(name):
|
|||
def checkCanSetValue(irc, msg, group):
|
||||
if isReadOnly(group._name):
|
||||
irc.error(_("This configuration variable is not writeable "
|
||||
"via IRC. To change it you have to: 1) use the 'flush' command 2) edit "
|
||||
"the config file 3) use the 'config reload' command."), Raise=True)
|
||||
"via IRC. To change it you have to: 1) use the 'flush' command "
|
||||
"2) use the 'config flush false' command 3) edit the config "
|
||||
"file 4) use the 'config reload' command."), Raise=True)
|
||||
capability = getCapability(irc, group._name)
|
||||
if not ircdb.checkCapability(msg.prefix, capability):
|
||||
irc.errorNoCapability(capability, Raise=True)
|
||||
|
|
|
@ -154,7 +154,7 @@ class Web(callbacks.PluginRegexp):
|
|||
if parsed_url.netloc == 'youtube.com' \
|
||||
or parsed_url.netloc.endswith(('.youtube.com')):
|
||||
# there is a lot of Javascript before the <title>
|
||||
size = max(409600, size)
|
||||
size = max(819200, size)
|
||||
if parsed_url.netloc in ('reddit.com', 'www.reddit.com', 'new.reddit.com'):
|
||||
# Since 2022-03, New Reddit has 'Reddit - Dive into anything' as
|
||||
# <title> on every page.
|
||||
|
|
|
@ -36,6 +36,7 @@ import sys
|
|||
import time
|
||||
import shutil
|
||||
import fnmatch
|
||||
from tempfile import TemporaryDirectory
|
||||
started = time.time()
|
||||
|
||||
import supybot
|
||||
|
@ -43,21 +44,24 @@ import logging
|
|||
import traceback
|
||||
|
||||
# We need to do this before we import conf.
|
||||
if not os.path.exists('test-conf'):
|
||||
os.mkdir('test-conf')
|
||||
main_temp_dir = TemporaryDirectory()
|
||||
|
||||
registryFilename = os.path.join('test-conf', 'test.conf')
|
||||
fd = open(registryFilename, 'w')
|
||||
fd.write("""
|
||||
os.makedirs(os.path.join(main_temp_dir.name, 'conf'))
|
||||
os.makedirs(os.path.join(main_temp_dir.name, 'data'))
|
||||
os.makedirs(os.path.join(main_temp_dir.name, 'logs'))
|
||||
|
||||
registryFilename = os.path.join(main_temp_dir.name, 'conf', 'test.conf')
|
||||
with open(registryFilename, 'w') as fd:
|
||||
fd.write("""
|
||||
supybot.directories.backup: /dev/null
|
||||
supybot.directories.conf: %(base_dir)s/test-conf
|
||||
supybot.directories.data: %(base_dir)s/test-data
|
||||
supybot.directories.log: %(base_dir)s/test-logs
|
||||
supybot.directories.conf: {temp_conf}
|
||||
supybot.directories.data: {temp_data}
|
||||
supybot.directories.log: {temp_logs}
|
||||
supybot.reply.whenNotCommand: True
|
||||
supybot.log.stdout: False
|
||||
supybot.log.stdout.level: ERROR
|
||||
supybot.log.level: DEBUG
|
||||
supybot.log.format: %%(levelname)s %%(message)s
|
||||
supybot.log.format: %(levelname)s %(message)s
|
||||
supybot.log.plugins.individualLogfiles: False
|
||||
supybot.protocols.irc.throttleTime: 0
|
||||
supybot.reply.whenAddressedBy.chars: @
|
||||
|
@ -67,8 +71,11 @@ supybot.networks.testnet2.server: should.not.need.this
|
|||
supybot.networks.testnet3.server: should.not.need.this
|
||||
supybot.nick: test
|
||||
supybot.databases.users.allowUnregistration: True
|
||||
""" % {'base_dir': os.getcwd()})
|
||||
fd.close()
|
||||
""".format(
|
||||
temp_conf=os.path.join(main_temp_dir.name, 'conf'),
|
||||
temp_data=os.path.join(main_temp_dir.name, 'data'),
|
||||
temp_logs=os.path.join(main_temp_dir.name, 'logs')
|
||||
))
|
||||
|
||||
import supybot.registry as registry
|
||||
registry.open_registry(registryFilename)
|
||||
|
@ -251,6 +258,9 @@ def main():
|
|||
if result.wasSuccessful():
|
||||
sys.exit(0)
|
||||
else:
|
||||
# Deactivate autocleaning for the temporary directiories to allow inspection.
|
||||
main_temp_dir._finalizer.detach()
|
||||
print(f"Temporary directory path: {main_temp_dir.name}")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue