I've written a test for the get_rendered_text() method in my django app as seen in the Model below. But when i run a coverage report, it still says i haven't tested this particular method meanwhile to the best of my understanding,the test i've written shoul cover this method.
class Cross(models.Model):
text = CharField(max_length=200)
def get_rendered_text(self, carnage):
template = Template(self.text)
context = Context({'carnage': carnage})
return template.render(context)
Here is the test i've written for the above method
def test_rendered(self):
string_factory = StringFactory()
context = Context({'my_title': 'my_title'})
template_to_render = Template(
string_factory.text
)
rendered_template = template_to_render.render(context)
# import pdb; pdb.set_trace()
self.assertInHTML('my_title', rendered_template)
self.assertIn('my_title', rendered_template)
The above test passes just fine. but on my coverage report,it still says i haven't tested this method. So what i'm trying to figure out is why exactly doesn't coverage,mark this test as successful. Thanks