예제 #1
0
파일: test_event.py 프로젝트: Uninett/Argus
 def test_new_stateless_incident_has_stateless_event(self):
     source_incident_id = "abcknekkebrod"
     incident = Incident.objects.create(
         start_time=timezone.now(),
         end_time=None,
         source_incident_id=source_incident_id,
         source=SourceSystemFactory(),
         description=f"Incident #{source_incident_id} created for testing",
     )
     event_stateless = incident.events.filter(type=Event.Type.STATELESS)
     self.assertEqual(1, event_stateless.count())
예제 #2
0
파일: test_event.py 프로젝트: Uninett/Argus
    def test_event_has_description(self):
        source_incident_id = "abcknekkebrod"
        incident = Incident.objects.create(
            start_time=timezone.now(),
            end_time=datetime_utils.INFINITY_REPR,
            source_incident_id=source_incident_id,
            source=SourceSystemFactory(),
            description=f"Incident #{source_incident_id} created for testing",
        )
        event_start = incident.events.filter(type=Event.Type.INCIDENT_START)

        self.assertTrue(event_start)
        self.assertEqual(incident.description, incident.events.get(type="STA").description)
예제 #3
0
파일: __init__.py 프로젝트: hmpf/Argus
    def init_test_objects(self):
        self.source_type1 = SourceSystemTypeFactory(name="type1")
        self.source1_user = SourceUserFactory(username="******")
        self.source1 = SourceSystemFactory(name="System 1",
                                           type=self.source_type1,
                                           user=self.source1_user)

        self.user1 = AdminUserFactory(username="******")

        self.user1_rest_client = APIClient()
        self.user1_rest_client.force_authenticate(user=self.user1)

        self.source1_rest_client = APIClient()
        self.source1_rest_client.force_authenticate(user=self.source1_user)
예제 #4
0
 def setUp(self):
     disconnect_signals()
     # Lock in timestamps
     self.timestamp = timezone.now()
     # We don't care about source but let's ensure it is unique
     source = SourceSystemFactory()
     self.incident1 = StatelessIncidentFactory(source=source,
                                               start_time=self.timestamp,
                                               ticket_url="")
     self.incident2 = StatefulIncidentFactory(source=source,
                                              start_time=self.timestamp,
                                              ticket_url="")
     self.incident3 = StatefulIncidentFactory(source=source,
                                              start_time=self.timestamp,
                                              ticket_url="")
     self.incident4 = StatefulIncidentFactory(source=source,
                                              start_time=self.timestamp)
     self.incident4.end_time = self.timestamp
     self.incident4.save()
예제 #5
0
파일: create_source.py 프로젝트: hmpf/Argus
 def handle(self, *args, **options):
     source = options["source"]
     source_type = options.get("source_type") or "argus"
     sst = SourceSystemTypeFactory(name=source_type)
     ss = SourceSystemFactory(name=source, type=sst)
예제 #6
0
 def setUp(self):
     self.source_no_base_url = SourceSystemFactory.build(base_url="")
     self.base_url = "https://someticketsystem.example.org"
     self.source_has_base_url = SourceSystemFactory.build(base_url=self.base_url)
예제 #7
0
 def setUpClass(cls):
     disconnect_signals()
     source_type = SourceSystemTypeFactory()
     cls.user = SourceUserFactory()
     cls.source = SourceSystemFactory(type=source_type, user=cls.user)
예제 #8
0
 def setUp(self):
     disconnect_signals()
     source_type = SourceSystemTypeFactory()
     source_user = SourceUserFactory()
     self.source = SourceSystemFactory(type=source_type, user=source_user)