Files
sceptre/tests/test_context.py
Niall Grant 66dabd732d [Resolves #522] Add ignore-dependencies flag
Adding a `--ignore-dependencies` flag so that Sceptre will only execute
a command on the given Stack or StackGroup and ignore all other
dependant Stacks. Useful when wanting to operate on a single Stack, for
example, when creating a Change Set.

Reverts `ConfigReader().construct_stack()` to a previous implementation
(182f0b64f1) to handle case where root is
the stack file and changes root to the command path so that full project
is not loaded upfront.
2018-11-30 15:31:29 +00:00

69 lines
2.6 KiB
Python

from os import path
from mock import sentinel
from sceptre.context import SceptreContext
class TestSceptreContext(object):
def setup_method(self, test_method):
self.templates_path = "templates"
self.config_path = "config"
self.config_file = "config.yaml"
def test_context_with_path(self):
self.context = SceptreContext(
project_path="project_path/to/sceptre",
command_path=sentinel.command_path,
user_variables=sentinel.user_variables,
options=sentinel.options,
output_format=sentinel.output_format,
no_colour=sentinel.no_colour,
ignore_dependencies=sentinel.ignore_dependencies
)
sentinel.project_path = "project_path/to/sceptre"
assert self.context.project_path == sentinel.project_path
def test_full_config_path_returns_correct_path(self):
context = SceptreContext(
project_path="project_path",
command_path=sentinel.command_path,
user_variables=sentinel.user_variables,
options=sentinel.options,
output_format=sentinel.output_format,
no_colour=sentinel.no_colour,
ignore_dependencies=sentinel.ignore_dependencies
)
full_config_path = path.join("project_path", self.config_path)
assert context.full_config_path() == full_config_path
def test_full_command_path_returns_correct_path(self):
context = SceptreContext(
project_path="project_path",
command_path="command",
user_variables=sentinel.user_variables,
options=sentinel.options,
output_format=sentinel.output_format,
no_colour=sentinel.no_colour,
ignore_dependencies=sentinel.ignore_dependencies
)
full_command_path = path.join("project_path",
self.config_path,
"command")
assert context.full_command_path() == full_command_path
def test_full_templates_path_returns_correct_path(self):
context = SceptreContext(
project_path="project_path",
command_path="command",
user_variables=sentinel.user_variables,
options=sentinel.options,
output_format=sentinel.output_format,
no_colour=sentinel.no_colour,
ignore_dependencies=sentinel.ignore_dependencies
)
full_templates_path = path.join("project_path", self.templates_path)
assert context.full_templates_path() == full_templates_path