Skip to content

Dragonflies - Malik#24

Open
malikelmessiry wants to merge 24 commits into
Ada-C23:mainfrom
malikelmessiry:main
Open

Dragonflies - Malik#24
malikelmessiry wants to merge 24 commits into
Ada-C23:mainfrom
malikelmessiry:main

Conversation

@malikelmessiry
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@mikellewade mikellewade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Malik, good work on your Task list project!

Comment thread app/__init__.py
Comment on lines +7 to 9
load_dotenv()
import os

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
load_dotenv()
import os
import os
load_dotenv()

Comment thread app/__init__.py
Comment on lines +4 to +5
from .routes.task_routes import bp as tasks_bp
from .routes.goal_routes import bp as goals_bp
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! You are following Flask convention to by naming your Blueprints bp and then using as to import them under an alias.

Comment thread app/__init__.py
Comment on lines +24 to +25
app.register_blueprint(tasks_bp)
app.register_blueprint(goals_bp)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread app/__init__.py
if config:
# Merge `config` into the app's configuration
# to override the app's default settings for testing

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Comment thread app/models/goal.py

class Goal(db.Model):
id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True)
title: Mapped[str]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work using the declarative mapping here! Since we are doing any specific declarations like in id we can simply use Mapped in conjunction with a Python datatype to declare what this column will look like.

Comment thread tests/test_wave_01.py

# Assert
assert response.status_code == 404
assert response_body == {"message": "Task 1 is not found"}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⭐️

Comment thread tests/test_wave_05.py
Comment on lines +58 to +59
assert response.status_code == 404
assert response_body == {"message": "Goal 1 is not found"}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⭐️

Comment thread tests/test_wave_05.py
Comment on lines +83 to +92
response = client.put("goals/1", json={
"title": "This is my updated Task Title"
})

# Assert
# ---- Complete Assertions Here ----
# assertion 1 goes here
# assertion 2 goes here
# assertion 3 goes here
# ---- Complete Assertions Here ----
assert response.status_code == 204

query = db.select(Goal).where(Goal.id == 1)
goal = db.session.scalar(query)

assert goal.title == "This is my updated Task Title"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work checking the database to make sure the changes persisted!

Comment thread tests/test_wave_05.py
Comment on lines +97 to +103
response = client.put("/goals/1", json={
"title": "updated task title"
})
response_body = response.get_json()

# Assert
# ---- Complete Assertions Here ----
# assertion 1 goes here
# assertion 2 goes here
# ---- Complete Assertions Here ----
assert response.status_code == 404
assert response_body == {"message": "Goal 1 is not found"}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⭐️

Comment thread tests/test_wave_05.py
Comment on lines +128 to +130
assert response.status_code == 404
assert response_body == {"message": "Goal 1 is not found"}
assert db.session.scalars(db.select(Goal)).all() == []
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⭐️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants