Skip to content

Commit

Permalink
Merge ravench/buildbot:sayhello_2 (PR #1784)
Browse files Browse the repository at this point in the history
+wrap long line
  • Loading branch information
djmitche committed Aug 30, 2015
2 parents 7be0a1c + 9217c2c commit 7b99592
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
25 changes: 24 additions & 1 deletion master/buildbot/status/words.py
@@ -1,3 +1,4 @@
# coding: utf-8
# This file is part of Buildbot. Buildbot is free software: you can
# redistribute it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation, version 2.
Expand Down Expand Up @@ -39,6 +40,26 @@
from buildbot.status.results import SUCCESS
from buildbot.status.results import WARNINGS

# Used in command_HELLO and it's test. 'Hi' in 100 languages.

GREETINGS = [
"ږغ كول ، هركلى كول ږغ، هركلى", "Goeie dag", "Tungjatjeta",
"Yatasay", "Ahlan bik", "Voghdzuyin", "hola", "kaixo", "Horas",
"Pryvitańnie", "Nomoskar", "Oki", "Selam", "Dez-mat", "Zdrávejte",
"Mingala ba", "Hola", "Hafa dai", "Oh-see-YOH", "Nín hao", "Bonjou",
"Zdravo", "Nazdar", "Hallo", "Hallo", "Iiti", "Kotáka", "Saluton", "Tere",
"Hallo", "Hallo", "Bula", "Helo", "Hei", "Goede morgen", "Bonjour", "Hoi",
"Ola", "Gamardžoba", "Guten Tag", "Mauri", "Geia!", "Inuugujoq", "Kem cho",
"Sannu", "Aloha", "Shalóm", "Namasté", "Szia", "Halló", "Hai", "Kiana",
"Dia is muire dhuit", "Buongiorno", "Kónnichi wa", "Salam",
"Annyeonghaseyo", "Na", "Sabai dii", "Ave", "Es mīlu tevi", "Labas.",
"Selamat petang", "Ni hao", "Kia ora", "Yokwe", "Kwe", "sain baina uu",
"niltze", "Yá'át'ééh", "Namaste", "Hallo.", "Salâm", "Witajcie", "Olá",
"Kâils", "Aroha", "Salut", "Privét", "Talofa", "Namo namah", "ćao",
"Nazdar", "Zdravo", "Hola", "Jambo", "Hej", "Sälü", "Halo", "Selam",
"Sàwàtdee kráp", "Dumela", "Merhaba", "Pryvít", "Adaab arz hai", "Chào",
"Glidis", "Helo", "Sawubona", "Hoi"]


# This should probably move to the irc class.
def maybeColorize(text, color, useColors):
Expand Down Expand Up @@ -159,6 +180,7 @@ def __init__(self, bot, user=None, channel=None):

self.user = user
self.channel = channel
self._next_HELLO = 'yes?'

# silliness

Expand Down Expand Up @@ -275,7 +297,8 @@ def splitArgs(self, args):
raise UsageError(e)

def command_HELLO(self, args):
self.send("yes?")
self.send(self._next_HELLO)
self._next_HELLO = random.choice(GREETINGS)

def command_VERSION(self, args):
self.send("buildbot-%s at your service" % version)
Expand Down
7 changes: 7 additions & 0 deletions master/buildbot/test/unit/test_status_words.py
Expand Up @@ -300,6 +300,13 @@ def test_command_hustle(self):
yield self.do_test_command('hustle', clock_ticks=[1.0] * 2, exp_usage=False)
self.assertEqual(self.actions, ['does the hustle'])

@defer.inlineCallbacks
def test_command_hello(self):
yield self.do_test_command('hello', exp_usage=False)
self.assertEqual(self.sent, ['yes?'])
yield self.do_test_command('hello', exp_usage=False)
self.assertIn(self.sent[0], words.GREETINGS)

@defer.inlineCallbacks
def test_command_list(self):
yield self.do_test_command('list', exp_UsageError=True)
Expand Down
2 changes: 1 addition & 1 deletion master/docs/relnotes/index.rst
Expand Up @@ -14,7 +14,7 @@ Master

Features
~~~~~~~~

* ``hello`` now returns 'Hello' in a random language if invoked more than once.

* :bb:sched:`Triggerable` now accepts a ``reason`` parameter.

Expand Down

0 comments on commit 7b99592

Please sign in to comment.