Add logic+tests for handling display of type of renewable generation (#7)
This commit is contained in:
@ -1,3 +1,25 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
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")
|
||||
|
Reference in New Issue
Block a user