예제 #1
0
 def test_select_tasks_select_nothing(self):
     '''calling tl with category only and answering nothing'''
     with patch('builtins.input', return_value=''):
         tl.select_tasks('ua')
         output = sys.stdout.getvalue().strip()
         self.assertEqual(output, '1) SF7-openafs\n2) SF801-kdump')
         self.assertEqual(tl.select_tasks('ua'), (None, None))
예제 #2
0
 def test_select_tasks_out_of_range(self):
     '''calling tl with category only and giving out of range answer'''
     with patch('builtins.input', return_value='3'):
         tl.select_tasks('ua')
         output = sys.stdout.getvalue().strip()
         self.assertEqual(output, '1) SF7-openafs\n2) SF801-kdump\nInvalid task number')
         self.assertEqual(tl.select_tasks('ua'), (None, None))
예제 #3
0
파일: test_tl.py 프로젝트: dargad/tl
    def test_select_tasks_out_of_range(self):
        '''testing category only and giving out of range answer'''
        with patch('builtins.input', return_value='3'):
            tl.select_tasks('ua')
            output = sys.stdout.getvalue().strip()
            self.assertEqual(output, """1) SF801-kdump
2) SF7-openafs
Invalid task number""")
예제 #4
0
    def test_select_tasks_out_of_range(self):
        '''testing category only and giving out of range answer'''
        with patch('builtins.input', return_value='3'):
            tl.select_tasks('ua')
            output = sys.stdout.getvalue().strip()
            self.assertEqual(
                output, """1) SF801-kdump
2) SF7-openafs
Invalid task number""")
예제 #5
0
파일: test_tl.py 프로젝트: dargad/tl
    def test_category_with_31_items_task_21(self):
        '''testing category with 31 entries and selecting twenty-first task'''
        with patch('builtins.input', return_value='21'):
            self.assertEqual(tl.select_tasks('lp'), ('lp', 'juju'))
            output = sys.stdout.getvalue().strip()
            self.assertEqual(output, """1) what
2) false
3) true
4) ifenslave
5) autoconf
6) autotools
7) make
8) grep
9) awk
10) binutils""")
예제 #6
0
파일: test_tl.py 프로젝트: dargad/tl
    def test_category_with_12_items_last_selection(self):
        '''testing category with 12 entries and selecting first task'''
        with patch('builtins.input', return_value='11'):
            self.assertEqual(tl.select_tasks('train'), ('train', 'python'))
            output = sys.stdout.getvalue().strip()
            self.assertEqual(output, """1) pascal
2) basic
3) erlang
4) nodejs
5) java
6) go
7) perl
8) apl
9) c
10) ruby""")
예제 #7
0
파일: test_tl.py 프로젝트: dargad/tl
    def test_category_with_exactly_10_items_no_selection(self):
        '''testing category with 10 entries and no selection'''
        with patch('builtins.input', return_value=''):
            self.assertEqual(tl.select_tasks('meet'), (None, None))
            output = sys.stdout.getvalue().strip()
            self.assertEqual(output, """1) mom
2) kernel
3) sabdfl
4) server
5) foundation
6) mgr
7) team
8) supp
9) juju
10) maas""")
예제 #8
0
    def test_category_with_31_items_task_21(self):
        '''testing category with 31 entries and selecting twenty-first task'''
        with patch('builtins.input', return_value='21'):
            self.assertEqual(tl.select_tasks('lp'), ('lp', 'juju'))
            output = sys.stdout.getvalue().strip()
            self.assertEqual(
                output, """1) what
2) false
3) true
4) ifenslave
5) autoconf
6) autotools
7) make
8) grep
9) awk
10) binutils""")
예제 #9
0
    def test_category_with_12_items_last_selection(self):
        '''testing category with 12 entries and selecting first task'''
        with patch('builtins.input', return_value='11'):
            self.assertEqual(tl.select_tasks('train'), ('train', 'python'))
            output = sys.stdout.getvalue().strip()
            self.assertEqual(
                output, """1) pascal
2) basic
3) erlang
4) nodejs
5) java
6) go
7) perl
8) apl
9) c
10) ruby""")
예제 #10
0
    def test_category_with_exactly_10_items_no_selection(self):
        '''testing category with 10 entries and no selection'''
        with patch('builtins.input', return_value=''):
            self.assertEqual(tl.select_tasks('meet'), (None, None))
            output = sys.stdout.getvalue().strip()
            self.assertEqual(
                output, """1) mom
2) kernel
3) sabdfl
4) server
5) foundation
6) mgr
7) team
8) supp
9) juju
10) maas""")
예제 #11
0
파일: test_tl.py 프로젝트: dargad/tl
 def test_select_tasks_select_first_task(self):
     '''testing category only and selecting first task'''
     with patch('builtins.input', return_value='1'):
         self.assertEqual(tl.select_tasks('ua'), ('ua', 'SF801-kdump'))
         output = sys.stdout.getvalue().strip()
         self.assertEqual(output, '1) SF801-kdump\n2) SF7-openafs')
예제 #12
0
파일: test_tl.py 프로젝트: dargad/tl
 def test_select_tasks_select_0(self):
     '''testing category only and answering 0'''
     with patch('builtins.input', return_value='0'):
         self.assertEqual(tl.select_tasks('ua'), (None, None))
         output = sys.stdout.getvalue().strip()
         self.assertEqual(output, '1) SF801-kdump\n2) SF7-openafs')
예제 #13
0
 def test_select_tasks_select_first_task(self):
     '''testing category only and selecting first task'''
     with patch('builtins.input', return_value='1'):
         self.assertEqual(tl.select_tasks('ua'), ('ua', 'SF801-kdump'))
         output = sys.stdout.getvalue().strip()
         self.assertEqual(output, '1) SF801-kdump\n2) SF7-openafs')
예제 #14
0
 def test_select_tasks_select_nothing(self):
     '''testing category only and answering nothing'''
     with patch('builtins.input', return_value=''):
         self.assertEqual(tl.select_tasks('ua'), (None, None))
         output = sys.stdout.getvalue().strip()
         self.assertEqual(output, '1) SF801-kdump\n2) SF7-openafs')
예제 #15
0
 def test_select_tasks_select_valid(self):
     '''calling tl with category only and selecting first task'''
     with patch('builtins.input', return_value='1'):
         tl.select_tasks('ua')
         self.assertEqual(tl.select_tasks('ua'), ('ua', 'SF7-openafs'))