Skip to content

Commit

Permalink
black/isort lint
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-bryson committed Aug 16, 2023
1 parent 5cc3faf commit 2c1ec64
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion harvester/db/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from sqlalchemy import text
from sqlalchemy.orm import DeclarativeBase, mapped_column
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.orm import DeclarativeBase, mapped_column


class Base(DeclarativeBase):
Expand Down
12 changes: 5 additions & 7 deletions harvester/db/models/models.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import enum
import os

import dotenv

from harvester.db.models import Base

from sqlalchemy import ForeignKey, SMALLINT, create_engine
from sqlalchemy import String, DateTime, Enum
from sqlalchemy.dialects.postgresql import JSON, UUID, ARRAY
from sqlalchemy import (SMALLINT, DateTime, Enum, ForeignKey, String,
create_engine)
from sqlalchemy.dialects.postgresql import ARRAY, JSON, UUID
from sqlalchemy.orm import mapped_column, sessionmaker
from sqlalchemy.sql import func

import enum
from harvester.db.models import Base

dotenv.load_dotenv()

Expand Down
29 changes: 18 additions & 11 deletions tests/db/sqlalchemy/conftest.py
Original file line number Diff line number Diff line change
@@ -1,40 +1,47 @@
import pytest
import pytest

@pytest.fixture

@pytest.fixture
def create_test_harvest_source():
return {
"id": "7b295ba9-137e-4d0d-8295-3abac2849a0e",
"name": "test_harvest_source",
"notification_emails": [ "[email protected]", "[email protected]" ],
"notification_emails": ["[email protected]", "[email protected]"],
"organization_name": "example",
"frequency": "weekly",
"config": { "test": 1, "example": True, "something": [ "a", "b" ] },
"urls": [ "https://path_to_resource/example.json", "https://path_to_resource/another_example.json"],
"schema_validation_type": "dcatus"
"config": {"test": 1, "example": True, "something": ["a", "b"]},
"urls": [
"https://path_to_resource/example.json",
"https://path_to_resource/another_example.json",
],
"schema_validation_type": "dcatus",
}

@pytest.fixture

@pytest.fixture
def create_test_harvest_job():
return {
"id": "c8837a2f-bd0b-4333-82f5-0b64f126da34",
"source_id": "7b295ba9-137e-4d0d-8295-3abac2849a0e",
"status": "INACTIVE",
}

@pytest.fixture

@pytest.fixture
def create_test_harvest_record():
return {
"job_id": "c8837a2f-bd0b-4333-82f5-0b64f126da34",
"source_id": "7b295ba9-137e-4d0d-8295-3abac2849a0e",
"status": "ACTIVE",
"s3_path": "https://bucket-name.s3.region-code.amazonaws.com/key-name"
"s3_path": "https://bucket-name.s3.region-code.amazonaws.com/key-name",
}


@pytest.fixture
def create_test_harvest_error():
return {
"job_id": "c8837a2f-bd0b-4333-82f5-0b64f126da34",
"record_id": "b5195975-03db-4cf8-b373-52035f0f428f",
"record_reported_id": "example",
"severity": "CRITICAL"
}
"severity": "CRITICAL",
}
17 changes: 6 additions & 11 deletions tests/db/sqlalchemy/test_sqlalchemy.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
from harvester.db.models import Base
from harvester.db.models.models import (
create_sqlalchemy_engine,
create_sqlalchemy_session,
)
from harvester.db.models.models import (
HarvestSource,
HarvestJob,
HarvestRecord,
HarvestError,
)
from sqlalchemy.orm import close_all_sessions

from harvester.db.models import Base
from harvester.db.models.models import (HarvestError, HarvestJob,
HarvestRecord, HarvestSource,
create_sqlalchemy_engine,
create_sqlalchemy_session)


def test_add_tables():
engine = create_sqlalchemy_engine()
Expand Down

1 comment on commit 2c1ec64

@github-actions
Copy link

Choose a reason for hiding this comment

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

Coverage

Coverage Report
FileStmtsMissCoverMissing
harvester
   __init__.py30100% 
harvester/db/models
   __init__.py50100% 
   models.py6422 97%
harvester/extract
   __init__.py1922 89%
   dcatus.py1122 82%
harvester/utils
   __init__.py00100% 
   json.py2266 73%
   pg.py3544 89%
   s3.py2466 75%
harvester/validate
   __init__.py00100% 
   dcat_us.py240100% 
TOTAL2072289% 

Tests Skipped Failures Errors Time
27 0 💤 5 ❌ 0 🔥 23.192s ⏱️

Please sign in to comment.