コード例 #1
0
 def load_fisheye_data(self):
     # helper for importing xml data.
     with mock.patch(
         'ralph.cmdb.integration.lib.fisheye.Fisheye') as Fisheye:
         Fisheye.side_effect = MockFisheye
     x = pgi(fisheye_class=Fisheye)
     x.import_git()
コード例 #2
0
ファイル: tests.py プロジェクト: Makdaam/ralph
 def test_fisheye(self):
     """
     Create Venture/Role and import as CI/CIRelations.
     Now import fisheye xml from samples/* files and compare
     if changes are properly saved into the database,
     and reconcilated.
     """
     x = Venture(symbol="test_venture")
     x.save()
     y = VentureRole(name="test_role", venture=x)
     y.save()
     allegro_ci = CI(name="Allegro", type_id=CI_TYPES.VENTURE.id)
     allegro_ci.save()
     ct = ContentType.objects.get_for_model(x)
     test_venture, = CIImporter().import_all_ci([ct], asset_id=x.id)
     ct = ContentType.objects.get_for_model(y)
     test_role, = CIImporter().import_all_ci([ct], asset_id=y.id)
     CIImporter().import_relations(ContentType.objects.get_for_model(y), asset_id=y.id)
     with mock.patch("ralph.cmdb.integration.lib.fisheye.Fisheye") as Fisheye:
         Fisheye.side_effect = MockFisheye
         x = pgi(fisheye_class=Fisheye)
         x.import_git()
     self.assertEqual(
         CIChangeGit.objects.filter(
             author__contains="*****@*****.**",
             # file_paths__contains='/test_venture'
         ).count(),
         2,
     )
     self.assertEqual(CIChange.objects.filter(ci=test_role, type=CI_CHANGE_TYPES.CONF_GIT.id).count(), 2)
コード例 #3
0
 def load_fisheye_data(self):
     # helper for importing xml data.
     with mock.patch(
             'ralph.cmdb.integration.lib.fisheye.Fisheye') as Fisheye:
         Fisheye.side_effect = MockFisheye
     x = pgi(fisheye_class=Fisheye)
     x.import_git()
コード例 #4
0
ファイル: tests.py プロジェクト: iwwwwwwi/ralph
    def test_fisheye(self):
        """
        Create Venture/Role and import as CI/CIRelations.
        Now import fisheye xml from samples/* files and compare
        if changes are properly saved into the database,
        and reconcilated.
        """
        x = Venture(symbol='test_venture')
        x.save()
        y = VentureRole(name='test_role', venture=x)
        y.save()
        allegro_ci = CI(name='Allegro', type_id=CI_TYPES.VENTURE.id)
        allegro_ci.save()

        ct=ContentType.objects.get_for_model(x)
        test_venture, = CIImporter().import_all_ci([ct],asset_id=x.id)

        ct=ContentType.objects.get_for_model(y)
        test_role, = CIImporter().import_all_ci([ct],asset_id=y.id)

        CIImporter().import_relations(ContentType.objects.get_for_model(y),asset_id=y.id)

        with mock.patch('ralph.cmdb.integration.lib.fisheye.Fisheye') as Fisheye:
            Fisheye.side_effect = MockFisheye
            x = pgi(fisheye_class=Fisheye)
            x.import_git()

        self.assertEqual(CIChangeGit.objects.filter(
            author__contains='*****@*****.**',
            #file_paths__contains='/test_venture'
            ).count(), 2)

        self.assertEqual(CIChange.objects.filter(
            ci=test_role,
            type=CI_CHANGE_TYPES.CONF_GIT.id,
        ).count(), 2)