浏览代码

remove temporary test view for email

Guénaël Muller 6 年前
父节点
当前提交
2933b47895
共有 1 个文件被更改,包括 0 次插入99 次删除
  1. 0 99
      tracim/views/core_api/session_controller.py

+ 0 - 99
tracim/views/core_api/session_controller.py 查看文件

@@ -94,99 +94,6 @@ class SessionController(Controller):
94 94
             config=app_config,
95 95
         )
96 96
 
97
-    @hapic.with_api_doc()
98
-    @hapic.output_body(
99
-        UserSchema(),
100
-    )
101
-    def create_user(self, context, request: TracimRequest, hapic_data=None):
102
-        """
103
-        Return current logged in user or 401
104
-        """
105
-        app_config = request.registry.settings['CFG']
106
-        uapi = UserApi(
107
-            None,
108
-            session=request.dbsession,
109
-            config=app_config,
110
-        )
111
-        group_api = GroupApi(current_user=None, session=request.dbsession)
112
-        groups = [group_api.get_one(Group.TIM_USER),
113
-                  group_api.get_one(Group.TIM_MANAGER),
114
-                  group_api.get_one(Group.TIM_ADMIN)]
115
-        user = uapi.create_user(
116
-            email='dev.tracim.testuser@algoo.fr',
117
-            password='toto',
118
-            name='toto',
119
-            groups=groups,
120
-            timezone="lapin",
121
-            do_save=True,
122
-            do_notify=True,
123
-        )
124
-        wapi = WorkspaceApi(
125
-            current_user=user,
126
-            session=request.dbsession,
127
-        )
128
-        workspace = wapi.get_one_by_label('w1')
129
-        rapi = RoleApi(
130
-            session=request.dbsession,
131
-            current_user=user,
132
-        )
133
-        rapi.create_one(
134
-            user=user,
135
-            workspace=workspace,
136
-            role_level=8,
137
-            with_notif=True,
138
-            flush=True,
139
-        )
140
-        return UserInContext(
141
-            user=user,
142
-            dbsession=request.dbsession,
143
-            config=app_config,
144
-        )
145
-
146
-    @hapic.with_api_doc()
147
-    @hapic.handle_exception(
148
-        NotAuthentificated,
149
-        http_code=HTTPStatus.UNAUTHORIZED
150
-    )
151
-    @hapic.output_body(
152
-        NoContentSchema()
153
-    )
154
-    def add_content(self, context, request: TracimRequest, hapic_data=None):
155
-        """
156
-        Return current logged in user or 401
157
-        """
158
-        app_config = request.registry.settings['CFG']
159
-        uapi = UserApi(
160
-            current_user=request.current_user,
161
-            session=request.dbsession,
162
-            config=app_config,
163
-        )
164
-        workspace = WorkspaceApi(
165
-            current_user=request.current_user,
166
-            session=request.dbsession
167
-        ).get_one_by_label('w1')
168
-        api = ContentApi(
169
-            current_user=request.current_user,
170
-            session=request.dbsession,
171
-            config=app_config,
172
-        )
173
-        item = api.create(
174
-            ContentType.Folder,
175
-            workspace,
176
-            None,
177
-            'parent',
178
-            do_save=True,
179
-        )
180
-        item2 = api.create(
181
-            ContentType.File,
182
-            workspace,
183
-            item,
184
-            'file1',
185
-            do_save=True,
186
-            do_notify=True,
187
-        )
188
-        return
189
-
190 97
     def bind(self, configurator: Configurator):
191 98
 
192 99
         # Login
@@ -200,9 +107,3 @@ class SessionController(Controller):
200 107
         # Whoami
201 108
         configurator.add_route('whoami', '/sessions/whoami', request_method='GET')  # nopep8
202 109
         configurator.add_view(self.whoami, route_name='whoami',)
203
-
204
-        configurator.add_route('create_user_test', '/create_user', request_method='POST')  # nopep8
205
-        configurator.add_view(self.create_user, route_name='create_user_test',)
206
-
207
-        configurator.add_route('add_content', '/add_content', request_method='POST')  # nopep8
208
-        configurator.add_view(self.add_content, route_name='add_content',)