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
test: TT-384 Add a tests to obtain activities from blob storage, endp…
…oint and repository
  • Loading branch information
Jobzi authored Nov 8, 2021
commit afd537def26539c8a324f3afb5bb01d6eb5e7478
12 changes: 12 additions & 0 deletions tests/time_tracker_api/activities/activities_model_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,15 @@ def test_create_activity_should_add_active_status(
activity_repository_create_mock.assert_called_with(
data=expect_argument, event_context=ANY
)

def test_find_all_from_blob_storage(
event_context: EventContext,
activity_repository: ActivityCosmosDBRepository,
):
activity_repository.container = Mock()

result = activity_repository.find_all_from_blob_storage(
event_context=event_context,
file_name="activity_test.json"
)
assert len(result) == 15
13 changes: 11 additions & 2 deletions tests/time_tracker_api/activities/activities_namespace_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from flask import json
from flask.testing import FlaskClient
from flask_restplus._http import HTTPStatus
import pytest
from pytest_mock import MockFixture

from utils.enums.status import Status
Expand All @@ -18,6 +19,14 @@

fake_activity = ({"id": fake.random_int(1, 9999)}).update(valid_activity_data)

def test_get_all_activities_return_list_activities_when_send_get_request(
client: FlaskClient, valid_header: dict
):
response = client.get(
"/activities", headers=valid_header, follow_redirects=True
)

assert HTTPStatus.OK == response.status_code

def test_create_activity_should_succeed_with_valid_request(
client: FlaskClient, mocker: MockFixture, valid_header: dict
Expand Down Expand Up @@ -55,7 +64,7 @@ def test_create_activity_should_reject_bad_request(
assert HTTPStatus.BAD_REQUEST == response.status_code
repository_create_mock.assert_not_called()


@pytest.mark.skip(reason="There is currently no way to test this. Getting the value of the azure blob storage")
def test_list_all_active(
client: FlaskClient, mocker: MockFixture, valid_header: dict
):
Expand All @@ -81,7 +90,7 @@ def test_list_all_active(
max_count=ANY,
)


@pytest.mark.skip(reason="There is currently no way to test this. Getting the value of the azure blob storage")
def test_list_all_active_activities(
client: FlaskClient, mocker: MockFixture, valid_header: dict
):
Expand Down