Пример #1
0
    def testCheckModelsStatusNoModels(self, containsIssueMock, addIssueMock,
                                      removeIssueMock, sendEmailMock):
        url = "foo.bar"
        testJson = []
        emailParams = {}

        # Code under test
        modelsMonitor._checkModelsStatus(testJson, url, emailParams)

        self.assertFalse(containsIssueMock.called)
        self.assertFalse(addIssueMock.called)
        self.assertFalse(removeIssueMock.called)
        self.assertFalse(sendEmailMock.called)
  def testCheckModelsStatusNoModels(self,
                                    containsIssueMock,
                                    addIssueMock,
                                    removeIssueMock,
                                    sendEmailMock):
    url = "foo.bar"
    testJson = []
    emailParams = {}

    # Code under test
    modelsMonitor._checkModelsStatus(testJson, url, emailParams)

    self.assertFalse(containsIssueMock.called)
    self.assertFalse(addIssueMock.called)
    self.assertFalse(removeIssueMock.called)
    self.assertFalse(sendEmailMock.called)
Пример #3
0
  def testCheckModelsStatusGoodModels(self,
                                      containsIssueMock,
                                      addIssueMock,
                                      removeIssueMock,
                                      sendEmailMock):
    url = "foo.bar"
    testJson = [{u"uid": "123", u"status": MetricStatus.ACTIVE},
                {u"uid": "456", u"status": MetricStatus.ACTIVE}]
    emailParams = {}

    # Code under test
    modelsMonitor._checkModelsStatus(testJson, url, emailParams)

    removeIssueMock.assert_any_call(ANY, "123")
    removeIssueMock.assert_any_call(ANY, "456")

    self.assertFalse(containsIssueMock.called)
    self.assertFalse(addIssueMock.called)
    self.assertFalse(sendEmailMock.called)
Пример #4
0
  def testCheckModelsStatusErrorModels_AlreadyReported(self,
                                                       containsIssueMock,
                                                       addIssueMock,
                                                       removeIssueMock,
                                                       sendEmailMock):
    url = "foo.bar"
    testJson = [{u"uid": "123", u"status": MetricStatus.ERROR},
                {u"uid": "456", u"status": MetricStatus.ERROR}]
    containsIssueMock.return_value = True
    emailParams = {}

    # Code under test
    modelsMonitor._checkModelsStatus(testJson, url, emailParams)

    containsIssueMock.assert_any_call(ANY, "123")
    containsIssueMock.assert_any_call(ANY, "456")

    self.assertFalse(removeIssueMock.called)
    self.assertFalse(addIssueMock.called)
    self.assertFalse(sendEmailMock.called)