Beispiel #1
0
    def test_alias_addself(self):
        self.input.nick = 'Testsworth'
        self.input.group = lambda x: ['alias', 'add', 'Testsworth'][x]

        alias.c_alias(self.phenny, self.input)
        self.phenny.reply.assert_called_once_with(
            'I don\'t think that will be necessary.')
Beispiel #2
0
    def test_alias_listself(self):
        self.input.nick = 'Testsworth'
        alias.nick_aliases.append(['Testsworth', 'tests'])
        self.input.group = lambda x: ['alias', 'list', None][x]

        alias.c_alias(self.phenny, self.input)
        self.phenny.reply.assert_called_once_with(
            'Your current aliases are: Testsworth, tests.')
Beispiel #3
0
    def test_alias_listothers(self):
        self.input.nick = 'Testsworth'
        alias.nick_aliases.append(['happy', 'joyous'])
        self.input.group = lambda x: ['alias', 'list', 'happy'][x]

        alias.c_alias(self.phenny, self.input)
        self.phenny.reply.assert_called_once_with(
            'happy\'s current aliases are: happy, joyous.')
Beispiel #4
0
    def test_alias_alreadypaired(self):
        self.input.nick = 'Testsworth'
        alias.nick_aliases = [['Testsworth', 'tests']]

        self.input.group = lambda x: ['alias', 'add', 'tests'][x]

        alias.c_alias(self.phenny, self.input)
        self.phenny.reply.assert_called_once_with(
            'You and tests are already paired.')
Beispiel #5
0
    def test_alias_remove(self):
        self.input.nick = 'Testsworth'
        alias.nick_aliases = [['Testsworth', 'tests']]
        self.input.group = lambda x: ['alias', 'remove'][x]

        alias.c_alias(self.phenny, self.input)
        self.assertTrue(alias.aliasGroupFor('Testsworth') == ['Testsworth'])
        self.phenny.reply.assert_called_once_with(
            'You have removed Testsworth from its alias group')
Beispiel #6
0
    def test_alias_confirmreq(self):
        self.input.nick = 'Testsworth'
        alias.nick_aliases = []
        alias.nick_pairs.append(['tests', 'Testsworth'])

        self.input.group = lambda x: ['alias', 'add', 'tests'][x]

        alias.c_alias(self.phenny, self.input)
        self.phenny.reply.assert_called_once_with(
            'Confirmed alias request with tests. Your current aliases are: Testsworth, tests.'
        )
Beispiel #7
0
    def test_alias_valid(self):
        self.input.nick = 'Testsworth'
        alias.nick_aliases = []
        alias.nick_pairs = []

        self.input.group = lambda x: ['alias', 'add', 'tests'][x]

        alias.c_alias(self.phenny, self.input)
        self.phenny.reply.assert_called_once_with(
            'Alias request created. Switch your nick to tests and call \".alias add Testsworth\" to confirm.'
        )
Beispiel #8
0
    def test_alias_alreadysent(self):
        self.input.nick = 'Testsworth'
        alias.nick_aliases = []
        alias.nick_pairs.append(['Testsworth', 'tests'])

        self.input.group = lambda x: ['alias', 'add', 'tests'][x]

        alias.c_alias(self.phenny, self.input)
        self.phenny.reply.assert_called_once_with(
            'Alias request already exists. Switch your nick to tests and call \".alias add Testsworth\" to confirm.'
        )
Beispiel #9
0
    def test_alias_noadded(self):
        self.input.nick = 'Testsworth'
        self.input.group = lambda x: ['alias', 'add', None][x]

        alias.c_alias(self.phenny, self.input)
        self.phenny.reply.assert_called_once_with('Usage: .alias add <nick>')
Beispiel #10
0
 def create_alias(self, aliasName, input):
     self.input.group = lambda x: ['', 'add', aliasName][x]
     alias.c_alias(self.phenny, input)
     alias.aliasPairMerge(self.phenny, input.nick, aliasName)
Beispiel #11
0
    def test_alias_noinput(self):
        self.input.group = lambda x: ['alias', None][x]

        alias.c_alias(self.phenny, self.input)
        self.phenny.reply.assert_called_once_with(
            'Usage: .alias add <nick>, .alias list <nick>?, .alias remove')