Ejemplo n.º 1
0
 def test_dasherize(self):
     """Check UtilitiesHelper: dasherize"""
     with app.test_request_context():
         field = "starts_at"
         dasherized_field = "starts-at"
         result = dasherize(field)
         self.assertEqual(result, dasherized_field)
Ejemplo n.º 2
0
def test_dasherize():
    """Method to test whether an attribute dasherizes or not"""

    field = "starts_at"
    dasherized_field = "starts-at"
    result = dasherize(field)
    assert result == dasherized_field
Ejemplo n.º 3
0
    def test_dasherize(self):
        """Method to test whether an attribute dasherizes or not"""

        field = "starts_at"
        dasherized_field = "starts-at"
        result = dasherize(field)
        self.assertEqual(result, dasherized_field)
Ejemplo n.º 4
0
    def test_dasherize(self):
        """Method to test whether an attribute dasherizes or not"""

        with app.test_request_context():
            field = "starts_at"
            dasherized_field = "starts-at"
            result = dasherize(field)
            self.assertEqual(result, dasherized_field)
    def test_dasherize(self):
        """Method to test whether an attribute dasherizes or not"""

        with app.test_request_context():
            field = "starts_at"
            dasherized_field = "starts-at"
            result = dasherize(field)
            self.assertEqual(result, dasherized_field)
Ejemplo n.º 6
0
def patch_defaults(schema, in_data):
    """
    Add default values to None fields
    :param schema: Schema
    :param in_data: the json data comprising of the fields
    :return: json data with default values
    """
    for name, field in schema.fields.items():
        dasherized_name = dasherize(name)
        attribute = in_data.get(dasherized_name)
        if attribute is None:
            in_data[dasherized_name] = field.default
    return in_data
Ejemplo n.º 7
0
def patch_defaults(schema, in_data):
    """
    Add default values to None fields
    :param schema: Schema
    :param in_data: the json data comprising of the fields
    :return: json data with default values
    """
    for name, field in schema.fields.items():
        dasherized_name = dasherize(name)
        attribute = in_data.get(dasherized_name)
        if attribute is None:
            in_data[dasherized_name] = field.default
    return in_data
Ejemplo n.º 8
0
 def test_dasherize(self):
     with app.test_request_context():
         field = "starts_at"
         dasherized_field = "starts-at"
         result = dasherize(field)
         self.assertEqual(result, dasherized_field)
Ejemplo n.º 9
0
 def test_dasherize(self):
     with app.test_request_context():
         field = "starts_at"
         dasherized_field = "starts-at"
         result = dasherize(field)
         self.assertEqual(result, dasherized_field)