Skip to content

Instantly share code, notes, and snippets.

@kelvinndmo
Last active December 28, 2019 18:00
Show Gist options
  • Save kelvinndmo/c0db62a53004fc628a76ce1ca550ee66 to your computer and use it in GitHub Desktop.
Save kelvinndmo/c0db62a53004fc628a76ce1ca550ee66 to your computer and use it in GitHub Desktop.
import unittest
from employee import Student
from unittest.mock import patch
class TestStudent(unittest.TestCase):
def setUp(self):
print("Setup has been run")
self.stud_1 = Student('kelvin', 'onkundi', 300)
self.stud_2 = Student('novak', 'onkundi', 300)
self.parent_name = "Barrack Obama"
def tearDown(self):
print("teardown has been run")
def test_email(self):
self.assertEqual(self.stud_1.email, '[email protected]')
self.assertEqual(self.stud_2.email, "[email protected]")
def test_fullname(self):
self.assertEqual(self.stud_1.fullname, "kelvin onkundi")
def test_send_parent_message(self):
""" test if the right message was sent to the parent """
self.assertIn(
f"Dear {self.parent_name}, Your son {self.stud_1.first} {self.stud_1.last} managed to score {self.stud_1.marks}", self.stud_1.send_parent_message(self.parent_name))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment