Skip to content

Commit

Permalink
First pass at adding test
Browse files Browse the repository at this point in the history
  • Loading branch information
anchapin committed May 10, 2024
1 parent 6ff1aad commit ce34f13
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions tests/test_seed_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import unittest
from datetime import date
from pathlib import Path
from unittest.mock import patch

# Local Imports
from pyseed.seed_client import SeedClient
Expand Down Expand Up @@ -46,10 +47,17 @@ def setup_class(cls):
"tests/data/test-seed-data-mappings.csv",
)

# Mock the API endpoint for get_pm_report_template_names
cls.mock_report_templates = patch(
"pyseed.seed_client.SeedClient.get_pm_report_template_names",
return_value=["Template 1", "Template 2"],
)
cls.mock_report_templates.start()

@classmethod
def teardown_class(cls):
# remove all of the test buildings?
pass
# Stop the mock
cls.mock_report_templates.stop()

def test_seed_orgs(self):
orgs = self.seed_client.get_organizations()
Expand All @@ -66,6 +74,13 @@ def test_seed_buildings(self):
# ESPM test creates a building now too, assert building count is 10 or 11?
assert len(buildings) == 10

def test_get_pm_report_template_names(self):
template_names = self.seed_client.get_pm_report_template_names()
assert isinstance(template_names, list)
assert len(template_names) >= 2
assert "Template 1" in template_names
assert "Template 2" in template_names

def test_search_buildings(self):
# set cycle
self.seed_client.get_cycle_by_name('pyseed-api-test', set_cycle_id=True)
Expand Down

0 comments on commit ce34f13

Please sign in to comment.