Exemplo n.º 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.')
Exemplo n.º 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.')
Exemplo n.º 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.')
Exemplo n.º 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.')
Exemplo n.º 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')
Exemplo n.º 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.'
        )
Exemplo n.º 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.'
        )
Exemplo n.º 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.'
        )
Exemplo n.º 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>')
Exemplo n.º 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)
Exemplo n.º 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')