def testCheckModelParityWithoutErrors(self):

    result = check_model_consistency._checkModelParity(
      engineMetrics=_ACTIVE_PARITY_WITH_ONE_ERROR_METRIC["engineMetrics"],
      dynamodbMetrics=_ACTIVE_PARITY_WITH_ONE_ERROR_METRIC["dynamodbMetrics"],
      verbose=False)

    self.assertEqual(result, ([], []))
  def testCheckModelParityWithMoreInEngine(self):

    engineMetrics = [
      dict(
        uid="uid1",
        name="name1",
        server="server1",
        status=MetricStatus.ACTIVE,
        message=None,
        parameters=json.dumps(
          dict(
            metricSpec=dict(
              userInfo=dict(
                metricType="metricType1",
                metricTypeName="metricTypeName1",
                symbol="symbol1"))))
      ),


      dict(
        uid="uid2",
        name="name2",
        server="server2",
        status=MetricStatus.ACTIVE,
        message=None,
        parameters=json.dumps(
          dict(
            metricSpec=dict(
              userInfo=dict(
                metricType="metricType2",
                metricTypeName="metricTypeName2",
                symbol="symbol2"))))
      )
    ]


    dynamodbMetrics = [

      dict(
        uid="uid2",
        name="name2",
        display_name="server2",
        metricType="metricType2",
        metricTypeName="metricTypeName2",
        symbol="symbol2"
      )
    ]


    warnings, errors = check_model_consistency._checkModelParity(
      engineMetrics=engineMetrics,
      dynamodbMetrics=dynamodbMetrics,
      verbose=False)

    self.assertEqual(warnings, [])
    self.assertEqual(len(errors), 1)
    def testCheckModelParityWithoutErrors(self):

        result = check_model_consistency._checkModelParity(
            engineMetrics=_ACTIVE_PARITY_WITH_ONE_ERROR_METRIC[
                "engineMetrics"],
            dynamodbMetrics=_ACTIVE_PARITY_WITH_ONE_ERROR_METRIC[
                "dynamodbMetrics"],
            verbose=False)

        self.assertEqual(result, ([], []))
    def testCheckModelParityWithMoreInEngine(self):

        engineMetrics = [
            dict(uid="uid1",
                 name="name1",
                 server="server1",
                 status=MetricStatus.ACTIVE,
                 message=None,
                 parameters=json.dumps(
                     dict(metricSpec=dict(
                         userInfo=dict(metricType="metricType1",
                                       metricTypeName="metricTypeName1",
                                       symbol="symbol1"))))),
            dict(uid="uid2",
                 name="name2",
                 server="server2",
                 status=MetricStatus.ACTIVE,
                 message=None,
                 parameters=json.dumps(
                     dict(metricSpec=dict(
                         userInfo=dict(metricType="metricType2",
                                       metricTypeName="metricTypeName2",
                                       symbol="symbol2")))))
        ]

        dynamodbMetrics = [
            dict(uid="uid2",
                 name="name2",
                 display_name="server2",
                 metricType="metricType2",
                 metricTypeName="metricTypeName2",
                 symbol="symbol2")
        ]

        warnings, errors = check_model_consistency._checkModelParity(
            engineMetrics=engineMetrics,
            dynamodbMetrics=dynamodbMetrics,
            verbose=False)

        self.assertEqual(warnings, [])
        self.assertEqual(len(errors), 1)