Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: #215 Return Latest Entries and refactor Time Entries
  • Loading branch information
josepato87 authored and PaulRC-ioet committed Nov 16, 2020
commit 77e7d539044b2adfa66733dd4afb89454305eac6
8 changes: 6 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from time_tracker_api import create_app
from time_tracker_api.database import init_sql
from time_tracker_api.security import get_or_generate_dev_secret_key
from time_tracker_api.time_entries.time_entries_model import (
from time_tracker_api.time_entries.time_entries_repository import (
TimeEntryCosmosDBRepository,
)

Expand Down Expand Up @@ -84,7 +84,11 @@ def cosmos_db_model():
return {
'id': 'test',
'partition_key': PartitionKey(path='/tenant_id'),
'unique_key_policy': {'uniqueKeys': [{'paths': ['/email']},]},
'unique_key_policy': {
'uniqueKeys': [
{'paths': ['/email']},
]
},
}


Expand Down
24 changes: 15 additions & 9 deletions tests/time_tracker_api/time_entries/time_entries_model_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@

from commons.data_access_layer.database import EventContext
from time_tracker_api.time_entries.time_entries_model import (
TimeEntryCosmosDBRepository,
TimeEntryCosmosDBModel,
)
from time_tracker_api.time_entries.time_entries_repository import (
TimeEntryCosmosDBRepository,
)


def create_time_entry(
Expand Down Expand Up @@ -174,16 +176,20 @@ def test_find_interception_should_ignore_id_of_existing_item(
)

try:
colliding_result = time_entry_repository.find_interception_with_date_range(
start_date, end_date, owner_id, tenant_id
colliding_result = (
time_entry_repository.find_interception_with_date_range(
start_date, end_date, owner_id, tenant_id
)
)

non_colliding_result = time_entry_repository.find_interception_with_date_range(
start_date,
end_date,
owner_id,
tenant_id,
ignore_id=existing_item.id,
non_colliding_result = (
time_entry_repository.find_interception_with_date_range(
start_date,
end_date,
owner_id,
tenant_id,
ignore_id=existing_item.id,
)
)

assert colliding_result is not None
Expand Down
Loading