예제 #1
0
    def test_update(self):
        with deepstar_path():
            FrameSetModel().insert(None)
            FrameModel().insert(1, 0)

            TransformSetModel().insert('test', 1)

            transform_model = TransformModel()
            transform_model.insert(1, 1, 'test1', 0)

            result = transform_model.select(1)
            self.assertEqual(result, (1, 1, 1, 'test1', 0))

            result = transform_model.update(1, 'test2', 1)
            self.assertTrue(result)

            result = transform_model.select(1)
            self.assertEqual(result, (1, 1, 1, 'test2', 1))
예제 #2
0
    def test_select(self):
        with deepstar_path():
            FrameSetModel().insert(None)
            FrameModel().insert(1, 0)

            TransformSetModel().insert('test', 1)

            transform_model = TransformModel()
            transform_model.insert(1, 1, '{}', 0)

            result = transform_model.select(1)
            self.assertEqual(result, (1, 1, 1, '{}', 0))
            def put(self, transform_set_id, transform_id):
                transform_model = TransformModel()

                result = transform_model.update(
                    transform_id, rejected=request.get_json()['rejected'])
                if result is False:
                    abort(404)

                result = transform_model.select(transform_id)
                if result is None:
                    abort(404)

                return jsonify(result)