Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created date util #19 #26

Merged
merged 5 commits into from
Aug 9, 2024
Merged

Created date util #19 #26

merged 5 commits into from
Aug 9, 2024

Conversation

zachale
Copy link
Collaborator

@zachale zachale commented Jul 28, 2024

Overview

  • Created date util that intercepts incoming days and ensures they are in iso format.
  • This way, you can create images using an iso timestamp for the day the images are needed, or the # of days after august 1st 2024.

@@ -150,7 +169,7 @@ def test_post_image_create_endpoint_success(client, mock_data):
assert res.json == build_result(
res.json["url"].split("/")[-1],
entry["real"],
entry["date"],
calculate_date(entry["date"]),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is a bandaid until my other PR is merged with a better setup for data in the mock FS

@zachale zachale changed the title created date util #19 Created date util #19 Jul 28, 2024
@zachale zachale self-assigned this Jul 28, 2024
@zachale zachale added the enhancement New feature or request label Jul 28, 2024
from ImageHandler import ImageHandler
from schemas.image_info import ImageInfo
from imaginate_api.image_handler import ImageHandler
from imaginate_api.schemas.image_info import ImageInfo
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
from imaginate_api.schemas.image_info import ImageInfo
from image_handler_client.schemas.image_info import ImageInfo

Since the schema has been moved to that repository

@@ -59,7 +59,7 @@ jobs:
envkey_MONGO_TOKEN: ${{ secrets.MONGO_TOKEN }}
file_name: .env
- name: Run tests
run: poetry run pytest --doctest-modules --junitxml=junit/test-results.xml
run: poetry run pytest tests/unit/test_app.py --doctest-modules --junitxml=junit/test-results.xml
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
run: poetry run pytest tests/unit/test_app.py --doctest-modules --junitxml=junit/test-results.xml
run: poetry run pytest --doctest-modules --junitxml=junit/test-results.xml


# helper function that returns a timestamp as an integer, no matter if day is inputed as a timestamp or day #
# WARNING, do not enter a timestamp from BEFORE august 1st 2024.
def calculate_date(day: str | int):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This now takes in a string OR integer, calculates a timestamp and returns it as an integer

Copy link
Collaborator

@faisal-fawad faisal-fawad left a comment

Choose a reason for hiding this comment

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

LGTM! 🎉

@zachale zachale merged commit b493a73 into main Aug 9, 2024
3 checks passed
@zachale zachale deleted the 19-create-date-util branch August 9, 2024 01:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants