Skip to content
Merged
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
fix: TT-261 added a second test about the methond add_complementary_info
  • Loading branch information
kevinjlope committed Jun 15, 2021
commit af2ff3c5fb3283608655f840614fabf9102e02ea
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import pytest

from utils.azure_users import AzureConnection, AzureUser
from time_tracker_api.time_entries.time_entries_repository import (
TimeEntryCosmosDBModel,
TimeEntryCosmosDBRepository,
)

from time_tracker_api.projects.projects_model import (
ProjectCosmosDBDao,
ProjectCosmosDBModel,
Expand All @@ -12,6 +13,8 @@
ActivityCosmosDBDao,
ActivityCosmosDBModel,
)
from flask_restplus._http import HTTPStatus
from werkzeug.exceptions import HTTPException

time_entry_data = {
'id': 'id',
Expand Down Expand Up @@ -42,7 +45,7 @@
}


def test_add_complementary_info(
def test_add_complementary_info_when_there_are_time_entries(
mocker,
time_entry_repository: TimeEntryCosmosDBRepository,
):
Expand Down Expand Up @@ -85,3 +88,17 @@ def test_add_complementary_info(
expected_time_entry_out[0].__dict__['activity_name']
== expected_activity.__dict__['name']
)


def test_add_complementary_info_when_there_are_not_time_entries(
time_entry_repository: TimeEntryCosmosDBRepository,
):
with pytest.raises(HTTPException) as http_error:
entries = time_entry_repository.add_complementary_info(
time_entries=None, exist_conditions=False
)
status_code = http_error.value.code
message = http_error.value.data.get('message')

assert message == 'Time entry not found'
assert status_code == HTTPStatus.NOT_FOUND