Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
import unittest
from user import User
class TestUser(unittest.TestCase):
# standard built in method "setUp" for testing
def setUp(self):
self.__user = User()
self.__user.set_role("user")
self.__user.set_email("test@mail.com")
self.__user.set_phone("07427730650")
# test if role is correct
def test_get_role(self):
test_result = self.__user.get_role()
self.assertEqual(test_result, "user")
# test if email is correct
def test_get_email(self):
test_result = self.__user.get_email()
self.assertEqual(test_result, "test@mail.com")
# test if phone exists and is correct
def test_phone_exists(self):
test_result = self.__user.get_phone()
self.assertIsNotNone(test_result)
self.assertEqual(test_result, "07427730650")
# test that it doesn't have "managers" composite pattern
def test_has_not_manager(self):
# use built in hasattr() to check if attribute
# get_managers exist
test_result = hasattr(self.__user, "get_managers")
self.assertIs(test_result, False)