예제 #1
0
class TestPitch(unittest.TestCase):
    def setUp(self):
        self.user_James = User(username='******',
                               email='*****@*****.**',
                               bio='Hello I am James',
                               profile_pic_path='app/static/photos',
                               pass_secure='potato')
        self.new_pitch = Pitch(user=self.user_James,
                               title='password',
                               category='businesspitch',
                               pitch='A password managing app')

    # def tearDown(self):
    #     Pitch.query.delete()
    #     User.query.delete()

    def test_check_instance_variables(self):
        self.assertEquals(self.new_pitch.user, self.user_James)
        self.assertEquals(self.new_pitch.title, 'password')
        self.assertEquals(self.new_pitch.category, 'businesspitch')
        self.assertEquals(self.new_pitch.pitch, 'A password managing app')

    def test_save_pitches(self):
        self.new_pitch.save_pitches()
        self.assertTrue(len(Pitch.query.all()) > 0)
예제 #2
0
class TestPitch(unittest.TestCase):
    def setUp(self):
        self.user_James = User(username='******',
                               password='******',
                               email='*****@*****.**')
        self.new_pitch = Pitch(
            title='Elevator Pitch Example for an Professional Accountant',
            body="Test Pitch",
            author='Improv Andy',
            category='business',
            upvotes=1,
            downvotes=0,
            user=self.user_James)

    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,
            'Elevator Pitch Example for an Professional Accountant')
        self.assertEquals(self.new_pitch.body, "Test Pitch")
        self.assertEquals(self.new_pitch.author, 'Improv Andy')
        self.assertEquals(self.new_pitch.category, 'business')
        self.assertEquals(self.new_pitch.upvotes, 1)
        self.assertEquals(self.new_pitch.downvotes, 0)
        self.assertEquals(self.new_pitch.user, self.user_James)

    def test_save_pitch(self):
        self.new_pitch.save_pitches()
        self.assertTrue(len(Pitch.query.all()) > 0)
예제 #3
0
class TestPitch(unittest.TestCase):
    def setUp(self):
        self.user_Immanuel = User(username='******',
                                  password='******',
                                  email='*****@*****.**')
        self.new_pitch = Pitch(
            title='Elevator Pitch Example for an Professional Accountant',
            body="Test Pitch",
            author='Improv Andy',
            category='business',
            upvotes=1,
            downvotes=0,
            user_id=self.user_Immanuel.id)

    def tearDown(self):
        Pitch.query.delete()
        User.query.delete()

    def test_instance(self):
        self.assertTrue(isinstance(self.new_pitch, Pitch))

    def test_save_pitch(self):
        self.new_pitch.save_pitches()
        self.assertTrue(len(Pitch.query.all()) > 0)