|
1 | 1 | # ================================================================= |
2 | 2 | # |
3 | 3 | # Authors: Ricardo Garcia Silva <ricardo.garcia.silva@gmail.com> |
| 4 | +# Authors: Tom Kralidis |
4 | 5 | # |
5 | 6 | # Copyright (c) 2017 Ricardo Garcia Silva |
| 7 | +# Copyright (c) 2025 Tom Kralidis |
6 | 8 | # |
7 | 9 | # Permission is hereby granted, free of charge, to any person |
8 | 10 | # obtaining a copy of this software and associated documentation |
@@ -148,7 +150,7 @@ def test_wkt2geom(wkt, bounds, expected): |
148 | 150 | "-10.0, 10.0, 30.0, 15.0", |
149 | 151 | "POLYGON((-10.00 10.00, -10.00 15.00, 30.00 15.00, " |
150 | 152 | "30.00 10.00, -10.00 10.00))" |
151 | | - ), |
| 153 | + ) |
152 | 154 | ]) |
153 | 155 | def test_bbox2wktpolygon(bbox, expected): |
154 | 156 | result = util.bbox2wktpolygon(bbox) |
@@ -367,6 +369,20 @@ def test_programmatic_import_with_invalid_path(invalid_import_path): |
367 | 369 | result = util.programmatic_import(invalid_import_path) |
368 | 370 | assert result is None |
369 | 371 |
|
| 372 | + |
370 | 373 | def test_sanitize_url(): |
371 | 374 | result = util.sanitize_db_connect("postgresql://username:password@localhost/pycsw") |
372 | 375 | assert result == "postgresql://***:***@localhost/pycsw" |
| 376 | + |
| 377 | + |
| 378 | +def test_str2bool(): |
| 379 | + assert util.str2bool('true') |
| 380 | + assert util.str2bool(True) |
| 381 | + assert util.str2bool('1') |
| 382 | + assert util.str2bool('yes') |
| 383 | + assert util.str2bool('on') |
| 384 | + assert not util.str2bool('0') |
| 385 | + assert not util.str2bool('false') |
| 386 | + assert not util.str2bool(False) |
| 387 | + assert not util.str2bool('off') |
| 388 | + assert not util.str2bool('no') |
0 commit comments