Exemplo n.º 1
0
 def test_add_known_bug_first(self):
     with mock.patch.object(known_bugs_utils, 'PLUGIN_TMP_DIR',
                            self.tmpdir):
         known_bugs_utils.add_known_bug(1)
         ret = known_bugs_utils._get_known_bugs()
         self.assertEquals(ret,
                           {known_bugs_utils.MASTER_YAML_KNOWN_BUGS_KEY:
                            [{'id': 'https://bugs.launchpad.net/bugs/1',
                              'desc': 'no description provided',
                              'origin': 'testplugin.01part'}
                             ]})
Exemplo n.º 2
0
 def test_add_known_bug_first(self):
     with mock.patch.object(known_bugs_utils, 'PLUGIN_TMP_DIR',
                            self.tmpdir):
         known_bugs_utils.add_known_bug(1)
         ret = known_bugs_utils._get_known_bugs()
         self.assertEquals(
             ret, {
                 known_bugs_utils.MASTER_YAML_KNOWN_BUGS_KEY: [{
                     'https://bugs.launchpad.net/bugs/1':
                     'Microsoft has a majority market share'
                 }]
             })
Exemplo n.º 3
0
    def test_get_known_bugs(self):
        known_bugs = {known_bugs_utils.MASTER_YAML_KNOWN_BUGS_KEY:
                      [{'id': 'https://bugs.launchpad.net/bugs/1',
                        'desc': 'no description provided',
                        'origin': 'testplugin.01part'}]}
        with mock.patch.object(known_bugs_utils, 'PLUGIN_TMP_DIR',
                               self.tmpdir):
            with open(os.path.join(self.tmpdir, 'known_bugs.yaml'), 'w') as fd:
                fd.write(yaml.dump(known_bugs))

            ret = known_bugs_utils._get_known_bugs()
            self.assertEquals(ret, known_bugs)
Exemplo n.º 4
0
 def test_detect_known_bugs(self):
     with mock.patch.object(known_bugs_utils, 'PLUGIN_TMP_DIR',
                            self.tmpdir):
         known_bugs.detect_known_bugs()
         expected = {'bugs-detected':
                     [{'id': 'https://bugs.launchpad.net/bugs/1910958',
                       'desc':
                       ('Unit unit-rabbitmq-server-2 failed to start due '
                        'to members in relation 236 that cannot be '
                        'removed.'),
                       'origin': 'testplugin.01part'}]}
         self.assertEqual(known_bugs_utils._get_known_bugs(), expected)
Exemplo n.º 5
0
    def test_get_known_bugs(self):
        known_bugs = {
            "bugs": [{
                'https://bugs.launchpad.net/bugs/1':
                'Microsoft has a majority market share'
            }]
        }
        with mock.patch.object(known_bugs_utils, 'PLUGIN_TMP_DIR',
                               self.tmpdir):
            with open(os.path.join(self.tmpdir, 'known_bugs.yaml'), 'w') as fd:
                fd.write(yaml.dump(known_bugs))

            ret = known_bugs_utils._get_known_bugs()
            self.assertEquals(ret, known_bugs)
Exemplo n.º 6
0
    def test_add_known_bug(self):
        known_bugs = {
            known_bugs_utils.MASTER_YAML_KNOWN_BUGS_KEY: [{
                'https://bugs.launchpad.net/bugs/1':
                'Microsoft has a majority market share'
            }]
        }
        with mock.patch.object(known_bugs_utils, 'PLUGIN_TMP_DIR',
                               self.tmpdir):
            with open(os.path.join(self.tmpdir, 'known_bugs.yaml'), 'w') as fd:
                fd.write(yaml.dump(known_bugs))

            known_bugs_utils.add_known_bug(2)
            ret = known_bugs_utils._get_known_bugs()
            expected = {
                known_bugs_utils.MASTER_YAML_KNOWN_BUGS_KEY: [{
                    'https://bugs.launchpad.net/bugs/1':
                    'Microsoft has a majority market share'
                }, {
                    'https://bugs.launchpad.net/bugs/2':
                    'no description provided'
                }]
            }
            self.assertEquals(ret, expected)
Exemplo n.º 7
0
 def test_get_known_bugs_none(self):
     with mock.patch.object(known_bugs_utils, 'PLUGIN_TMP_DIR',
                            self.tmpdir):
         ret = known_bugs_utils._get_known_bugs()
         self.assertEquals(ret, None)