Ejemplo n.º 1
0
def _clean_attribute_initial_value(attribute_name, attribute_value):
    clean_attribute_value = attribute_value
    if attribute_name == "campus":
        clean_attribute_value = campus.find_by_id(attribute_value)
    elif attribute_name == "language":
        clean_attribute_value = language.find_by_id(attribute_value)
    return clean_attribute_value
Ejemplo n.º 2
0
def clean_attribute_initial_value(attribute_name, attribute_value):
    # TODO : clean this function ; it could make up to 6 hits DB
    clean_attribute_value = attribute_value
    if attribute_name == "campus":
        clean_attribute_value = campus.find_by_id(attribute_value)
    elif attribute_name == "language":
        clean_attribute_value = language.find_by_id(attribute_value)
    elif attribute_name in ['requirement_entity', 'allocation_entity', 'additional_entity_1', 'additional_entity_2']:
        clean_attribute_value = get_by_internal_id(attribute_value)
    return clean_attribute_value
Ejemplo n.º 3
0
    def test_find_by_id(self):
        campus_id = self.campus.id
        self.assertEqual(self.campus, campus.find_by_id(campus_id))

        self.campus.delete()
        self.assertIsNone(campus.find_by_id(campus_id))