Browse Source

Add tests for the labels

Signed-off-by: Colin Hebert <[email protected]>
Colin Hebert 8 years ago
parent
commit
37de55865b
1 changed files with 28 additions and 0 deletions
  1. 28 0
      tests/unit/config/config_test.py

+ 28 - 0
tests/unit/config/config_test.py

@@ -825,6 +825,34 @@ class ConfigTest(unittest.TestCase):
         assert service['build']['args']['opt1'] == '42'
         assert service['build']['args']['opt2'] == 'foobar'
 
+    def test_load_with_labels(self):
+        service = config.load(
+            build_config_details(
+                {
+                    'version': '3.2',
+                    'services': {
+                        'web': {
+                            'build': {
+                                'context': '.',
+                                'dockerfile': 'Dockerfile-alt',
+                                'labels': {
+                                    'label1': 42,
+                                    'label2': 'foobar'
+                                }
+                            }
+                        }
+                    }
+                },
+                'tests/fixtures/extends',
+                'filename.yml'
+            )
+        ).services[0]
+        assert 'labels' in service['build']
+        assert 'label1' in service['build']['labels']
+        assert isinstance(service['build']['labels']['label1'], str)
+        assert service['build']['labels']['label1'] == '42'
+        assert service['build']['labels']['label2'] == 'foobar'
+
     def test_build_args_allow_empty_properties(self):
         service = config.load(
             build_config_details(