test_contest_handler.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:territoriali-backend 作者: algorithm-ninja 项目源码 文件源码
def test_sumbit_not_matching(self, g_f_s_mock, g_i_mock):
        Utils.start_contest()
        self._insert_data(token="token", task="poldo")
        self._insert_data(token="token2", task="poldo")
        backup = Logger.LOG_LEVEL
        Logger.LOG_LEVEL = 9001

        self.handler.generate_input(token='token', task='poldo', _ip='1.1.1.1')
        g_i_mock.return_value = ("inputid2", "/path")
        self.handler.generate_input(token='token2', task='poldo', _ip='1.1.1.1')

        Database.c.execute("INSERT INTO outputs (id, input, path, size, result) "
                           "VALUES ('outputid', 'inputid', '/output', 42, '{}')")
        Database.c.execute("INSERT INTO sources (id, input, path, size) "
                           "VALUES ('sourceid', 'inputid2', '/source', 42)")
        with self.assertRaises(Forbidden) as ex:
            self.handler.submit(output_id='outputid', source_id='sourceid', _ip='1.1.1.1')

        self.assertIn("The provided pair of source-output is invalid", ex.exception.response.data.decode())
        Logger.LOG_LEVEL = backup
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号