Skip to content

Instantly share code, notes, and snippets.

@joelethan
Created September 4, 2018 10:22
Show Gist options
  • Save joelethan/9f4e93b2245488f251905f2491b82095 to your computer and use it in GitHub Desktop.
Save joelethan/9f4e93b2245488f251905f2491b82095 to your computer and use it in GitHub Desktop.
tearDownimport unittest # python3
from signup import SignUp
class signUpTest(unittest.TestCase):
def setUp(self):
self.signup=SignUp()
def tearDown(self): #done with databases!!, break it
pass
def test_signup_creation(self):
self.assertIsInstance(self.signup, SignUp)
def test_add_user(self):
self.signup.add('John','mypass1234')
self.assertEqual(len(self.signup.user_bio), 1)
def test_return_password(self):
self.signup.add('john','12345')
self.assertEqual(self.signup.get_password('john'), '12345')
def test_missing_key(self):
with self.assertRaises(KeyError):
self.signup.get_password('jon')
@unittest.skip('Keep for later')
def test_unknown_method(self): #sleep a method
self.assertEqual('','')
def test_length_of_bio(self):
self.assertEqual(len(self.signup.user_bio), 0)
self.signup.add('John','mypass1234')
self.assertEqual(len(self.signup.user_bio), 1)
self.signup.add('Johnty','mypass1234')
self.assertEqual(len(self.signup.user_bio), 2)
#Register a user for the event and test if the user is added
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment