dci-python-backend-assignments / tdd-class-social

6 stars 4 forks source link

As a institution I want to confirm a teacher and a student. #4

Open HugoLMFbd opened 2 years ago

HugoLMFbd commented 2 years ago

As an institution, I want to confirm the teachers who are working in the institution and confirm the student who study or have studied with us before.

mathiasbrito-dci commented 2 years ago

check issue #1 it is also related to the institution, so we need to implement the Institution model, please work together with the developer responsible for issue #1.

HugoLMFbd commented 2 years ago

I didn't start solving this "issue_4", I'm having problems with the reference directory class_social in the last pull and I cannot import anything from this python package, I'm planing to create the tests for the route, and the controller test too if is necessary after solving my problem with the reference.

mathiasbrito-dci commented 2 years ago

Ok, let me join you later to check this problem...

HugoLMFbd commented 2 years ago

I been working on the confirmation and I realized that the confirm_user needs at first a confirmation_request from the Teacher(user) , Student(user) or Institution(user) I've tested the route @users_routes.get('/confirmation'). I was trying to implement something out of my issue trying to do the request but I discarded . In test_user_controller I'm not sure if I can mock an append return because I been thinking the confirmation as appending a institution in Teacher(user), Student(user) institution attribute and the Teacher(user), Student(user) in the associates attribute of Institution to complete the confirmation. I'm planning today moving forward thru the controller test and implementation.

mathiasbrito-dci commented 2 years ago

You can always encapsulate append in a function and mock thar function. There is always a way to mock append, but since we are still learning I would advise to go for the first option.

HugoLMFbd commented 2 years ago

in the fist approach I need an attribute for the class model Institution(user) called association_requests:Optional[List[Union[Student, Teacher]]] can I just add this attribute to it? I'll mock confirmation_request but in any case I have to append the respective users associated to each class, institution attribute for students, teachers class and associates attribute for Institution class.

mathiasbrito-dci commented 2 years ago

yes you can, make sure to make it Optional...

HugoLMFbd commented 2 years ago

What I did yesterday? I implement one tested route and one tested method. Any problems? I test the route for confirm_user then when I implement the method I didn't noticed that I need a institution argument in the confirm_user route and method. The problem is the route isn'tasser 200 now asser 422 a semantic problem. What I plan for today? Find a solution to this 422 problem and then continue testing to see what more should I implement in the confirmation method.

mathiasbrito-dci commented 2 years ago

Good, Hugo. The 422 problem happens when you provide invalid or incomplete data to the router, please double-check if the data you are using to test the routes matches the models.