Ejemplo n.º 1
0
    def setUp(self):
        db.drop_all()
        db.create_all()

        self.success = {'code': 200}
        self.success_create = {'code': 201}
        self.not_json = {'code': 400, 'error': 'post type must be json'}
        self.field_not_complete = {'code': 400, 'error': 'fields not complete'}
        self.error_need_login = {'code': 403, 'error': 'need to login'}
        self.error_need_csrf = {'code': 400, 'error': 'needs csrf token'}
        self.error_wrong_csrf = {'code': 400, 'error': 'wrong csrf token'}

        user = User.create('*****@*****.**', 'strong_password')
        another_user = User.create('*****@*****.**', 'strong_password')
        event = Event.create('dinner', datetime(2017, 7, 7, 18, 30, 0))
        another_event = Event.create('lunch', datetime(2017, 7, 7, 18, 30, 0))
        self.user_id = user.user_id
        self.event_id = event.event_id
        self.another_user_id = another_user.user_id
        self.another_event_id = another_event.event_id
        user.events.append(event)
        another_user.events.append(another_event)
        db.session.add(user)
        db.session.add(another_user)
        db.session.commit()
Ejemplo n.º 2
0
    def setUp(self):
        db.create_all()

        user = User.create('*****@*****.**', 'strong_password')
        self.user_id = user.user_id
        db.session.add(user)
        db.session.commit()
Ejemplo n.º 3
0
    def setUp(self):
        db.drop_all()
        db.create_all()

        self.success = {'code': 200}
        self.success_create = {'code': 201}
        self.not_json = {'code': 400, 'error': 'post type must be json'}
        self.error_need_login = {'code': 403, 'error': 'need to login'}
        self.error_need_csrf = {'code': 400, 'error': 'needs csrf token'}
        self.error_wrong_csrf = {'code': 400, 'error': 'wrong csrf token'}

        user = User.create('*****@*****.**', 'strong_password')
        self.user_id = user.user_id
        db.session.add(user)
        db.session.commit()
Ejemplo n.º 4
0
    def setUp(self):
        db.create_all()

        user = User.create('*****@*****.**', 'strong_password')
        user2 = User.create('*****@*****.**', 'strong_password')
        event = Event.create('dinner', datetime(2018, 7, 5, 18, 30, 0))
        event2 = Event.create('dinner', datetime(2018, 7, 5, 18, 30, 0))
        user.events.append(event)
        user2.events.append(event2)
        self.user_id = user.user_id
        self.user_id2 = user2.user_id
        self.event_id = event.event_id
        self.event_id2 = event2.event_id
        db.session.add(user)
        db.session.add(user2)
        db.session.commit()
Ejemplo n.º 5
0
    def setUp(self):
        db.drop_all()
        db.create_all()

        self.success = {'code': 200}
        self.success_create = {'code': 201}
        self.not_json = {'code': 403, 'error': 'post type must be json'}
        self.field_not_complete = {'code': 403, 'error': 'fields not complete'}
        self.wrong_email = {'code': 403, 'error': "format check of email failed: got today's dinner"}

        user = User.create('*****@*****.**', 'strong_password')
        event = Event.create('dinner', datetime.now())
        self.user_id = user.user_id
        self.event_id = event.event_id
        user.events.append(event)
        db.session.add(user)
        db.session.commit()
Ejemplo n.º 6
0
    def setUp(self):
        db.drop_all()
        db.create_all()

        self.success = {'code': 200}
        self.success_create = {'code': 201}
        self.not_json = {'code': 400, 'error': 'post type must be json'}
        self.field_not_complete = {'code': 400, 'error': 'fields not complete'}
        self.wrong_email = {
            'code': 400,
            'error': "format check of email failed: got today's dinner"
        }
        self.error_need_csrf = {'code': 400, 'error': 'needs csrf token'}
        self.error_wrong_csrf = {'code': 400, 'error': 'wrong csrf token'}

        user = User.create('*****@*****.**', 'strong_password')
        self.user_id = user.user_id
        db.session.add(user)
        db.session.commit()
Ejemplo n.º 7
0
 def setUp(self):
     db.create_all()