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])
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])
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)
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)