Esempio 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)
Esempio 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
Esempio 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)
Esempio 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)
Esempio 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
Esempio 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
 def test_dasherize(self):
     with app.test_request_context():
         field = "starts_at"
         dasherized_field = "starts-at"
         result = dasherize(field)
         self.assertEqual(result, dasherized_field)
Esempio 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)