예제 #1
0
    def test_variable_scm_ncommits(self):
        """Test scm/ncommits variable"""

        correct_json = (
            """{
            "desc": "Number of commits",
            "id": "scm/ncommits",
            "type": "total",
            "value": 4465
            }""",
            """{
            "desc": "Number of commits",
            "id": "scm/ncommits",
            "type": "total",
            "value": 730
            }""",
        )

        var_factory = VariableFactory(database=database)
        ncommits = var_factory.make("scm/ncommits")
        self.assertEqual(ncommits.value(), 4465)
        ncommits_json = ncommits.json(pretty=True)
        self._assertEqualJSON(ncommits_json, correct_json[0])
        ncommits.set_conditions({"period": (self.start, self.end)})
        self.assertEqual(ncommits.value(), 730)
        ncommits_json = ncommits.json(pretty=True)
        self._assertEqualJSON(ncommits_json, correct_json[1])
예제 #2
0
    def test_variable_scm_ncommits (self):
        """Test scm/ncommits variable"""

        correct_json = (
            """{
            "desc": "Number of commits",
            "id": "scm/ncommits",
            "type": "total",
            "value": 4465
            }""",
            """{
            "desc": "Number of commits",
            "id": "scm/ncommits",
            "type": "total",
            "value": 730
            }""",
            )

        var_factory = VariableFactory (database = database)
        ncommits = var_factory.make("scm/ncommits")
        self.assertEqual (ncommits.value(), 4465)
        ncommits_json = ncommits.json(pretty=True)
        self._assertEqualJSON (ncommits_json, correct_json[0])
        ncommits.set_conditions ({"period": (self.start, self.end)})
        self.assertEqual (ncommits.value(), 730)
        ncommits_json = ncommits.json(pretty=True)
        self._assertEqualJSON (ncommits_json, correct_json[1])
예제 #3
0
    def test_variable_conditions(self):
        """Test adding conditions to a variable"""

        var_factory = VariableFactory(database=database)
        ncommits = var_factory.make("scm/ncommits")
        self.assertEqual(ncommits.value(), 4465)
        ncommits.set_conditions({"period": (self.start, self.end)})
        self.assertEqual(ncommits.value(), 730)
        ncommits = var_factory.make(
            "scm/ncommits", conditions={"period": (self.start, self.end)})
        self.assertEqual(ncommits.value(), 730)
예제 #4
0
    def test_variable_conditions (self):
        """Test adding conditions to a variable"""

        var_factory = VariableFactory (database = database)
        ncommits = var_factory.make("scm/ncommits")
        self.assertEqual (ncommits.value(), 4465)
        ncommits.set_conditions ({"period": (self.start, self.end)})
        self.assertEqual (ncommits.value(), 730)
        ncommits = var_factory.make("scm/ncommits",
                                    conditions = {"period": (self.start,
                                                             self.end)})
        self.assertEqual (ncommits.value(), 730)