コード例 #1
0
    def test_sign_up(self):
        RoomFactory(is_default=False)
        room = RoomFactory(is_default=True)

        res = self.post(
            '/api/auth/sign-up', {
                'display': 'display',
                'email': '*****@*****.**',
                'rank': '3k',
                'password': '******',
                'recaptcha': 'PASS'
            })
        self.assertEqual(res.code, 200)

        user = session.query(User).one()

        self.assertFalse(user.is_active)
        self.assertEqual(user.display, 'display')
        self.assertEqual(user.email, '*****@*****.**')
        self.assertEqual(user.rating, min_rating('3k'))
        self.assertTrue(user.check_password('pw'))
        self.assertIsNotNone(user.rating_data)
        self.assertEqual(user.rating_data.rating, min_rating('3k'))

        self.assertEqual(len(user.rooms), 1)
        self.assertEqual(user.rooms[0].room_id, room.id)
コード例 #2
0
def db(request):
    session.rollback()
    session.query(RoomUser).delete()
    session.query(RoomMessage).delete()
    session.query(Connection).delete()
    session.query(DirectRoom).delete()
    session.query(Automatch).delete()
    session.query(Timing).delete()
    session.query(Game).delete()
    session.query(Room).delete()
    session.query(Challenge).delete()
    session.query(User).delete()

    def fin():
        session.rollback()

    request.addfinalizer(fin)

    return session
コード例 #3
0
ファイル: base.py プロジェクト: Jiankun-Huang/JGS
    def setUp(self):
        super().setUp()

        session.rollback()
        session.query(RoomUser).delete()
        session.query(RoomMessage).delete()
        session.query(Connection).delete()
        session.query(DirectRoom).delete()
        session.query(Automatch).delete()
        session.query(Timing).delete()
        session.query(Game).delete()
        session.query(Room).delete()
        session.query(Challenge).delete()
        session.query(User).delete()