File tree Expand file tree Collapse file tree 2 files changed +44
-0
lines changed
lung_cancer_screening/questions/tests/unit/views Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,24 @@ def test_get_renders_the_metric_form_by_default(self):
4646
4747 self .assertContains (response , "Centimetres" )
4848
49+ def test_get_renders_the_imperial_form_if_already_has_imperial_height (self ):
50+ self .user .responseset_set .create (
51+ height_imperial = 60
52+ )
53+
54+ response = self .client .get (reverse ("questions:height" ))
55+
56+ self .assertContains (response , "Feet" )
57+
58+ def test_get_renders_the_metric_form_if_already_has_imperial_height_but_unit_is_metric (self ):
59+ self .user .responseset_set .create (
60+ height_imperial = 60
61+ )
62+
63+ response = self .client .get (reverse ("questions:height" ), {"unit" : "metric" })
64+
65+ self .assertContains (response , "Centimetres" )
66+
4967 def test_get_renders_the_imperial_form_if_specified (self ):
5068 response = self .client .get (
5169 reverse ("questions:height" ), {"unit" : "imperial" }
Original file line number Diff line number Diff line change @@ -46,6 +46,32 @@ def test_get_renders_the_metric_form(self):
4646
4747 self .assertContains (response , "Kilograms" )
4848
49+ def test_get_renders_the_imperial_form_if_already_has_imperial_weight (self ):
50+ self .user .responseset_set .create (
51+ weight_imperial = 60
52+ )
53+
54+ response = self .client .get (reverse ("questions:weight" ))
55+
56+ self .assertContains (response , "Stone" )
57+
58+ def test_get_renders_the_metric_form_if_already_has_imperial_weight_but_unit_is_metric (self ):
59+ self .user .responseset_set .create (
60+ weight_imperial = 60
61+ )
62+
63+ response = self .client .get (reverse ("questions:weight" ), {"unit" : "metric" })
64+
65+ self .assertContains (response , "Kilograms" )
66+
67+ def test_get_renders_the_imperial_form_if_specified (self ):
68+ response = self .client .get (
69+ reverse ("questions:weight" ), {"unit" : "imperial" }
70+ )
71+
72+ self .assertContains (response , "Stone" )
73+ self .assertContains (response , "Pounds" )
74+
4975
5076class TestPostWeight (TestCase ):
5177 def setUp (self ):
You can’t perform that action at this time.
0 commit comments