Skip to content

Commit

Permalink
feat: Exempt from test_v1
Browse files Browse the repository at this point in the history
  • Loading branch information
takahiromitsui committed Oct 20, 2023
1 parent c80b884 commit 9a403d5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
2 changes: 2 additions & 0 deletions tests/api/versions/test_mockup_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@

# Third-party
from fastapi.testclient import TestClient
import pytest

client = TestClient(app)


@pytest.mark.e2e
class TestV1Routes(unittest.TestCase):
# unittest
@patch(
Expand Down
16 changes: 16 additions & 0 deletions tests/api/versions/test_v1.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
from fastapi.testclient import TestClient
import pytest

from src.api.main import app

client = TestClient(app)
NOT_FOUND_MESSAGE = "not found in the response"


@pytest.mark.e2e
def test_read_politician():
def random_test():
response = client.get("/v1/politician/178104")
Expand Down Expand Up @@ -139,6 +142,7 @@ def test_topic_ids_of_latest_committee():
test_topic_ids_of_latest_committee()


@pytest.mark.e2e
def test_read_politician_constituencies():
def all_elements_have_values():
response = client.get("/v1/politician/138540/constituencies")
Expand Down Expand Up @@ -496,6 +500,7 @@ def null_constituencies_exist():
null_constituencies_exist()


@pytest.mark.e2e
def test_read_politician_positions():
def selected_values_test():
response = client.get("/v1/politician/177592/positions")
Expand Down Expand Up @@ -525,6 +530,7 @@ def selected_values_test():
selected_values_test()


@pytest.mark.e2e
def test_read_politician_sidejobs():
def whole_values_test():
response = client.get("/v1/politician/119742/sidejobs?page=1&size=50")
Expand Down Expand Up @@ -592,6 +598,7 @@ def sidejob_not_found_test():
sidejob_not_found_test()


@pytest.mark.e2e
def test_read_politician_image_scanner():
def label_and_id_test():
response = client.get("/v1/image-scanner?id=79334")
Expand Down Expand Up @@ -629,6 +636,7 @@ def label_and_id_test():
label_and_id_test()


@pytest.mark.e2e
def test_read_politician_search():
def selected_values_test():
response = client.get("/v1/search?text=55278")
Expand Down Expand Up @@ -659,6 +667,7 @@ def test_response_size():
test_response_size()


@pytest.mark.e2e
def test_read_politician_zipcode_search():
response = client.get("/v1/search-zipcode?text=55278")
assert response.status_code == 200
Expand All @@ -681,12 +690,14 @@ def test_read_politician_zipcode_search():
assert check_response, f"{item} {NOT_FOUND_MESSAGE}"


@pytest.mark.e2e
def test_read_politician_partial_name_search():
response = client.get("/v1/search-name?text=Christian")
assert len(response.json()) >= 1
assert len(response.json()) <= 20


@pytest.mark.e2e
def test_read_politician_votes():
def no_filters_random_test():
response = client.get("/v1/politician/79137/votes")
Expand Down Expand Up @@ -739,6 +750,7 @@ def response_size_by_filters_test():
response_size_by_filters_test()


@pytest.mark.e2e
def test_read_poll_details():
def random_test():
response = client.get("/v1/poll/4217/details")
Expand Down Expand Up @@ -828,6 +840,7 @@ def test_same_poll_id_in_response():
test_same_poll_id_in_response()


@pytest.mark.e2e
def test_read_politician_speech():
def selected_values_test():
response = client.get("/v1/politician/119742/speeches?page=2")
Expand All @@ -852,6 +865,7 @@ def selected_invalid_values_test():
# selected_invalid_values_test()


@pytest.mark.e2e
def test_read_bundestag_sidejobs():
def values_test():
response_items = client.get("/v1/bundestag/sidejobs")
Expand All @@ -865,6 +879,7 @@ def values_test():
values_test()


@pytest.mark.e2e
def test_read_bundestag_sidejobs_pagination():
def values_test():
response = client.get("v1/bundestag/allsidejobs?page=1&size=50")
Expand Down Expand Up @@ -922,6 +937,7 @@ def selected_invalid_values_test():
selected_invalid_values_test()


@pytest.mark.e2e
def test_read_homepage_party_donations():
response = client.get("/v1/homepagepartydonations")
response_json = response.json()
Expand Down
5 changes: 4 additions & 1 deletion tests/unit/db/models/test_party_donation_organization.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


def insert_party_donation_organization(session):
# Act
# Arrange
party_donation_organization = PartyDonationOrganization(
id=1,
donor_name="Test Donor",
Expand All @@ -26,6 +26,8 @@ def delete_party_donation_organization(session):

class TestPartyDonationOrganization:
def test_insert_party_donation_organization_valid(self, session):
# Arrange
insert_party_donation_organization(session)
result = (
session.query(PartyDonationOrganization)
.filter(PartyDonationOrganization.id == 1)
Expand All @@ -44,6 +46,7 @@ def test_insert_party_donation_organization_valid(self, session):
@pytest.mark.xfail(raises=Exception)
def test_insert_party_donation_organization_no_donor_name_invalid(self, session):
try:
# Arrange
insert_party_donation_organization(session)
except Exception:
session.rollback()
Expand Down

0 comments on commit 9a403d5

Please sign in to comment.