File size: 621 Bytes
30aec8b
 
bb76786
01418ad
02c72d1
01418ad
 
3ac22ae
01418ad
3ac22ae
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from django.test import TestCase

class HomePageTest(TestCase):
    def test_uses_home_template(self):
        response = self.client.get("/")
        self.assertTemplateUsed(response, "home.html")

    def test_displays_calculator_widget(self):
        response = self.client.get("/")
        html = response.content.decode('utf8')
        
        # Check for the two input boxes
        self.assertIn('id="id_number_1"', html)
        self.assertIn('id="id_number_2"', html)
        
        # Check for the two buttons
        self.assertIn('id="id_btn_sum"', html)
        self.assertIn('id="id_btn_subtract"', html)