ojuso-map/apps/map/tests.py

26 lines
1.3 KiB
Python
Raw Normal View History

2017-05-19 00:23:40 +00:00
from django.test import TestCase
from .models import CaseStudy
class CaseStudyTests(TestCase):
def test_get_renewable_generation_detail_when_empty(self):
"""get_renewable_generation_detail() should return the empty string."""
case_study = CaseStudy()
self.assertIs(case_study.get_renewable_generation_detail(), "")
def test_get_renewable_generation_detail_with_geo(self):
"""get_renewable_generation_detail() should return just the description"""
case_study = CaseStudy(generation_technology='GEOT')
self.assertEqual(case_study.get_renewable_generation_detail(), "Geothermal electricity")
def test_get_renewable_generation_detail_with_wind(self):
"""get_renewable_generation_detail() should return the description prefixed with 'wind power'"""
case_study = CaseStudy(generation_technology='SSWE')
self.assertEqual(case_study.get_renewable_generation_detail(), "Wind energy Small-scale (less than 500kW)")
def test_get_renewable_generation_detail_with_other(self):
"""get_renewable_generation_detail() should return the detail provided in .generation_technology_other"""
case_study = CaseStudy(generation_technology='OTHR', generation_technology_other='Warp drive')
self.assertEqual(case_study.get_renewable_generation_detail(), "Warp drive")