示例#1
0
 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_joe)
示例#2
0
 def setUp(self):
     '''
     Set up method that will run before every Test
     '''
     self.new_pitch = Pitch(title='Hello world',
                            content='My first webpage',
                            category='Projects')
示例#3
0
文件: tests.py 项目: victorlomi/pitch
 def test_pitches(self):
     u1 = User(username='******')
     p = Pitch(body="example", author=u1)
     db.session.add(u1)
     db.session.add(p)
     db.session.commit()
     self.assertEqual(Pitch.query.filter_by(author=u1).first().body, p.body)
示例#4
0
文件: tests.py 项目: victorlomi/pitch
 def test_comments(self):
     p = Pitch(body="example")
     c = Comment(body="comment", pitch=p)
     db.session.add(p)
     db.session.add(c)
     db.session.commit()
     self.assertEqual(Comment.query.filter_by(pitch=p).first().body, c.body)
示例#5
0
 def setUp(self):
     self.user_gabriel = User(username='******',
                              password='******',
                              email='*****@*****.**')
     self.new_pitch = Pitch(pitch_content="This is my pitch",
                            pitch_category='Business',
                            user=self.user_gabriel)
示例#6
0
def new_post():
    form = PostForm()
    if form.validate_on_submit():
        flash('Your post has been created!', 'success')
        hashtag = ''
        hashtags = form.content.data
        print(hashtags)
        newstr = hashtags.split()
        for char in newstr:
            if char.startswith("#"):
                hashtag = char.strip("#")
                print(hashtag)
                # if form.picture.data:
                #     picture_file = save_picture(form.picture.data)
                picture_file = save_picture(form.picture.data)
                # video_file = save_video(form.video.data )
                image = url_for('static', filename='images/' + picture_file)

                # video = url_for('static',filename='videos/'+video_file)

                post = Pitch(title=form.title.data,
                             content=form.content.data,
                             author=current_user,
                             hashtags=hashtag,
                             image=image)
                db.session.add(post)
                db.session.commit()
                return redirect(url_for('main.home'))

    return render_template('create_post.html',
                           title='New Post',
                           form=form,
                           legend='New Post')
示例#7
0
def category(category):
    # retrieve all pitches in category
    pitches = Pitch().query.filter_by(category=category).all()

    if pitches:
        pitches.reverse()
    return render_template('category.html', category=category, pitches=pitches)
示例#8
0
 def setUp(self):
     '''
     Set up method that will run before every Test
     '''
     self.new_pitch = Pitch(1234, 'Python Must Be Crazy',
                            'A thrilling new Python Series', '/khsjha27hbs',
                            8.5, 129993)
示例#9
0
 def setUp(self):
 
     """
     Set up method that will run before every Test
     """
     self.user_Ringer = User(username = '******',password = '******')
     self.new_pitch = Pitch(title= 'Looking for a Job', post = 'text', category = 'job')
def test_save_multiple_comment(self):
    self.new_comment.save_comment()
    self.second_her = User(username = '******', password='******', email='*****@*****.**')
    self.second_pitch = Pitch(title = 'test', content = 'hire',user_id = 2, category = 'interview')
    self.second_comment = Comments(id = 2, comment = 'test', user_id = 2, pitch = self.new_pitch)
    self.secpnd_comment.save_comment()
    self.assertTrue(len(Comments.query.all()),2)
示例#11
0
 def setUp(self):
     self.user_Me = User(username='******',
                         password='******',
                         email='*****@*****.**')
     self.new_pitch = Pitch(title='test',
                            content='hire me',
                            user_id=1,
                            category='interview')
示例#12
0
    def setUp(self):

        self.new_pitch = Pitch(title="title",
                               pitch_content="description",
                               upvotes=1,
                               downvotes=1)
        db.session.add(self.new_pitch)
        db.session.commit()
示例#13
0
 def test_save_pitch(self):
     test_pitch = Pitch(id=23,
                        pitch_pic_loc="photos/animal.jpg",
                        pitch_body="lorem ipsum dolor asimet",
                        user_id=1)
     Pitch.save_pitch(test_pitch)
     pitch = Pitch.query.filter_by(id=test_pitch.id).first()
     self.assertEqual(pitch.pitch_body, "lorem ipsum dolor asimet")
示例#14
0
    def setup(self):
        self.user_Makena = User(username='******',
                                password='******',
                                email='*****@*****.**')

        self.new_pitch = Pitch(title='Interviews',
                               pitch='I am qualified',
                               user=self.user_Makena)
示例#15
0
    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)
示例#16
0
    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)
示例#17
0
 def setUp(self):
     self.new_pitch = Pitch(
         id='4',
         title='Cheesy',
         category='pickupline',
         pitchname="Are you from France coz I Eiffel you",
         posted="2019-05-27 14:15:43.587649",
         posted_by="Ivy")
示例#18
0
 def setUp(self):
     self.user_midumbi = User(username='******',
                              password='******',
                              email='*****@*****.**')
     self.new_pitch = Pitch(id=1,
                            title='Test',
                            content='This is a test pitch',
                            user_id=self.user_midumbi.id)
示例#19
0
 def setUp(self):
     '''
     Default function that runs on each test run
     '''
     self.test_pitch = Pitch(id=10,
                             pitch_pic_loc="photos/animal.jpg",
                             pitch_body="test pitch body",
                             user_id=1)
示例#20
0
    def setUp(self):
        self.user_Pat = User(username='******',
                             password='******',
                             email='*****@*****.**')

        self.new_pitch = Pitch(category_pitch='general',
                               pitch_body='this is a pitch',
                               user=self.user_Pat)
示例#21
0
 def setUp(self):
     '''
     Method that will run before each test is ran
     '''
     self.new_pitch = Pitch(pitch_content="Amazing pitch",
                            pitch_category='Business')
     self.new_comment = Comment(comment_content="I love this",
                                pitch=self.new_pitch)
示例#22
0
 def setUp(self):
     self.user_rose = User(username='******',
                           password='******',
                           email='*****@*****.**')
     self.new_pitch = Pitch(id=1,
                            title='Test',
                            content='This is a test pitchapp',
                            user_id=self.user_rose.id)
示例#23
0
 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)
示例#24
0
 def setUp(self):
     self.user_essy = User(username='******',
                           password='******',
                           email='*****@*****.**')
     self.new_pitch = Pitch(id=1,
                            title='Test',
                            content='This is a test pitch',
                            user_id=self.user_essy.id)
示例#25
0
 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)
示例#26
0
    def setUp(self):
        self.new_comment = Comment(content = 'content', user_id = 1, pitch_id =1 )
        self.new_pitch = Pitch(title = "title", description = "Description", upvotes = 1, downvotes = 1, category_id =1, user_id = 1)
        self.new_user = User(username = "******", email ="*****@*****.**", bio = "I am awesome", profile_pic_url = "image_url", password = '******')

        db.session.add(self.new_pitch)
        db.session.add(self.new_user)
        db.session.add(self.new_comment)
        db.session.commit()
示例#27
0
 def setUp(self):
     '''
     Set up method that will run before every Test
     '''
     self.new_pitch = Pitch(id=56,
                            title='My pitch',
                            content='I can pitch all day long',
                            category='But wont',
                            user_id=15)
示例#28
0
 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 setUp(self):
     self.user_margaret = User(username='******',
                               password='******',
                               email='*****@*****.**')
     self.new_pitch = Pitch(pitch_content="This is my pitch",
                            pitch_category='Business',
                            user=self.user_margaret)
     self.new_comment = Comment(comment_content="This is my comment",
                                user=self.user_margaret)
示例#30
0
 def setUp(self):
     '''
     Set up method that will run before every Test
     '''
     # self.user = User(username = '******', password = '******', email = '*****@*****.**')
     self.new_pitch = Pitch(id=1,
                            title="Pitch",
                            body='pitches',
                            category='Interview')