Completed
Pull Request — stable (#56)
by Sydney
39s
created

TestCommandSuite.test_command_change_args()   A

Complexity

Conditions 1

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
c 0
b 0
f 0
rs 9.4285
cc 1
1
#    Copyright 2017 Starbot Discord Project
2
# 
3
#    Licensed under the Apache License, Version 2.0 (the "License");
4
#    you may not use this file except in compliance with the License.
5
#    You may obtain a copy of the License at
6
# 
7
#        http://www.apache.org/licenses/LICENSE-2.0
8
# 
9
#    Unless required by applicable law or agreed to in writing, software
10
#    distributed under the License is distributed on an "AS IS" BASIS,
11
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
#    See the License for the specific language governing permissions and
13
#    limitations under the License.
14
15
import unittest
16
17
from api import command
18
19
class TestCommandSuite(unittest.TestCase):
20
21
    def test_command_basic_args(self):
22
        cmd_test = command.Command(unittest, 'testplugin')
23
        self.assertEqual(cmd_test.name, 'testplugin')
24
        self.assertEqual(cmd_test.plugin, unittest)
25
        self.assertEqual(cmd_test.shortdesc, 'no description')
26
        self.assertEqual(cmd_test.devcommand, False)
27
28
    def test_command_overwrite(self):
29
        cmd_test = command.Command(unittest, 'testplugin')
30
        self.assertEqual(cmd_test.name, 'testplugin')
31
        self.assertEqual(cmd_test.plugin, unittest)
32
        self.assertEqual(cmd_test.shortdesc, 'no description')
33
        self.assertEqual(cmd_test.devcommand, False)
34
35
        cmd_test = command.Command(unittest, 'testplugin', shortdesc='python testing is fun!')
36
        self.assertEqual(cmd_test.name, 'testplugin')
37
        self.assertEqual(cmd_test.plugin, unittest)
38
        self.assertEqual(cmd_test.shortdesc, 'python testing is fun!')
39
        self.assertEqual(cmd_test.devcommand, False)
40
41
    def test_command_args(self):
42
        cmd_test = command.Command(unittest, 'testplugin', shortdesc='python testing is fun!', devcommand=True)
43
        self.assertEqual(cmd_test.name, 'testplugin')
44
        self.assertEqual(cmd_test.plugin, unittest)
45
        self.assertEqual(cmd_test.shortdesc, 'python testing is fun!')
46
        self.assertEqual(cmd_test.devcommand, True)
47
48
    def test_command_change_args(self):
49
        cmd_test = command.Command(unittest, 'testplugin', shortdesc='python testing is fun!')
50
        self.assertEqual(cmd_test.name, 'testplugin')
51
        self.assertEqual(cmd_test.plugin, unittest)
52
        self.assertEqual(cmd_test.shortdesc, 'python testing is fun!')
53
        self.assertEqual(cmd_test.devcommand, False)
54
55
        cmd_test.shortdesc = 'We\'ve changed the description!'
56
        self.assertEqual(cmd_test.name, 'testplugin')
57
        self.assertEqual(cmd_test.plugin, unittest)
58
        self.assertEqual(cmd_test.shortdesc, 'We\'ve changed the description!')
59
        self.assertEqual(cmd_test.devcommand, False)
60
61
if __name__ == '__main__':
62
    unittest.main()