예제 #1
0
    def test_apply_object_attributes_to_template_template_and_context(self):
        context = Context('mock-value')

        test_string = apply_object_attributes_to_template(
            'templated string with placeholder: {value}', context)
        self.assertEqual(test_string,
                         'templated string with placeholder: mock-value')
예제 #2
0
 def test_apply_object_attributes_to_template_no_context_and_template(self):
     with self.assertRaises(AttributeError):
         test_string = apply_object_attributes_to_template(
             'This is a {templated} string.', None)
예제 #3
0
 def test_apply_object_attributes_to_template_no_context_and_no_template(
         self):
     test_string = apply_object_attributes_to_template(
         'This is not a templated string.', None)
     self.assertEqual(test_string, 'This is not a templated string.')