class PitchModelTest(unittest.TestCase): def setUp(self): self.user_James = User(username='******', password='******', email='*****@*****.**', bio='Good', profile_pic_path='https://sss.com') self.new_pitch = Pitch(id=1234, content='Pitch ', category="hhh", upvotes=12, downvotes=34, user=self.user_James) def tearDown(self): User.query.delete() Pitch.query.delete() def test_check_instance_variables(self): self.assertEquals(self.new_pitch.id, 1234) self.assertEquals(self.new_pitch.content, 'Pitch ') self.assertEquals(self.new_pitch.category, "hhh") self.assertEquals(self.new_pitch.upvotes, 2) self.assertEquals(self.new_pitch.downvotes, 4) self.assertEquals(self.new_pitch.user, self.user_James) def test_save_pitch(self): self.new_pitch.save_pitch() self.assertTrue(len(Pitch.query.all()) > 0) def test_get_pitch_by_id(self): self.new_pitch.save_pitch() got_pitchs = Pitch.get_pitche(1234) self.assertTrue(len(got_pitchs) == 1)
class PitchModelTest(unittest.TestCase): def setUp(self): self.user_sam = User(username='******', password='******', email='*****@*****.**') self.category_tech = Category(name="Technology") self.new_pitch = Pitch(message="ad adad adadad", category_id=self.category_tech.id, user_id=self.user_sam.id) def tearDown(self): Pitch.query.delete() User.query.delete() Category.query.delete() def test_instance(self): self.assertTrue(isinstance(self.new_pitch, Pitch)) def test_check_instance_variables(self): self.assertEquals(self.new_pitch.message, 'ad adad adadad') self.assertEquals(self.new_pitch.user_id, self.user_sam.id) self.assertEquals(self.new_pitch.category_id, self.category_tech.id) def test_save_pitch(self): self.new_pitch.save_pitch() self.assertTrue(len(Pitch.query.all()) > 0) def test_get_pitch_by_category(self): self.new_pitch.save_pitch() got_pitches = Pitch.get_pitches(self.category_tech.id) self.assertTrue(len(got_pitches) == 1)
class PitchModelTest(unittest.TestCase): def setUp(self): self.user_marah = User(username='******', password='******', email='*****@*****.**') self.new_pitch = Pitch(id=1, pitch_title='Test', pitch_content='This is a test pitch', category="interview", user=self.user_vivi, likes=0, dislikes=0) def test_check_instance_variables(self): self.assertEquals(self.new_pitch.pitch_title, 'Test') self.assertEquals(self.new_pitch.pitch_content, 'This is a test pitch') self.assertEquals(self.new_pitch.category, "interview") self.assertEquals(self.new_pitch.user, self.user_marah) def test_save_pitch(self): self.new_pitch.save_pitch() self.assertTrue(len(Pitch.query.all()) > 0) def test_get_pitch_by_id(self): self.new_pitch.save_pitch() got_pitch = Pitch.get_pitch(1) self.assertTrue(got_pitch is not None)
class TestReview(unittest.TestCase): def setUp(self): self.user_James = User(username='******', password='******', email='*****@*****.**') self.new_pitch = Pitch( id=2, pitch_title='title', category='slogan', pitch='This pitch is the best thing since sliced bread', user=self.user_James) def tearDown(self): Review.query.delete() User.query.delete() def test_check_instance_variables(self): self.assertEquals(self.new_pitch.id, 2) self.assertEquals(self.new_pitch.pitch_title, 'title') self.assertEquals(self.new_pitch.category, 'slogan') self.assertEquals(self.new_pitch.pitch, 'This pitch is the best thing since sliced bread') self.assertEquals(self.new_review.user, self.user_James) def test_save_pitch(self): self.new_pitch.save_pitch() self.assertTrue(len(Pitch.query.all()) > 0)
class PitchModelTest(unittest.TestCase): def setUp(self): self.user_ange = User(username='******', password='******', email='*****@*****.**') self.new_pitch = Pitch( id=1, pitch_title='Test', pitch_content='Figuring out the best in pitching', category="Musics", user=self.user_ange, likes=0, dislikes=0) def tearDown(self): Pitch.query.delete() User.query.delete() def test_check_instance_variables(self): self.assertEquals(self.new_pitch.pitch_title, 'Test') self.assertEquals(self.new_pitch.pitch_content, 'Figuring out the best in pitching') self.assertEquals(self.new_pitch.category, "musics") self.assertEquals(self.new_pitch.user, self.user_ange) def test_save_pitch(self): self.new_pitch.save_pitch() self.assertTrue(len(Pitch.query.all()) > 0) def test_get_pitch_by_id(self): self.new_pitch.save_pitch() got_pitch = Pitch.get_pitch(1) self.assertTrue(got_pitch is not None)
class PitchModelTest(unittest.TestCase): def setUp(self): self.user_James = User(username='******', password='******', email='*****@*****.**') self.new_pitch = Pitch(id=1, title='Test', description='This is a test pitch', comments="cool", category="interview") def tearDown(self): Pitch.query.delete() User.query.delete() def test_check_instance_variables(self): self.assertEquals(self.new_pitch.id, 1) self.assertEquals(self.new_pitch.title, 'Test') self.assertEquals(self.new_pitch.description, 'This is a test pitch') self.assertEquals(self.new_pitch.category, "interview") def test_save_pitch(self): self.new_pitch.save_pitch() self.assertTrue(len(Pitch.query.all()) > 0) def test_get_pitch_by_id(self): self.new_pitch.save_pitch() got_pitch = Pitch.get_pitch(1) self.assertTrue(got_pitch is not None)
class PitchModelTest(unittest.TestCase): def setUp(self): self.user_James = User(username="******", password="******", email="*****@*****.**") self.new_pitch = Pitch( id=1, pitch_title="Test", pitch_content="This is a test pitch", category="interview", user=self.user_James, likes=0, dislikes=0, ) def tearDown(self): Pitch.query.delete() User.query.delete() def test_check_instance_variables(self): self.assertEquals(self.new_pitch.pitch_title, "Test") self.assertEquals(self.new_pitch.pitch_content, "This is a test pitch") self.assertEquals(self.new_pitch.category, "interview") self.assertEquals(self.new_pitch.user, self.user_James) def test_save_pitch(self): self.new_pitch.save_pitch() self.assertTrue(len(Pitch.query.all()) > 0) def test_get_pitch_by_id(self): self.new_pitch.save_pitch() got_pitch = Pitch.get_pitch(1) self.assertTrue(got_pitch is not None)
class TestUser(unittest.TestCase): def setUp(self): self.new_pitch = Pitch( title='product selling', pitch='you need to be presentable to sell products', category='product pitch', ) def tearDown(self): Pitch.query.delete() User.query.delete() def test_check_instance_variable(self): self.assertEqual(self.new_pitch.title, 'product selling') self.assertEqual(self.new_pitch.pitch, 'you need to be presentable to sell products') self.assertEqual(self.new_pitch.category, 'product pitch') def test_save_pitch(self): self.new_pitch.save_pitch() self.assertTrue(len(Pitch.query.all()) > 0) def test_get_pitch(self): self.new_pitch.save_pitch() get_pitch = Pitch.query.first() self.assertTrue(len(get_pitch) == 1)
class PitchTest(unittest.TestCase): def setUp(self): self.user_Logan = User(username='******', password='******', email='*****@*****.**') self.new_pitch = Pitch( title='test', body='testing pitch creation', user_id=1, category='promotion' ) #20, 'pickup', 'test', 'test_user tests work' , datetime.now(), 0, 0, 28) def tearDown(self): Pitch.query.delete() User.query.delete() def test_instance(self): self.assertTrue(isinstance(self.new_pitch, Pitch)) def test_check_instance_variables(self): self.assertEquals(self.new_pitch.title, 'test') self.assertEquals(self.new_pitch.body, 'testing pitch creation') self.assertEquals(self.new_pitch.user_id, 1) self.assertEquals(self.new_pitch.category, 'promotion') def test_save_pitch(self): self.new_pitch.save_pitch() self.assertTrue(len(Pitch.query.all()) > 0) def test_get_pitch_by_id(self): self.new_pitch.save_pitch() got_pitch = Pitch.get_pitch(1) self.assertTrue(len(got_pitch is not None))
class TestPitch(unittest.TestCase): def setUp(self): self.new_user = User(username="******", email="*****@*****.**", password='******', bio="www", pic_path="img/avatar.png") self.new_pitch = Pitch(pitch_category="general", pitch_details="rrrr", upvote=0, downvote=0, user=self.new_user) self.new_comment = Comment(pitch_comment="ghghgh", pitch=self.new_pitch, comment_user=self.new_user) def tearDown(self): User.query.delete() Pitch.query.delete() Comment.query.delete() def test_instance_variables(self): self.assertEquals(self.new_pitch.pitch_category, "general") self.assertEquals(self.new_pitch.pitch_details, "rrrr") self.assertEquals(self.new_pitch.upvote, 0) self.assertEquals(self.new_pitch.downvote, 0) self.assertEquals(self.new_pitch.user, self.new_user) def test_save_pitch(self): self.new_pitch.save_pitch() self.assertEquals(len(Pitch.query.all()), 1) def test_like_pitch(self): self.new_pitch.like_pitch()
class PitchTest(unittest.TestCase): ''' Test Class to test teh Behaviourof the Pitch class ''' def Setup(self): ''' set up method that will run before every Test ''' self.new_user = User(username = '******', password = '******', email = '*****@*****.**') self.new_pitch = Pitch(id=50,title = 'My pitch',content='I can pitch all day long',category ='pickuplines',user_id = 10) def tearDown(self): User.query.delete() Pitch.query.delete() def test_instance(self): self.assertTrue(isinstance(self.new_pitch,Pitch)) def test_check_instance_variables(self): self.assertEquals(self.new_pitch.pitch_content,"Pitch content") self.assertEquals(self.new_pitch.pitch_category,'pickup') self.assertEquals(self.new_pitch.user,self.new_user) def test_save_pitch(self): self.new_pitch.save_pitch() self.assertTrue(len(Pitch.query.all())>0)
class TestPitch(unittest.TestCase): ''' Test Class to test the behaviour of the Pitch class ''' def setUp(self): self.user_James = User(username='******', password='******', email='*****@*****.**') self.new_pitch = Pitch(pitch='Lorem Lorem Lorem Lorem Lorem', user=self.user_James) def tearDown(self): Pitch.query.delete() User.query.delete() def test_check_instance_variables(self): self.assertEquals(self.new_pitch.pitch, 'Ipsum Ipsum Ipsum') self.assertEquals(self.new_pitch.user, self.user_James) def test_save_review(self): self.new_pitch.save_pitch() self.assertTrue(len(Pitch.query.all()) > 0) def test_get_review_by_id(self): self.new_pitch.save_pitch() got_pitches = Pitch.get_all_piches() self.assertTrue(len(got_pitches) == 1)
class TestPitch(unittest.TestCase): def setUp(self): self.user_James = User(username='******', password='******', email='*****@*****.**') self.new_pitch = Pitch(pitch_category='interview', pitch_title='moringa', pitch_upvotes=0, pitch='i love business', pitch_downvotes=0, user=self.user_James) def tearDown(self): Pitch.query.delete() User.query.delete() def test_check_instance_variables(self): self.assertEquals(self.new_pitch.pitch_category, 'interview') self.assertEquals(self.new_pitch.pitch_title, 'moringa') self.assertEquals(self.new_pitch.pitch_upvotes, 0) self.assertEquals(self.new_pitch.pitch, 'i love business') self.assertEquals(self.new_pitch.pitch_downvotes, 0) self.assertEquals(self.new_pitch.User, self.user_James) def test_save_pitch(self): self.new_pitch.save_pitch() self.assertTrue(len(Pitch.query.all()) > 0)
class PitchTest(unittest.TestCase): ''' Test Class to test the behaviour of the Pitch class ''' def setUp(self): ''' Set up method that will run before every Test ''' self.user_Chiri = User(username='******', password='******', email='*****@*****.**') self.new_pitch = Pitch( pitch_category=13452, pitch= 'I’m not a photographer, but I can picture me and you together.', user=self.user_Shiko) def tearDown(self): Pitch.query.delete() User.query.delete() def test_check_instance_variables(self): self.assertEquals(self.new_pitch.category.id, 13452) self.assertEquals(self.new_pitch.pitch, 'Review for movies') self.assertEquals(self.new_pitch.user, self.user_Shiko) def test_save_pitch(self): self.new_pitch.save_pitch() self.assertTrue(len(Pitch.query.all()) > 0) def test_get_pitch_by_id(self): self.new_pitch.save_pitch() got_pitches = Pitch.get_pitches(13452) self.assertTrue(len(got_pitches) == 1)
class TestPitch(unittest.TestCase): def setUp(self): self.user_Manka = User(username='******', password='******', email='*****@*****.**') self.new_pitch = Pitch(id=12345, title='Pitch itself') def tearDown(self): Pitch.query.delete() User.query.delete() def test_instance(self): self.assertTrue(isinstance(self.new_pitch, Pitch)) def test_check_instance_variables(self): self.assertEquals(self.new_pitch.id, 12345) self.assertEquals(self.new_pitch.title, 'Pitch itself') def test_save_pitch(self): self.new_pitch.save_pitch() self.assertTrue(len(Pitch.query.all()) > 0) def test_get_pitch_by_id(self): self.new_pitch.save_pitch() got_pitches = Pitch.get_pitch(12345) self.assertTrue(len(got_pitches) == 1)
class TestReview(unittest.TestCase): ''' Test Class to test the behaviour of the Review class ''' def setUp(self): self.user_Moringa = User(username = '******',password = '******', email = '*****@*****.**') self.new_pitch = Pitch(pitch='Honesty is the best policy',user = self.user_Moringa ) def tearDown(self): Pitch.query.delete() User.query.delete() def test_check_instance_variables(self): self.assertEquals(self.new_pitch.pitch,'Honesty is the best policy') self.assertEquals(self.new_pitch.user,self.user_Moringa) def test_save_review(self): self.new_pitch.save_pitch() self.assertTrue(len(Pitch.query.all())>0) def test_get_review_by_id(self): self.new_pitch.save_pitch() got_pitches = Pitch.get_all_piches() self.assertTrue(len(got_pitches) == 1)
class PitchTest(unittest.TestCase): def setUp(self): self.new_user = User(username='******', password='******', email='*****@*****.**') self.new_pitch = Pitch(id=123, pitch_title='Pitch', pitch_content='Pitch content', category='pickup', likes=0, dislikes=0) def tearDown(self): User.query.delete() Pitch.query.delete() Comment.query.delete() def test_check_instance(self): self.assertEquals(self.new_pitch.pitch_title, 'Pitch') self.assertEquals(self.new_pitch.pitch_content, 'Pitch content') self.assertEquals(self.new_pitch.category, "pickup") def test_save_pitch(self): self.new_pitch.save_pitch() self.assertTrue(len(Pitch.query.all()) > 0) def test_get_pitch_by_id(self): self.new_pitch.save_pitch() pitch = Pitch.get_pitch(123) self.assertTrue(pitch is not None)
class PitchTest(unittest.TestCase): def setUp(self): self.new_pitch = Pitch(title='New Pitch', description='This is the content', owners='people', cohort='mc4', technologies='python', comments='comments here', stars=4, pitched_p=datetime.now()) def tearDown(self): db.session.delete(self.new_pitch) db.session.commit() def test_instance(self): self.assertTrue(isinstance(self.new_pitch, Pitch)) def test_check_instance_variables(self): self.assertEquals(self.new_pitch.title, 'New Pitch') self.assertEquals(self.new_pitch.description, 'This is the content') self.assertEquals(self.new_pitch.owners, 'people') self.assertEquals(self.new_pitch.cohort, 'mc4') self.assertEquals(self.new_pitch.technologies, 'python') self.assertEquals(self.new_pitch.comments, 'comments here') self.assertEquals(self.new_pitch.stars, 4) def test_save_pitch(self): self.new_pitch.save_pitch() self.assertTrue(len(Pitch.query.all()) > 0) def test_get_pitch_by_id(self): self.new_pitch.save_pitch() pitch = Pitch.get_pitch() self.assertTrue(pitch is not None)
class PitchModelTest(unittest.TestCase): def setup(self): self.user_Makena = User(username='******', password='******', email='*****@*****.**') self.new_pitch = Pitch(title='Interviews', pitch='I am qualified', user=self.user_Makena) def tearDown(self): Pitch.query.delete() User.query.delete() def test_check_instance_variables(self): self.assertEquals(self.new_pitch.title, 'Interviews') self.assertEquals(self.new_pitch.pitch, 'I am qualified') self.assertEquals(self.new_pitch.user, self.user_Makena) def test_save_pitch(self): self.new_pitch.save_pitch() self.assertTrue(len(Pitch.query.all()) > 0) def test_get_pitch_by_id(self): self.new_pitch.save_pitch() got_pitch = Pitch.get_pitches(2) self.assertTrue(len(got_pitch) == 1)
class PitchTest(unittest.TestCase): ''' Test Class to test the behaviour of the Movie class ''' def setUp(self): ''' Set up method that will run before every Test ''' self.user = User(username = '******', password = '******', email = '*****@*****.**') self.new_comment = Comment(comment = 'comment', pitch_id = 1, user_id=self.user) self.new_pitch = Pitch(id=1, title="Pitch", body='pitches',category='Interview',writer = self.user,comment = self.new_comment) def tearDown(self): Pitch.query.delete() User.query.delete() def test_variables(self): self.assertEquals(self.new_pitch.id,1) self.assertEquals(self.new_pitch.title,'Pitch') self.assertEquals(self.new_pitch.body,'pitches') self.assertEquals(self.new_pitch.category,"Interview") self.assertEquals(self.new_pitch.writer,self.user) self.assertEquals(self.new_pitch.comment,self.new_comment) def test_save_pitch(self): self.new_pitch.save_pitch() self.assertTrue(len(Pitch.query.all())>0) def test_get_pitch(self): self.new_pitch.save_pitch() get_pitches = Pitch.get_pitch(1) self.assertTrue(len(get_pitches) == 1)
class PitchModelTest(unittest.TestCase): def setUp(self): self.user_Ryan = User(username='******', email='*****@*****.**', bio='jkjkjk', password='******') self.new_pitch = Pitch( pitch_title='Title for this pitch', category="promotion", upvotes=0, downvotes=0, pitch_text='This is the best thing since sliced bread', user=self.user_Ryan) def tearDown(self): Pitch.query.delete() User.query.delete() def test_check_instance_variables(self): self.assertEquals(self.new_pitch.pitch_title, 'Title for this pitch') self.assertEquals(self.new_pitch.category, "promotion") self.assertEquals(self.new_pitch.pitch_text, 'This is the best thing since sliced bread') self.assertEquals(self.new_pitch.upvotes, 0) self.assertEquals(self.new_pitch.downvotes, 0) self.assertEquals(self.new_pitch.user, self.user_Ryan) def test_save_pitch(self): self.new_pitch.save_pitch() self.assertTrue(len(Pitch.query.all()) > 0)
class TestReview(unittest.TestCase): def setUp(self): self.new_user = User(user_id=4000, user_name='Sandy', user_email='sandys@gmail', user_password='******') self.new_pitch = Pitch( pitch_id=2000, category='Pick uplines', Pitch='Car engine', user=self.new_user, ) def tearDown(self): Pitch.query.delete() def test_instance(self): self.assertTrue(isinstance(self.new_pitch, Pitch)) def test_check_instance_variables(self): self.assertEquals(self.new_pitch.pitch_id, 2000) self.assertEquals(self.new_pitch.category, 'Pick uplines') self.assertEquals(self.new_pitch.Pitch, 'Car engine') self.assertEquals(self.new_pitch.user, self.new_user) def test_review_saving(self): self.new_pitch.save_pitch() self.assertTrue(len(Pitch.query.all()) > 0)
class PitchTest(unittest.TestCase): ''' Test Class to test the behaviour of the Movie class ''' def setUp(self): ''' Set up method that will run before every Test ''' self.user_Sophy = User(username = '******', password = '******', email = '*****@*****.**') self.new_comment = Comment(comment_content = 'Awesome stuff', pitch_id = 12345, user_id=self.user_Sophy) self.new_pitch = Pitch(id=12345,pitch_title="First Pitch", content='Awesome pitch for stuff',category='Interview Pitch',author = self.user_Sophy,comments = self.new_comment) def tearDown(self): Pitch.query.delete() User.query.delete() def test_check_instance_variables(self): self.assertEquals(self.new_pitch.id,12345) self.assertEquals(self.new_pitch.pitch_title,'First Pitch') self.assertEquals(self.new_pitch.content,'Awesome pitch for stuff') self.assertEquals(self.new_pitch.category,"Interview Pitch") self.assertEquals(self.new_pitch.author,self.user_Sophy) self.assertEquals(self.new_pitch.comments,self.new_comment) def test_save_pitch(self): self.new_pitch.save_pitch() self.assertTrue(len(Pitch.query.all())>0) def test_get_pitch_by_id(self): self.new_pitch.save_pitch() got_pitches = Pitch.get_pitch(12345) self.assertTrue(len(got_pitches) == 1)
class PitchModelTest(unittest.TestCase): def setUp(self): self.user_Moringa = User(username='******', password='******', email='*****@*****.**') self.new_pitch = Pitch(id=1, pitch_title='Test', pitch_content='This is a test pitch', category="interview", user=self.user_Moringa, likes=0, dislikes=0) def tearDown(self): Pitch.query.delete() User.query.delete() def test_check_instance_variables(self): self.assertEquals(self.new_pitch.pitch_title, 'Test') self.assertEquals(self.new_pitch.pitch_content, 'This is a test pitch') self.assertEquals(self.new_pitch.category, "interview") self.assertEquals(self.new_pitch.user, self.user_Moringa) def test_save_pitch(self): self.new_pitch.save_pitch() self.assertTrue(len(Pitch.query.all()) > 0) def test_get_pitch_by_id(self): self.new_pitch.save_pitch() got_pitch = Pitch.get_pitch(1) self.assertTrue(got_pitch is not None)
class TestPitch(unittest.TestCase): def setUp(self): self.user_joe = User(username='******', password='******', email='*****@*****.**') self.new_pitch = Pitch(pitch_content="This is my pitch", pitch_category='Business', user=self.user_mercy) def tearDown(self): Pitch.query.delete() User.query.delete() # my_user = db.session.query(User).filter(self.user.id==1).first() # db.session.delete(my_user) def test_instance(self): self.assertTrue(isinstance(self.new_pitch, Pitch)) def test_check_instance_variables(self): self.assertEquals(self.new_pitch.pitch_content, "This is my pitch") self.assertEquals(self.new_pitch.pitch_category, 'Business') self.assertEquals(self.new_pitch.user, self.user_mercy) def test_save_pitch(self): self.new_pitch.save_pitch() self.assertTrue(len(Pitch.query.all()) > 0) def test_get_all_pitches(self): self.new_pitch.save_pitch() get_pitches = Pitch.get_all_pitches() self.assertTrue(len(get_pitches) == 1)
class PitchModelTest(unittest.TestCase): def setUp(self): self.user_James = User(username = '******',password = '******', email = '*****@*****.**') self.new_pitch = Pitch(id=1,pitch_title='Test',pitch_content='Pitch',category="interview",name= self.user_brenda,likes=0,dislikes=0) def tearDown(self): Pitch.query.delete() User.query.delete() def test_check_instance_variables(self): self.assertEquals(self.new_pitch.pitch_title,'Test') self.assertEquals(self.new_pitch.pitch_content,'Pitch') self.assertEquals(self.new_pitch.category,"Business") self.assertEquals(self.new_pitch.user,self.user_brenda) def test_save_pitch(self): self.new_pitch.save_pitch() self.assertTrue(len(Pitch.query.all())>0) def test_get_pitch_by_id(self): self.new_pitch.save_pitch() got_pitch = Pitch.get_pitch(1) self.assertTrue(got_pitch is not None) def test_relationship_user(self): user = self.new_pitch.user.username self.assertTrue(user == "Brenda")
class PitchTest(unittest.TestCase): def setUp(self): self.user_Emmanuel = User(username='******', password='******', email='*****@*****.**') self.new_pitch = Pitch(id=1, pitch_title='Welcome', pitch_content='Welcome Home', category="promotion", user=self.user_Emmanuel, likes=0, dislikes=0) def tearDown(self): Pitch.query.delete() User.query.delete() def test_check_instance_variables(self): self.assertEquals(self.new_pitch.pitch_title, 'Welcome') self.assertEquals(self.new_pitch.pitch_content, 'Welcome Home') self.assertEquals(self.new_pitch.category, "promotion") self.assertEquals(self.new_pitch.user, self.user_Emmanuel) def test_save_pitch(self): self.new_pitch.save_pitch() self.assertTrue(len(Pitch.query.all()) > 0) def test_get_pitch_by_id(self): self.new_pitch.save_pitch() my_pitch = Pitch.get_pitch(1) self.assertTrue(my_pitch is not None)
class TestReview(unittest.TestCase): ''' Test Class to test the behaviour of the Review class ''' def setUp(self): self.user_Moringa = User(username='******', password='******', email='[email protected]') self.new_pitch = Pitch(pitch='An openning forum for youths', user=self.user_Moringa) def tearDown(self): Pitch.query.delete() User.query.delete() def test_check_instance_variables(self): self.assertEquals(self.new_pitch.pitch, 'An opening forum for youths') self.assertEquals(self.new_pitch.user, self.user_Moringa) def test_save_review(self): self.new_pitch.save_pitch() self.assertTrue(len(Pitch.query.all()) > 0) def test_get_review_by_id(self): self.new_pitch.save_pitch() got_pitches = Pitch.get_all_piches() self.assertTrue(len(got_pitches) == 1)
class PitchTest(unittest.TestCase): ''' Test Class to test the behaviour of the Movie class ''' def setUp(self): ''' Set up method that will run before every Test ''' self.user_jj = User(username = '******', password = '******', email = '[email protected]') self.new_comment = Comment(comment_content = 'movie', pitch_id = 30, user_id=self.user_jj) self.new_pitch = Pitch(id=30,pitch_title="movie", content="Watch moremovies",category='Product-Pitch',user_id = self.user_jj,comments = self.new_comment) def tearDown(self): Pitch.query.delete() User.query.delete() def test_save_pitch(self): self.new_pitch.save_pitch() self.assertTrue(len(Pitch.query.all())>0) def test_get_pitch_by_id(self): self.new_pitch.save_pitch() got_pitches = Pitch.get_pitch(30) self.assertTrue(len(got_pitches) == 1)
class PitchModelTest(unittest.TestCase): def setUp(self): self.user_risper = User(username='******', password='******', email='*****@*****.**') self.new_pitch = Pitch(id=1, pitch_title='Test', pitch_content='This is a test pitch', category="interview", user=self.user_kerovin) def tearDown(self): Pitch.query.delete() User.query.delete() def test_check_instance_variables(self): self.assertEquals(self.new_pitch.pitch_title, 'Test') self.assertEquals(self.new_pitch.pitch_content, 'This is a test pitch') self.assertEquals(self.new_pitch.category, "interview") self.assertEquals(self.new_pitch.user, self.user_kerovin) def test_save_pitch(self): self.new_pitch.save_pitch() self.assertTrue(len(Pitch.query.all()) > 0) def test_get_pitch_by_id(self): self.new_pitch.save_pitch() got_pitch = Pitch.get_pitch(1) self.assertTrue(got_pitch is not None)
class PitchTest(unittest.TestCase): def setUp(self): self.new_user = User(username='******', password='******', email='*****@*****.**') self.new_pitch = Pitch(id=123, pitch_content='Pitch content', pitch_category='pickup', user=self.new_user) def tearDown(self): User.query.delete() Pitch.query.delete() def test_instance(self): self.assertTrue(isinstance(self.new_pitch, Pitch)) def test_check_instance_variables(self): self.assertEquals(self.new_pitch.pitch_content, "Pitch content") self.assertEquals(self.new_pitch.pitch_category, 'pickup') self.assertEquals(self.new_pitch.user, self.new_user) def test_save_pitch(self): self.new_pitch.save_pitch() self.assertTrue(len(Pitch.query.all()) > 0)