コード例 #1
0
ファイル: test_environments.py プロジェクト: ioesandeep/rally
    def test_create_and_deploy_environment(self, mock__deploy_environment,
                                           mock__create_service,
                                           mock__create_session,
                                           mock__create_environment):

        fake_environment = mock.MagicMock(id="fake_env_id")
        mock__create_environment.return_value = fake_environment

        fake_session = mock.Mock(id="fake_session_id")
        mock__create_session.return_value = fake_session

        scenario = environments.MuranoEnvironments(self.context)
        scenario.context = self._get_context()
        scenario.context["tenants"] = {
            "fake_tenant_id": {
                "packages": [mock.MagicMock()]
            }
        }

        scenario.create_and_deploy_environment(1)

        mock__create_environment.assert_called_once_with()
        mock__create_session.assert_called_once_with(fake_environment.id)
        mock__create_service.assert_called_once_with(fake_environment,
                                                     fake_session,
                                                     "fake",
                                                     atomic_action=False)
        mock__deploy_environment.assert_called_once_with(
            fake_environment, fake_session)
        self._test_atomic_action_timer(scenario.atomic_actions(),
                                       "murano.create_services")
コード例 #2
0
 def test_create_and_delete_environment(
         self, mock_generate_random_name, mock__create_environment,
         mock__delete_environment, mock__create_session):
     scenario = environments.MuranoEnvironments(self.context)
     fake_environment = mock.Mock(id="fake_id")
     mock__create_environment.return_value = fake_environment
     mock_generate_random_name.return_value = "foo"
     scenario.create_and_delete_environment()
     mock__create_environment.assert_called_once_with()
     mock__create_session.assert_called_once_with(fake_environment.id)
     mock__delete_environment.assert_called_once_with(fake_environment)
コード例 #3
0
ファイル: test_environments.py プロジェクト: ioesandeep/rally
 def test_list_environments(self, mock__list_environments):
     scenario = environments.MuranoEnvironments(self.context)
     scenario._list_environments()
     mock__list_environments.assert_called_once_with()