Skip to content

Dragonflies - Malik#24

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

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

Conversation

@malikelmessiry
Copy link

No description provided.

Copy link

@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 on lines +7 to 9
load_dotenv()
import os

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 on lines +4 to +5
from .routes.task_routes import bp as tasks_bp
from .routes.goal_routes import bp as goals_bp

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 on lines +24 to +25
app.register_blueprint(tasks_bp)
app.register_blueprint(goals_bp)

Choose a reason for hiding this comment

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

if config:
# Merge `config` into the app's configuration
# to override the app's default settings for testing

Choose a reason for hiding this comment

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

Suggested change


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

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.


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

Choose a reason for hiding this comment

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

⭐️

Comment on lines +58 to +59
assert response.status_code == 404
assert response_body == {"message": "Goal 1 is not found"}

Choose a reason for hiding this comment

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

⭐️

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"

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 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"}

Choose a reason for hiding this comment

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

⭐️

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() == []

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