Skip to content

Commit

Permalink
Merge pull request #118 from openEDI/unittests
Browse files Browse the repository at this point in the history
Updated unit tests requirements and packages
  • Loading branch information
Jweers authored May 29, 2024
2 parents a8af11e + 162e6ac commit e92956b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
10 changes: 5 additions & 5 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
black
pytest
sphinx
moto==4.2.14
mock
black==24.4.2
pytest==8.2.0
Sphinx==7.3.7
moto==5.0.6
mock==5.1.0
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ def read_lines(filename):
],
entry_points={"console_scripts": ["oedi = oedi.cli.oedi:cli"]},
test_suite="tests"
)
)
6 changes: 3 additions & 3 deletions tests/unit/AWS/test_athena.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import mock

from moto.athena import mock_athena
from moto import mock_aws

from oedi.AWS.athena import OEDIAthena


@mock_athena
@mock_aws
@mock.patch("oedi.AWS.athena.Connection")
def test_oedi_athena__properties(mock_connection):
staging_location = "s3://my-testing-bucket/"
Expand All @@ -20,7 +20,7 @@ def test_oedi_athena__properties(mock_connection):
assert mock_connection.called


@mock_athena
@mock_aws
@mock.patch("oedi.AWS.athena.Connection")
@mock.patch("oedi.AWS.athena.OEDIAthena._pandas_cursor_execute")
@mock.patch("oedi.AWS.athena.OEDIAthena._load_wkt")
Expand Down
22 changes: 11 additions & 11 deletions tests/unit/AWS/test_glue.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import copy
import boto3
import mock
from moto import mock_glue
from moto import mock_aws

from oedi.AWS.glue import OEDIGlue
from tests.unit.test_config import OEDI_TEST_CONFIG_FILE
Expand Down Expand Up @@ -109,7 +109,7 @@
]


@mock_glue
@mock_aws
def test_oedi_glue__get_databasses():
# Setup
client = boto3.client("glue", region_name="us-west-1")
Expand Down Expand Up @@ -144,7 +144,7 @@ def create_table_input(
return table_input


@mock_glue
@mock_aws
def test_oedi_glue__get_table():
# Setup
client = boto3.client("glue", region_name="us-west-1")
Expand All @@ -166,7 +166,7 @@ def test_oedi_glue__get_table():
assert table["PartitionKeys"] == partition_keys


@mock_glue
@mock_aws
def test_oedi_glue__list_tables():
# Setup
client = boto3.client("glue", region_name="us-west-1")
Expand All @@ -190,7 +190,7 @@ def test_oedi_glue__list_tables():
assert "CreateTime" in tables[0]


@mock_glue
@mock_aws
def test_oedi_glue__get_table_columns():
# Setup
client = boto3.client("glue", region_name="us-west-1")
Expand All @@ -213,7 +213,7 @@ def test_oedi_glue__get_table_columns():
assert len(columns) == 2


@mock_glue
@mock_aws
def test_oedi_glue__get_partition_keys():
# Setup
client = boto3.client("glue", region_name="us-west-1")
Expand All @@ -237,7 +237,7 @@ def test_oedi_glue__get_partition_keys():
assert len(partition_keys) == 3


@mock_glue
@mock_aws
def test_oedi_glue__get_partition_values():
# Setup
client = boto3.client("glue", region_name="us-west-1")
Expand Down Expand Up @@ -270,7 +270,7 @@ def get_crawler(crawler_name):
raise Exception(f"Crawler '{crawler_name}' does not exist.")


@mock_glue
@mock_aws
@mock.patch("oedi.AWS.glue.OEDIGlue.get_crawler", side_effect=get_crawler)
def test_oedi_glue__get_crawler(mock_get_crawler):
glue = OEDIGlue()
Expand All @@ -279,22 +279,22 @@ def test_oedi_glue__get_crawler(mock_get_crawler):
assert crawler["Name"] == crawler_name


@mock_glue
@mock_aws
@mock.patch("oedi.AWS.glue.OEDIGlue.get_crawler", side_effect=get_crawler)
def test_oedi_glue__list_crawlers(mock_get_crawler):
glue = OEDIGlue(config_file=OEDI_TEST_CONFIG_FILE)
crawlers = glue.list_crawlers()
assert len(crawlers) == 5


@mock_glue
@mock_aws
@mock.patch("oedi.AWS.glue.OEDIGlue.get_crawler", side_effect=get_crawler)
def test_oedi_glue__get_crawler_state(mock_get_crawler):
glue = OEDIGlue(config_file=OEDI_TEST_CONFIG_FILE)
crawlers = glue.list_crawlers()
assert len(crawlers) == 5


@mock_glue
@mock_aws
def test_oedi_glue__start_crawler():
pass

0 comments on commit e92956b

Please sign in to comment.