Skip to content

Commit

Permalink
debug unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
botenvouwer committed Jan 14, 2025
1 parent 9f77ddc commit f2e3a85
Showing 1 changed file with 134 additions and 161 deletions.
295 changes: 134 additions & 161 deletions src/nl_service_metadata_generator/test/test_hvd.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ def setUp(self):
script_dir = os.path.dirname(os.path.abspath(__file__))
module_root = os.path.dirname(script_dir)
os.chdir(module_root)
print(f"Working directory: {os.getcwd()}")

os.makedirs(OUTPUT_PATH, exist_ok=True)
self.runner = CliRunner(mix_stderr=False)
Expand Down Expand Up @@ -80,169 +79,143 @@ def test_hvd_simple(self):
]
)

print('input')
print(str(CONSTANTS_CONFIG_FILE))
print(str(test_path.input))
print(str(test_path.output))

print('CWD')
print(os.getcwd())

print('Test dir')
test = os.getcwd() + '/test'
# test = Path('../../').resolve()
# print(test)
#
# test = Path('test').resolve()
# print(test)

print(test)
print('walkdir')
for root, dirs, files in os.walk(test):
level = root.replace(str(test), '').count(os.sep)
indent = ' ' * 4 * (level)
print(f'{indent}{os.path.basename(root)}/')
subindent = ' ' * 4 * (level + 1)
for f in files:
print(f'{subindent}{f}')
self.assertCLIOutput(result, test_path)

def test_hvd_complex(self):
test_path = UnitTestDataPath('hvd_complex', ServiceType.WMS)

result = self.runner.invoke(
cli,
[
'generate',
ServiceType.WMS.value,
InspireType.NONE.value,
str(CONSTANTS_CONFIG_FILE),
str(test_path.input),
str(test_path.output),
]
)

self.assertCLIOutput(result, test_path)

def test_inspire_wms(self):
test_path = UnitTestDataPath('inspire', ServiceType.WMS)

result = self.runner.invoke(
cli,
[
'generate',
ServiceType.WMS.value,
InspireType.NETWORK.value,
str(CONSTANTS_CONFIG_FILE),
str(test_path.input),
str(test_path.output),
]
)

self.assertCLIOutput(result, test_path)

def test_inspire_wfs(self):
test_path = UnitTestDataPath('inspire', ServiceType.WFS)

result = self.runner.invoke(
cli,
[
'generate',
ServiceType.WFS.value,
InspireType.NETWORK.value,
str(CONSTANTS_CONFIG_FILE),
str(test_path.input),
str(test_path.output),
]
)

self.assertCLIOutput(result, test_path)

def test_inspire_atom(self):
test_path = UnitTestDataPath('inspire', ServiceType.ATOM)

result = self.runner.invoke(
cli,
[
'generate',
ServiceType.ATOM.value,
InspireType.NETWORK.value,
str(CONSTANTS_CONFIG_FILE),
str(test_path.input),
str(test_path.output),
]
)

self.assertCLIOutput(result, test_path)

def test_oaf(self):
test_path = UnitTestDataPath('oaf', ServiceType.OAF)

result = self.runner.invoke(
cli,
[
'generate',
ServiceType.OAF.value,
InspireType.NONE.value,
str(CONSTANTS_CONFIG_FILE),
str(test_path.input),
str(test_path.output),
]
)

self.assertCLIOutput(result, test_path)

def test_oat(self):
test_path = UnitTestDataPath('oat', ServiceType.OAT)

result = self.runner.invoke(
cli,
[
'generate',
ServiceType.OAT.value,
InspireType.NONE.value,
str(CONSTANTS_CONFIG_FILE),
str(test_path.input),
str(test_path.output),
]
)

self.assertCLIOutput(result, test_path)

# def test_hvd_complex(self):
# test_path = UnitTestDataPath('hvd_complex', ServiceType.WMS)
#
# result = self.runner.invoke(
# cli,
# [
# 'generate',
# ServiceType.WMS.value,
# InspireType.NONE.value,
# str(CONSTANTS_CONFIG_FILE),
# str(test_path.input),
# str(test_path.output),
# ]
# )
#
# self.assertCLIOutput(result, test_path)
#
# def test_inspire_wms(self):
# test_path = UnitTestDataPath('inspire', ServiceType.WMS)
#
# result = self.runner.invoke(
# cli,
# [
# 'generate',
# ServiceType.WMS.value,
# InspireType.NETWORK.value,
# str(CONSTANTS_CONFIG_FILE),
# str(test_path.input),
# str(test_path.output),
# ]
# )
#
# self.assertCLIOutput(result, test_path)
#
# def test_inspire_wfs(self):
# test_path = UnitTestDataPath('inspire', ServiceType.WFS)
#
# result = self.runner.invoke(
# cli,
# [
# 'generate',
# ServiceType.WFS.value,
# InspireType.NETWORK.value,
# str(CONSTANTS_CONFIG_FILE),
# str(test_path.input),
# str(test_path.output),
# ]
# )
#
# self.assertCLIOutput(result, test_path)
#
# def test_inspire_atom(self):
# test_path = UnitTestDataPath('inspire', ServiceType.ATOM)
#
# result = self.runner.invoke(
# cli,
# [
# 'generate',
# ServiceType.ATOM.value,
# InspireType.NETWORK.value,
# str(CONSTANTS_CONFIG_FILE),
# str(test_path.input),
# str(test_path.output),
# ]
# )
#
# self.assertCLIOutput(result, test_path)
#
# def test_oaf(self):
# test_path = UnitTestDataPath('oaf', ServiceType.OAF)
#
# result = self.runner.invoke(
# cli,
# [
# 'generate',
# ServiceType.OAF.value,
# InspireType.NONE.value,
# str(CONSTANTS_CONFIG_FILE),
# str(test_path.input),
# str(test_path.output),
# ]
# )
#
# self.assertCLIOutput(result, test_path)
#
# def test_oat(self):
# test_path = UnitTestDataPath('oat', ServiceType.OAT)
#
# result = self.runner.invoke(
# cli,
# [
# 'generate',
# ServiceType.OAT.value,
# InspireType.NONE.value,
# str(CONSTANTS_CONFIG_FILE),
# str(test_path.input),
# str(test_path.output),
# ]
# )
#
# self.assertCLIOutput(result, test_path)
#
# def test_regular_wms(self):
# test_path = UnitTestDataPath('regular', ServiceType.WMS)
#
# result = self.runner.invoke(
# cli,
# [
# 'generate',
# ServiceType.WMS.value,
# InspireType.NONE.value,
# str(CONSTANTS_CONFIG_FILE),
# str(test_path.input),
# str(test_path.output),
# ]
# )
#
# self.assertCLIOutput(result, test_path)
#
# def test_regular_wfs(self):
# test_path = UnitTestDataPath('regular', ServiceType.WFS)
#
# result = self.runner.invoke(
# cli,
# [
# 'generate',
# ServiceType.WFS.value,
# InspireType.NONE.value,
# str(CONSTANTS_CONFIG_FILE),
# str(test_path.input),
# str(test_path.output),
# ]
# )
#
# self.assertCLIOutput(result, test_path)
def test_regular_wms(self):
test_path = UnitTestDataPath('regular', ServiceType.WMS)

result = self.runner.invoke(
cli,
[
'generate',
ServiceType.WMS.value,
InspireType.NONE.value,
str(CONSTANTS_CONFIG_FILE),
str(test_path.input),
str(test_path.output),
]
)

self.assertCLIOutput(result, test_path)

def test_regular_wfs(self):
test_path = UnitTestDataPath('regular', ServiceType.WFS)

result = self.runner.invoke(
cli,
[
'generate',
ServiceType.WFS.value,
InspireType.NONE.value,
str(CONSTANTS_CONFIG_FILE),
str(test_path.input),
str(test_path.output),
]
)

self.assertCLIOutput(result, test_path)

if __name__ == '__main__':
unittest.main()

0 comments on commit f2e3a85

Please sign in to comment.