summaryrefslogtreecommitdiff
path: root/tests/test_export_colors.py
diff options
context:
space:
mode:
authorDylan Araps <dylanaraps@users.noreply.github.com>2017-06-29 23:07:13 +1000
committerGitHub <noreply@github.com>2017-06-29 23:07:13 +1000
commitc7cd458bfd9fd5767dafb7948dd22ef6774ac9c9 (patch)
tree0fd07c4096ee4ca495faecdb2201f76e515da787 /tests/test_export_colors.py
parent3283d38e07d4b20ad3a0646d28284fe205fcdc57 (diff)
parent08f396c653e6b3fb738f39d13a9ca5eea0d61f28 (diff)
Merge pull request #18 from dylanaraps/template
colors: Use template files and un-hard-code export formats.
Diffstat (limited to 'tests/test_export_colors.py')
-rwxr-xr-xtests/test_export_colors.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/tests/test_export_colors.py b/tests/test_export_colors.py
index 7cee594..90af273 100755
--- a/tests/test_export_colors.py
+++ b/tests/test_export_colors.py
@@ -13,11 +13,18 @@ COLORS = util.read_file_json("tests/test_files/test_file.json")
class TestExportColors(unittest.TestCase):
"""Test the export_colors functions."""
- def test_save_colors(self):
- """> Export colors to a file."""
- tmp_file = pathlib.Path("/tmp/test_file.json")
- export_colors.save_colors(COLORS, tmp_file, "plain colors")
- result = tmp_file.is_file()
+ def test_template(self):
+ """> Test substitutions in template file."""
+ # Merge both dicts so we can access their
+ # values simpler.
+ COLORS["colors"].update(COLORS["special"])
+
+ # Dirs to use.
+ tmp_dir = pathlib.Path("/tmp")
+ test_template = pathlib.Path("tests/test_files/test_template")
+ export_colors.template(COLORS["colors"], test_template, tmp_dir)
+
+ result = pathlib.Path("/tmp/test_template").is_file()
self.assertTrue(result)