glare.tests package¶
Subpackages¶
- glare.tests.functional package
- Submodules
- glare.tests.functional.base module
- glare.tests.functional.test_all module
- glare.tests.functional.test_database_store module
- glare.tests.functional.test_quotas module
- glare.tests.functional.test_sample_artifact module
- glare.tests.functional.test_schemas module
- glare.tests.functional.test_scrubber module
- glare.tests.functional.test_visibility module
- Module contents
- glare.tests.unit package
- Subpackages
- glare.tests.unit.api package
- Submodules
- glare.tests.unit.api.test_create module
- glare.tests.unit.api.test_delete module
- glare.tests.unit.api.test_delete_blobs module
- glare.tests.unit.api.test_download module
- glare.tests.unit.api.test_list module
- glare.tests.unit.api.test_locations module
- glare.tests.unit.api.test_show module
- glare.tests.unit.api.test_update module
- glare.tests.unit.api.test_upload module
- Module contents
- glare.tests.unit.db package
- glare.tests.unit.middleware package
- glare.tests.unit.api package
- Submodules
- glare.tests.unit.base module
- glare.tests.unit.glare_fixtures module
- glare.tests.unit.test_fixtures module
- glare.tests.unit.test_hacking module
- glare.tests.unit.test_multistore module
- glare.tests.unit.test_policies module
- glare.tests.unit.test_quotas module
- glare.tests.unit.test_store_api module
- glare.tests.unit.test_unpacking module
- glare.tests.unit.test_utils module
- glare.tests.unit.test_validation_hooks module
- glare.tests.unit.test_validators module
- glare.tests.unit.test_versions module
- glare.tests.unit.test_wsgi module
- Module contents
- Subpackages
Submodules¶
glare.tests.hooks_artifact module¶
-
class
glare.tests.hooks_artifact.
HookChecker
(context=None, **kwargs)[source]¶ Bases:
glare.objects.base.BaseArtifact
-
artifact_type_opts
= [<oslo_config.cfg.StrOpt object>]¶
-
fields
= {'blob': BlobFieldType(default=None,nullable=True), 'temp_dir': String(default=None,nullable=True), 'temp_file_path_activate': String(default=None,nullable=True), 'temp_file_path_create': String(default=None,nullable=True), 'temp_file_path_deactivate': String(default=None,nullable=True), 'temp_file_path_publish': String(default=None,nullable=True), 'temp_file_path_reactivate': String(default=None,nullable=True), 'temp_file_path_update': String(default=None,nullable=True)}¶
-
classmethod
get_display_type_name
()[source]¶ Provides verbose Artifact type name which any external user can understand easily.
Returns: general purpose name for Artifact
-
glare.tests.non_nullable_fields_artifact module¶
-
class
glare.tests.non_nullable_fields_artifact.
NonNullableFieldsArtifact
(context=None, **kwargs)[source]¶ Bases:
glare.objects.base.BaseArtifact
For testing purposes: check the case of creating artifact that has nullable=false field without any default
-
fields
= {'int_not_nullable_with_default': Integer(default=0,nullable=False), 'int_not_nullable_without_default': Integer(default=None,nullable=False)}¶
-
classmethod
format_all
(values)[source]¶ Specify output format for ‘all’ artifact meta-type
Parameters: values – dict with values that need to be formatted
-
classmethod
get_display_type_name
()[source]¶ Provides verbose Artifact type name which any external user can understand easily.
Returns: general purpose name for Artifact
-
glare.tests.sample_artifact module¶
Sample artifact object for testing purposes
-
class
glare.tests.sample_artifact.
SampleArtifact
(context=None, **kwargs)[source]¶ Bases:
glare.objects.base.BaseArtifact
-
VERSION
= '1.0'¶
-
fields
= {'blob': BlobFieldType(default=None,nullable=True), 'bool1': FlexibleBoolean(default=False,nullable=True), 'bool2': FlexibleBoolean(default=False,nullable=True), 'dict_of_blobs': Dict(default={},nullable=True), 'dict_of_int': Dict(default={},nullable=True), 'dict_of_links': Dict(default={},nullable=True), 'dict_of_str': Dict(default={},nullable=True), 'dict_validators': Dict(default=None,nullable=True), 'float1': Float(default=None,nullable=True), 'float2': Float(default=None,nullable=True), 'int1': Integer(default=None,nullable=True), 'int2': Integer(default=None,nullable=True), 'int_validators': Integer(default=None,nullable=True), 'link1': LinkFieldType(default=None,nullable=True), 'link2': LinkFieldType(default=None,nullable=True), 'list_of_int': List(default=[],nullable=True), 'list_of_links': List(default=[],nullable=True), 'list_of_str': List(default=[],nullable=True), 'list_validators': List(default=[],nullable=True), 'metadata_attribute': String(default=default,nullable=True), 'small_blob': BlobFieldType(default=None,nullable=True), 'str1': String(default=None,nullable=True), 'string_mutable': String(default=None,nullable=True), 'string_regex': String(default=None,nullable=True), 'string_required': String(default=None,nullable=True), 'string_validators': String(default=None,nullable=True), 'system_attribute': String(default=default,nullable=True)}¶
-
classmethod
format_all
(values)[source]¶ Specify output format for ‘all’ artifact meta-type
Parameters: values – dict with values that need to be formatted
-
classmethod
get_display_type_name
()[source]¶ Provides verbose Artifact type name which any external user can understand easily.
Returns: general purpose name for Artifact
-
glare.tests.unpacking_artifact module¶
-
class
glare.tests.unpacking_artifact.
Unpacker
(context=None, **kwargs)[source]¶ Bases:
glare.objects.base.BaseArtifact
-
MAX_BLOB_SIZE
= 100000¶
-
fields
= {'content': Dict(default={},nullable=True), 'zip': BlobFieldType(default=None,nullable=True)}¶
-
classmethod
get_display_type_name
()[source]¶ Provides verbose Artifact type name which any external user can understand easily.
Returns: general purpose name for Artifact
-
glare.tests.utils module¶
Common utilities used in testing
-
class
glare.tests.utils.
BaseTestCase
(*args, **kwargs)[source]¶ Bases:
testtools.testcase.TestCase
-
config
(**kw)[source]¶ Override some configuration values.
The keyword arguments are the names of configuration options to override and their values. If a group argument is supplied, the overrides are applied to the specified configuration option group. All overrides are automatically cleared at the end of the current test by the fixtures cleanup process.
-
-
class
glare.tests.utils.
FakeHTTPResponse
(status=200, headers=None, data=None, *args, **kwargs)[source]¶ Bases:
object
-
class
glare.tests.utils.
depends_on_exe
(exe)[source]¶ Bases:
object
Decorator to skip test if an executable is unavailable
-
glare.tests.utils.
execute
(cmd, raise_error=True, no_venv=False, exec_env=None, expect_exit=True, expected_exitcode=0, context=None)[source]¶ Executes a command in a subprocess.
Returns a tuple of (exitcode, out, err), where out is the string output from stdout and err is the string output from stderr when executing the command.
Parameters: - cmd – Command string to execute
- raise_error – If returncode is not 0 (success), then raise a RuntimeError? Default: True)
- no_venv – Disable the virtual environment
- exec_env – Optional dictionary of additional environment variables; values may be callables, which will be passed the current value of the named environment variable
- expect_exit – Optional flag true iff timely exit is expected
- expected_exitcode – expected exitcode from the launcher
- context – additional context for error message
-
glare.tests.utils.
find_executable
(cmdname)[source]¶ Searches the path for a given cmdname.
Returns an absolute filename if an executable with the given name exists in the path, or None if one does not.
Parameters: cmdname – The bare name of the executable to search for
-
glare.tests.utils.
fork_exec
(cmd, exec_env=None, logfile=None, pass_fds=None)[source]¶ Execute a command using fork/exec.
This is needed for programs system executions that need path searching but cannot have a shell as their parent process, for example: glare. When glare starts it sets itself as the parent process for its own process group. Thus the pid that a Popen process would have is not the right pid to use for killing the process group. This patch gives the test env direct access to the actual pid.
Parameters: - cmd – Command to execute as an array of arguments.
- exec_env – A dictionary representing the environment with which to run the command.
- logfile – A path to a file which will hold the stdout/err of the child process.
- pass_fds – Sequence of file descriptors passed to the child.
-
glare.tests.utils.
get_unused_port_and_socket
()[source]¶ Returns an unused port on localhost and the open socket from which it was created.
-
class
glare.tests.utils.
requires
(setup=None, teardown=None)[source]¶ Bases:
object
Decorator that initiates additional test setup/teardown.
-
glare.tests.utils.
skip_if_disabled
(func)[source]¶ Decorator that skips a test if test case is disabled.