Esempio n. 1
0
    def test_modify_user_input(self, mock_super):
        command = copy_commands.PackageCopyCommand(self.context, 'copy', '',
                                                   '')
        user_input = {'a': 'a'}
        command.modify_user_input(user_input)

        # The super call is required.
        self.assertEqual(1, mock_super.call_count)

        # The user_input variable itself should be modified.
        self.assertEqual(user_input, {'a': 'a', 'fields': UNIT_KEY_RPM})
Esempio n. 2
0
    def test_get_formatter_for_type(self):
        command = copy_commands.PackageCopyCommand(self.context, 'copy', '',
                                                   '')

        # get a formatter and make sure it can be used
        formatter = command.get_formatter_for_type(TYPE_ID_RPM)
        unit_string = formatter({
            'name': 'package1',
            'version': '1.2.3',
            'release': '1',
            'arch': 'x86_64'
        })

        # make sure the name appears in the formatted string somewhere, which
        # seems like a reasonable assumption for any implementation of such
        # a formatter
        self.assertTrue(unit_string.find('package1') >= 0)
Esempio n. 3
0
 def test_sort(self, mock_parse):
     command = copy_commands.PackageCopyCommand(self.context, 'copy', '',
                                                '')
     command._parse_sort('foo')
     mock_parse.assert_called_once_with(copy_commands.RecursiveCopyCommand,
                                        'foo')
Esempio n. 4
0
 def test_key_value(self, mock_parse):
     command = copy_commands.PackageCopyCommand(self.context, 'copy', '',
                                                '')
     command._parse_key_value('foo')
     mock_parse.assert_called_once_with('foo')