-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2799 from hmpf/test-pkg-resource-usage
Test pkg_resource usage
- Loading branch information
Showing
4 changed files
with
57 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from unittest import TestCase | ||
|
||
|
||
class TestBuildconf(TestCase): | ||
def test_VERSION_can_be_imported(self): | ||
try: | ||
from nav.buildconf import VERSION | ||
except ImportError: | ||
self.fail('VERSION could not be imported') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from nav.config import _config_resource_walk | ||
|
||
|
||
from unittest import TestCase | ||
|
||
|
||
class TestConfigResourceWalk(TestCase): | ||
def test_should_read_relative_paths_as_strings_from_nav_package_and_return_a_long_list_of_strings( | ||
self, | ||
): | ||
# result should be many, many relative paths as strings | ||
result = tuple(_config_resource_walk()) # generator | ||
self.assertTrue(len(result) > 20) | ||
for relpath in result: | ||
self.assertIsInstance(relpath, str) | ||
self.assertFalse(relpath.startswith('/')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from nav.pgsync import ChangeScriptFinder, Synchronizer | ||
|
||
|
||
from unittest import TestCase | ||
|
||
|
||
class TestChangeScriptFinder(TestCase): | ||
def test_init_should_read_sql_filenames_from_package_and_return_list_of_relative_filenames( | ||
self, | ||
): | ||
csf = ChangeScriptFinder('nav.models') | ||
self.assertTrue(len(csf) > 40) | ||
for sql_filename in csf: | ||
self.assertTrue(sql_filename.startswith('sql/')) | ||
self.assertTrue(sql_filename.endswith('.sql')) | ||
|
||
|
||
class TestSynchronizer(TestCase): | ||
def test_should_read_sql_file_from_package_and_return_bytes(self): | ||
syncer = Synchronizer('nav.models', config=True) | ||
filename = "sql/baseline/manage.sql" | ||
sql = syncer._read_sql_file(filename) | ||
self.assertIn("CREATE TABLE org", str(sql)) |