Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
169 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
7.0.7 | ||
7.0.9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ Contents | |
merged-cms | ||
template-tags | ||
template-patterns | ||
testing | ||
plugins | ||
release-notes | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
Writing Test Cases | ||
~~~~~~~~~~~~~~~~~~ | ||
|
||
Use Molo test mixin `molo.core.tests.base.MoloTestCaseMixin` | ||
|
||
The Molo test mixin contains helper methods to generate test content necessary for the main sight. | ||
|
||
:: | ||
|
||
class MyTest(MoloTestCaseMixin, TestCase): | ||
|
||
def setUp(self): | ||
self.mk_main() | ||
main = Main.objects.all().first() | ||
lang = Languages.for_site(main.get_site() | ||
self.english = SiteLanguageRelation.objects.create( | ||
language_setting=lang), locale='en', is_active=True) | ||
|
||
self.user = User.objects.create_user( | ||
'test', 'test@example.org', 'test') | ||
|
||
self.client = Client() | ||
... | ||
|
||
def test_register_auto_login(self): | ||
# Not logged in, redirects to login page | ||
login_url = reverse('molo.profiles:edit_my_profile') | ||
expected_url = '/login/?next=/profiles/edit/myprofile/' | ||
|
||
response = self.client.get(login_url) | ||
self.assertEqual(response.status_code, 302) | ||
self.assertEqual(response['Location'], expected_url) | ||
|
||
|
||
`MoloTestCaseMixin` methods | ||
|
||
* login() | ||
|
||
Creates a superuser and logs in | ||
username='superuser', email='superuser@email.com', password='pass' | ||
|
||
* mk_root() | ||
|
||
Creates a root page accessible on the application application root url | ||
|
||
* mk_main(title='Main', slug='main'), mk_main2(title='main2', slug='main2', path='4098') | ||
|
||
Create the main page of your molo test site | ||
|
||
* mk_tag(parent, slug=None, \**kwargs), mk_tags(parent, count=2, \**kwargs) | ||
|
||
Attach/add tag to parent page | ||
|
||
* mk_reaction_question(parent, article, \**kwargs) | ||
|
||
Create test reaction question for an article | ||
|
||
* mk_sections(parent, count=2, \**kwargs), mk_section(parent \**kwargs) | ||
|
||
Create test section(s) page content in parent page | ||
|
||
* mk_articles(parent, count=2, \**kwargs), mk_article(parent, \**kwargs) | ||
|
||
Create test article(s) page content in parent page | ||
|
||
* mk_banners(parent, count=2, \**kwargs), mk_banner(parent, \**kwargs) | ||
|
||
Create test banner(s) page content in parent page | ||
|
||
* mk_translation(source, language, translation) | ||
mk_section_translation(source, language, \**kwargs) | ||
mk_article_translation(source, language, \**kwargs) | ||
mk_tag_translation(source, language, \**kwargs) | ||
mk_reaction_translation(source, language, \**kwargs) | ||
|
||
Create a translated version of the source (Page) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters