ariatosca-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [03/16] incubator-ariatosca git commit: Add checking for initial logger strings for service templates
Date Sat, 15 Apr 2017 13:07:49 GMT
Add checking for initial logger strings for service templates


Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/f2b387bc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/f2b387bc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/f2b387bc

Branch: refs/heads/ARIA-48-aria-cli
Commit: f2b387bc98f51a2222c6aeabe41c0695d6cefc33
Parents: 0876e3c
Author: Avia Efrat <avia@gigaspaces.com>
Authored: Thu Apr 13 17:59:04 2017 +0300
Committer: Avia Efrat <avia@gigaspaces.com>
Committed: Sat Apr 15 15:51:54 2017 +0300

----------------------------------------------------------------------
 tests/cli/test_service_templates.py | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f2b387bc/tests/cli/test_service_templates.py
----------------------------------------------------------------------
diff --git a/tests/cli/test_service_templates.py b/tests/cli/test_service_templates.py
index 45656cd..ea16f8b 100644
--- a/tests/cli/test_service_templates.py
+++ b/tests/cli/test_service_templates.py
@@ -16,6 +16,7 @@ class TestServiceTemplatesShow(TestCliBase):
         monkeypatch.setattr(Environment, 'model_storage', mock_storage)
         self.invoke('service_templates show 1')
 
+        assert 'Showing service template 1...' in self.logger_output_string
         assert 'Description:' not in self.logger_output_string
         assert 'Existing services:\n[]' in self.logger_output_string
 
@@ -24,6 +25,7 @@ class TestServiceTemplatesShow(TestCliBase):
         monkeypatch.setattr(Environment, 'model_storage', mock_storage)
         self.invoke('service_templates show 2')
 
+        assert 'Showing service template 2...' in self.logger_output_string
         assert 'Description:\ntest_description' in self.logger_output_string
         assert 'Existing services:\n[]' in self.logger_output_string
 
@@ -32,6 +34,7 @@ class TestServiceTemplatesShow(TestCliBase):
         monkeypatch.setattr(Environment, 'model_storage', mock_storage)
         self.invoke('service_templates show 3')
 
+        assert 'Showing service template 3...' in self.logger_output_string
         assert 'Description:\ntest_description' in self.logger_output_string
         assert "Existing services:\n['test_s']" in self.logger_output_string
 
@@ -40,6 +43,7 @@ class TestServiceTemplatesShow(TestCliBase):
         monkeypatch.setattr(Environment, 'model_storage', mock_storage)
         self.invoke('service_templates show 4')
 
+        assert 'Showing service template 4...' in self.logger_output_string
         assert 'Description:' not in self.logger_output_string
         assert "Existing services:\n['test_s']" in self.logger_output_string
 
@@ -52,6 +56,8 @@ class TestServiceTemplatesShow(TestCliBase):
             expected_exception=storage_exceptions.NotFoundError,
             expected_msg='Requested `ServiceTemplate` with ID `5` was not found')
 
+        assert 'Showing service template 5...' in self.logger_output_string
+
 
 class TestServiceTemplatesList(TestCliBase):
 
@@ -59,6 +65,8 @@ class TestServiceTemplatesList(TestCliBase):
 
         monkeypatch.setattr(Environment, 'model_storage', mock_storage)
         self.invoke('service_templates list')
+
+        assert 'Listing all service templates...' in self.logger_output_string
         assert 'test_st' in self.logger_output_string
         assert 'test_st2' in self.logger_output_string
 
@@ -67,18 +75,21 @@ class TestServiceTemplatesList(TestCliBase):
         monkeypatch.setattr(Environment, 'model_storage', mock_object)
         self.invoke('service_templates list --sort-by name')
         mock_object.service_template.list.assert_called_with(sort={'name': 'asc'})
+        assert 'Listing all service templates...' in self.logger_output_string
 
     def test_list_descending(self, monkeypatch, mock_object):
 
         monkeypatch.setattr(Environment, 'model_storage', mock_object)
         self.invoke('service_templates list --sort-by name --descending')
         mock_object.service_template.list.assert_called_with(sort={'name': 'desc'})
+        assert 'Listing all service templates...' in self.logger_output_string
 
     def test_list_default_sorting(self, monkeypatch, mock_object):
 
         monkeypatch.setattr(Environment, 'model_storage', mock_object)
         self.invoke('service_templates list')
         mock_object.service_template.list.assert_called_with(sort={'created_at': 'asc'})
+        assert 'Listing all service templates...' in self.logger_output_string
 
 
 class TestServiceTemplatesStore(TestCliBase):
@@ -88,6 +99,7 @@ class TestServiceTemplatesStore(TestCliBase):
         monkeypatch.setattr(Core, 'create_service_template', mock_object)
         monkeypatch.setattr(service_template_utils, 'get', mock_object)
         self.invoke('service_templates store stubpath test_st')
+        assert 'Storing service template test_st...' in self.logger_output_string
         assert 'Service template test_st stored' in self.logger_output_string
 
     def test_store_raises_exception_resulting_from_name_uniqueness(self, monkeypatch, mock_object):
@@ -103,6 +115,7 @@ class TestServiceTemplatesStore(TestCliBase):
             expected_exception=AriaCliError,
             expected_msg='Could not store service template `test_st`\n'
                          'There already a exists a service template with the same name')
+        assert 'Storing service template test_st...' in self.logger_output_string
 
     def test_store_raises_exception(self, monkeypatch, mock_object):
 
@@ -114,6 +127,7 @@ class TestServiceTemplatesStore(TestCliBase):
         assert_exception_raised(
             self.invoke('service_templates store stubpath test_st'),
             expected_exception=AriaCliError)
+        assert 'Storing service template test_st...' in self.logger_output_string
 
 
 class TestServiceTemplatesDelete(TestCliBase):
@@ -123,6 +137,7 @@ class TestServiceTemplatesDelete(TestCliBase):
         monkeypatch.setattr(Environment, 'model_storage', mock_object)
         monkeypatch.setattr(Core, 'delete_service_template', mock_object)
         self.invoke('service_templates delete test_st')
+        assert 'Deleting service template test_st...' in self.logger_output_string
         assert 'Service template test_st deleted' in self.logger_output_string
 
     def test_delete_raises_exception(self, monkeypatch, mock_object):
@@ -136,6 +151,7 @@ class TestServiceTemplatesDelete(TestCliBase):
             self.invoke('service_templates delete test_st'),
             expected_exception=AriaCliError,
             expected_msg='')
+        assert 'Deleting service template test_st...' in self.logger_output_string
 
 
 class TestServiceTemplatesInputs(TestCliBase):
@@ -143,11 +159,13 @@ class TestServiceTemplatesInputs(TestCliBase):
     def test_inputs_existing_inputs(self, monkeypatch, mock_storage):
         monkeypatch.setattr(Environment, 'model_storage', mock_storage)
         self.invoke('service_templates inputs with_inputs')
+        assert 'Showing inputs for service template with_inputs...' in self.logger_output_string
         assert 'input1' in self.logger_output_string and 'value1' in self.logger_output_string
 
     def test_inputs_no_inputs(self, monkeypatch, mock_storage):
         monkeypatch.setattr(Environment, 'model_storage', mock_storage)
         self.invoke('service_templates inputs without_inputs')
+        assert 'Showing inputs for service template without_inputs...' in self.logger_output_string
         assert 'No inputs' in self.logger_output_string
 
 
@@ -157,6 +175,7 @@ class TestServiceTemplatesValidate(TestCliBase):
         monkeypatch.setattr(Core, 'validate_service_template', mock_object)
         monkeypatch.setattr(service_template_utils, 'get', mock_object)
         self.invoke('service_templates validate stubpath')
+        assert 'Validating service template: stubpath' in self.logger_output_string
         assert 'Service template validated successfully' in self.logger_output_string
 
     def test_validate_raises_exception(self, monkeypatch, mock_object):
@@ -165,6 +184,7 @@ class TestServiceTemplatesValidate(TestCliBase):
         assert_exception_raised(
             self.invoke('service_templates validate stubpath'),
             expected_exception=AriaCliError)
+        assert 'Validating service template: stubpath' in self.logger_output_string
 
 
 class TestServiceTemplatesCreateArchive(TestCliBase):
@@ -172,4 +192,5 @@ class TestServiceTemplatesCreateArchive(TestCliBase):
     def test_create_archive_successful(self, monkeypatch, mock_object):
         monkeypatch.setattr(csar, 'write', mock_object)
         self.invoke('service_templates create_archive stubpath stubdest')
+        assert 'Creating a csar archive' in self.logger_output_string
         assert 'Csar archive created at stubdest' in self.logger_output_string


Mime
View raw message