Testing utilities for Django CMS
Project description
DjangoCMS Testing
A set of utils to simplify testing on Django CMS plugins and pages
Usage
Testing all plugins
import os
from .base import BaseTestCase
from filer.models import Image
from djangocms_testing.integrity import CMSPluginIntegrity
class DSMPluginIntegrityTestCase(BaseTestCase, CMSPluginIntegrity):
plugin_exclude_list = [
'SomePluginsToExclude',
'AnotherPluginToExclude',
]
def setUp(self):
self.homepage = self.create_page('Homepage')
# Create any data that may be necessary for the plugins
# Example: Creating an image
photo_path = os.path.join(os.path.dirname(__file__), 'files', 'sample_image.jpg')
self.test_image = Image.objects.create(file=photo_path)
# Update the plugin list
self.plugin_list = [
('CategoryPlugin', {'title': 'Top Category'}),
('BannerPlugin', {'icon': self.test_image, 'link': self.homepage}),
('LinkToPagePlugin', {'page': self.homepage}),
]
Loading Pages
There's a management command that allows you to create pages from a YAML description.
The page description looks like this:
---
# Required page data
title: Regression Test Page
slug: regression-test-page
template: generic_page # (generic_page is provided. You can use other templates by overriding _get_template)
# Optional page data # Default value
publish: no # no (yes | no)
language: en # en (en | es)
apphook: null # null (string)
apphook_namespace: null # null (string)
soft_root: no # no (yes | no)
# Placeholder variables
#
# Provided:
# $loremispum 1 paragraph of lorem ipsum text.
#
# You can add other variables by overriding _generate_sample_data
# $image JPEG image
# $svg SVG Tiger iimage
# Placeholders vary per template but its no problem to define them all
# in advance, and later just switch the template type:
#
# generic_page > content
placeholders:
content:
- CategoryPlugin:
title: Category 1
subplugins:
- QuestionPlugin:
question: >
This is a question
author: Author, 21
subplugins:
- AnswerPlugin:
body: >
This is the text's body
Create the page: manage.py page simple_test.yaml
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
djangocms_testing-0.1.tar.gz
(5.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file djangocms_testing-0.1.tar.gz.
File metadata
- Download URL: djangocms_testing-0.1.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/2.7.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1cc731d0d764a4a62ee64ab2e1e428889feee0c482989e09b84ac7447b77c364
|
|
| MD5 |
4d5dedf41f5f0e0a74616bb1c74d1de2
|
|
| BLAKE2b-256 |
674366be0611855042bcb018477296c64cc1eb6fb324c49401961abc95ef7b69
|
File details
Details for the file djangocms_testing-0.1-py2-none-any.whl.
File metadata
- Download URL: djangocms_testing-0.1-py2-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/2.7.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e811090997ef4f84b06584c61a94112f5e8c1e15fe4dae0a27c46872cc2e45d7
|
|
| MD5 |
38d94cc3d725fc5d067d9a42cf96658d
|
|
| BLAKE2b-256 |
0ac3208c5735700cfed777fb6ae3061e6ae77c3c9254c0423c0438da1dceb69e
|