Пример #1
0
    def test_display_modules_over_threshold(self):
        # Test
        copied_modules = self._generate_copied_modules(10)
        units_display.display_modules(self.prompt, copied_modules, 5)

        # Verify
        self.assertEqual(['too-many'], self.prompt.get_write_tags())
        self.assertTrue('10' in self.recorder.lines[0])
    def test_display_modules_over_threshold(self):
        # Test
        copied_modules = self._generate_copied_modules(10)
        units_display.display_modules(self.prompt, copied_modules, 5)

        # Verify
        self.assertEqual(['too-many'], self.prompt.get_write_tags())
        self.assertTrue('10' in self.recorder.lines[0])
    def test_display_modules_show_modules(self):
        # Test
        copied_modules = self._generate_copied_modules(2)

        # Reverse here so we can check the sort takes place in the method
        copied_modules.sort(key=lambda x : x['unit_key']['author'], reverse=True)

        units_display.display_modules(self.prompt, copied_modules, 10)

        # Verify
        expected_tags = ['just-enough', 'module', 'module']  # header + one line for each module
        self.assertEqual(expected_tags, self.prompt.get_write_tags())
        self.assertTrue('Modules' in self.recorder.lines[0])

        # Verify the sorting was done
        self.assertTrue('0' in self.recorder.lines[1])
        self.assertTrue('1' in self.recorder.lines[2])
Пример #4
0
    def test_display_modules_show_modules(self):
        # Test
        copied_modules = self._generate_copied_modules(2)

        # Reverse here so we can check the sort takes place in the method
        copied_modules.sort(key=lambda x: x['unit_key']['author'],
                            reverse=True)

        units_display.display_modules(self.prompt, copied_modules, 10)

        # Verify
        expected_tags = ['just-enough', 'module',
                         'module']  # header + one line for each module
        self.assertEqual(expected_tags, self.prompt.get_write_tags())
        self.assertTrue('Modules' in self.recorder.lines[0])

        # Verify the sorting was done
        self.assertTrue('0' in self.recorder.lines[1])
        self.assertTrue('1' in self.recorder.lines[2])
    def test_display_modules_zero_count(self):
        # Test
        units_display.display_modules(self.prompt, [], 10)

        # Verify
        self.assertEqual(['too-few'], self.prompt.get_write_tags())
Пример #6
0
 def succeeded(self, task):
     copied_modules = task.result  # list of dict containing unit_key and type_id
     units_display.display_modules(self.prompt, copied_modules, self.module_count_threshold)
Пример #7
0
 def succeeded(self, task):
     copied_modules = task.result  # list of dict containing unit_key and type_id
     units_display.display_modules(self.prompt, copied_modules,
                                   self.module_count_threshold)
Пример #8
0
    def test_display_modules_zero_count(self):
        # Test
        units_display.display_modules(self.prompt, [], 10)

        # Verify
        self.assertEqual(['too-few'], self.prompt.get_write_tags())