This commit is contained in:
parent
f5722a96b4
commit
651940372e
33
.gitea/workflows/test.yml
Normal file
33
.gitea/workflows/test.yml
Normal file
@ -0,0 +1,33 @@
|
||||
name: Run Limnoria Plugin Tests
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
# Step 1: Checkout the code from the repository
|
||||
- name: Checkout code
|
||||
run: |
|
||||
mkdir -p plugins
|
||||
git clone https://gitea.wildfiregames.com/${{ github.repository }} plugins/wfg --depth 1
|
||||
|
||||
# Step 2: Set up Python environment
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.9' # Use the Python version you need
|
||||
|
||||
# Step 3: Install dependencies
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
cd plugins/wfg
|
||||
pip install -r requirements.txt
|
||||
cd ../../
|
||||
|
||||
# Step 4: Run tests
|
||||
- name: Run Limnoria Plugin Tests
|
||||
run: |
|
||||
supybot-test -v --plugins-dir=plugins --no-network
|
62
test.py
62
test.py
@ -29,9 +29,71 @@
|
||||
###
|
||||
|
||||
from supybot.test import *
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
|
||||
class WFGTestCase(PluginTestCase):
|
||||
plugins = ('wfg',)
|
||||
config: dict[str, any] = {
|
||||
'supybot.plugins.wfg': True,
|
||||
'supybot.plugins.wfg.ticketUrl': "https://gitea.wildfiregames.com/0ad/0ad/issues/",
|
||||
'supybot.plugins.wfg.channels': ["#test"],
|
||||
}
|
||||
|
||||
def testTicketUrl(self):
|
||||
obj = self.irc.getCallback('wfg')
|
||||
obj.doPrivmsg(
|
||||
self.irc,
|
||||
ircmsgs.privmsg(self.config["supybot.plugins.wfg.channels"][0], "test")
|
||||
)
|
||||
count = 0
|
||||
msg = self.irc.takeMsg()
|
||||
while msg is not None:
|
||||
msg = self.irc.takeMsg()
|
||||
count += 1
|
||||
|
||||
self.assertEquals(count, 0)
|
||||
|
||||
obj.doPrivmsg(
|
||||
self.irc,
|
||||
ircmsgs.privmsg(self.config["supybot.plugins.wfg.channels"][0], "Sounds like #666")
|
||||
)
|
||||
count = 0
|
||||
msg = self.irc.takeMsg()
|
||||
while msg is not None:
|
||||
self.assertEquals(msg.nick, "")
|
||||
self.assertEquals(msg.args[0], self.config["supybot.plugins.wfg.channels"][0])
|
||||
self.assertEquals(msg.args[1], "#666 - Remove Devil – https://gitea.wildfiregames.com/0ad/0ad/issues/666")
|
||||
msg = self.irc.takeMsg()
|
||||
count += 1
|
||||
|
||||
self.assertEquals(count, 1)
|
||||
|
||||
def testPullRequestUrl(self):
|
||||
obj = self.irc.getCallback('wfg')
|
||||
obj.doPrivmsg(
|
||||
self.irc,
|
||||
ircmsgs.privmsg(self.config["supybot.plugins.wfg.channels"][0], "test")
|
||||
)
|
||||
count = 0
|
||||
msg = self.irc.takeMsg()
|
||||
while msg is not None:
|
||||
msg = self.irc.takeMsg()
|
||||
count += 1
|
||||
|
||||
self.assertEquals(count, 0)
|
||||
|
||||
obj.doPrivmsg(
|
||||
self.irc,
|
||||
ircmsgs.privmsg(self.config["supybot.plugins.wfg.channels"][0], "Sounds like it's fixed by #7028")
|
||||
)
|
||||
count = 0
|
||||
msg = self.irc.takeMsg()
|
||||
while msg is not None:
|
||||
self.assertEquals(msg.nick, "")
|
||||
self.assertEquals(msg.args[0], self.config["supybot.plugins.wfg.channels"][0])
|
||||
self.assertEquals(msg.args[1], "#7028 - Add yamllint to pre-commit – https://gitea.wildfiregames.com/0ad/0ad/pulls/7028")
|
||||
msg = self.irc.takeMsg()
|
||||
count += 1
|
||||
|
||||
self.assertEquals(count, 1)
|
||||
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
||||
|
Loading…
Reference in New Issue
Block a user