Beispiel #1
0
    def test_get_plugin_pk_view(self):
        self.client.login(username='******', password='******')

        # Try to edit an existing plugin of the page
        arg = '%s%d' % (settings.HTML_ID_PLUGIN, 3)
        url = test_reverse('wa-plugin', args=[arg])
        response = self.client.get(url)
        self.assertContains(response, 'html')

        # Try to edit an existing plugin of another page
        arg = '%s%d' % (settings.HTML_ID_PLUGIN, 16)
        url = test_reverse('wa-plugin', args=[arg])
        response = self.client.get(url)
        self.assertContains(response, 'html')

        # Try to edit a non existing plugin
        arg = '%s%d' % (settings.HTML_ID_PLUGIN, 9999)
        url = test_reverse('wa-plugin', args=[arg])
        response = self.client.get(url)
        self.assertEqual(response.status_code, 404)

        # Try to edit another website plugin
        arg = '%s%d' % (settings.HTML_ID_PLUGIN, 487)
        url = test_reverse('wa-plugin', args=[arg])
        response = self.client.get(url)
        self.assertEqual(response.status_code, 404)
Beispiel #2
0
    def test_post_plugin_view(self):
        self.client.login(username='******', password='******')

        # OK - Try to edit an existing plugin of the page
        arg = '%s%d' % (settings.HTML_ID_PLUGIN, 3)
        url = test_reverse('wa-plugin', args=[arg])
        response = self.client.post(url, {'text': '<p>Another value</p>'})
        self.assertContains(response, 'html')
        self.assertContains(response, 'msg')

        # OK - Try to edit an existing plugin of another page
        arg = '%s%d' % (settings.HTML_ID_PLUGIN, 16)
        url = test_reverse('wa-plugin', args=[arg])
        response = self.client.post(url, {'text': '<p>Another value</p>'})
        self.assertContains(response, 'html')
        self.assertContains(response, 'msg')

        # 404 - Try to edit a non existing plugin
        arg = '%s%d' % (settings.HTML_ID_PLUGIN, 9999)
        url = test_reverse('wa-plugin', args=[arg])
        response = self.client.post(url, {'text': '<p>Another value</p>'})
        self.assertEqual(response.status_code, 404)

        # 404 - Try to edit another website plugin
        arg = '%s%d' % (settings.HTML_ID_PLUGIN, 487)
        url = test_reverse('wa-plugin', args=[arg])
        response = self.client.post(url, {'text': '<p>Another value</p>'})
        self.assertEqual(response.status_code, 404)

        # 400 - Empty form
        arg = '%s%d' % (settings.HTML_ID_PLUGIN, 3)
        url = test_reverse('wa-plugin', args=[arg])
        response = self.client.post(url, {})
        self.assertContains(response, 'plugin_form_form', status_code=400)
Beispiel #3
0
    def test_youtube_video(self):
        url = test_reverse('wa-plugin')
        self.client.login(username='******', password='******')

        # Create the youtube video
        content_placeholder_1 = '%s1' % settings.HTML_ID_PLACEHOLDER_CONTENT
        plugin_id = ContentType.objects.get(app_label="plugin_video",
                                            model="plugin_video").id

        response = self.client.put(
            url, {
                'placeholder_id': content_placeholder_1,
                'plugin_type': plugin_id,
                'url': 'http://www.youtube.com/watch?v=n7vYo6l06lo'
            })
        self.assertContains(response, 'msg')

        # Display the youtube video
        self.client.logout()
        url = '/'

        response = self.client.get(url)
        self.assertContains(response, 'n7vYo6l06lo')

        # Shorten URL
        url = test_reverse('wa-plugin')
        self.client.login(username='******', password='******')
        response = self.client.put(
            url, {
                'placeholder_id': content_placeholder_1,
                'plugin_type': plugin_id,
                'url': 'http://youtu.be/n7vYo6l06lo'
            })
        self.assertContains(response, 'msg')
Beispiel #4
0
    def test_youtube_video(self):
        url = test_reverse('wa-plugin')
        self.client.login(username='******', password='******')
        
        # Create the youtube video
        content_placeholder_1 = '%s1' % settings.HTML_ID_PLACEHOLDER_CONTENT
        plugin_id = ContentType.objects.get(
            app_label="plugin_video", model="plugin_video").id

        response = self.client.put(url, {'placeholder_id': content_placeholder_1,
                                         'plugin_type': plugin_id,
                                         'url': 'http://www.youtube.com/watch?v=n7vYo6l06lo'})
        self.assertContains(response, 'msg')

        # Display the youtube video
        self.client.logout()
        url = '/'

        response = self.client.get(url)
        self.assertContains(response, 'n7vYo6l06lo')

        # Shorten URL
        url = test_reverse('wa-plugin')
        self.client.login(username='******', password='******')
        response = self.client.put(url, {'placeholder_id': content_placeholder_1,
                                         'plugin_type': plugin_id,
                                         'url': 'http://youtu.be/n7vYo6l06lo'})
        self.assertContains(response, 'msg')
Beispiel #5
0
    def test_dailymotion_video(self):
        url = test_reverse('wa-plugin')
        self.client.login(username='******', password='******')
        
        # Create the dailymotion video
        content_placeholder_1 = '%s1' % settings.HTML_ID_PLACEHOLDER_CONTENT
        plugin_id = ContentType.objects.get(
            app_label="plugin_video", model="plugin_video").id

        response = self.client.put(url, {'placeholder_id': content_placeholder_1,
                                         'plugin_type': plugin_id,
                                         'url': 'http://www.dailymotion.com/video/xogb25_il-s-evanouit-quand-on-le-chatouille_news'})
        self.assertContains(response, 'msg')

        # Display the dailymotion video
        self.client.logout()
        url = '/'

        response = self.client.get(url)
        self.assertContains(response, 'xogb25')

        # Shorten URL
        url = test_reverse('wa-plugin')
        self.client.login(username='******', password='******')
        response = self.client.put(url, {'placeholder_id': content_placeholder_1,
                                         'plugin_type': plugin_id,
                                         'url': 'http://dai.ly/zIc0si'})
        self.assertContains(response, 'msg')
Beispiel #6
0
    def test_delete_plugin_view(self):
        self.client.login(username='******', password='******')

        # OK - Try to edit an existing plugin of the page
        arg = '%s%d' % (settings.HTML_ID_PLUGIN, 3)
        url = test_reverse('wa-plugin', args=[arg])
        response = self.client.delete(url)
        self.assertContains(response, 'msg')

        # OK - Try to edit an existing plugin of another page
        arg = '%s%d' % (settings.HTML_ID_PLUGIN, 16)
        url = test_reverse('wa-plugin', args=[arg])
        response = self.client.delete(url)
        self.assertContains(response, 'msg')

        # 404 - Try to edit a non existing plugin
        arg = '%s%d' % (settings.HTML_ID_PLUGIN, 9999)
        url = test_reverse('wa-plugin', args=[arg])
        response = self.client.delete(url)
        self.assertEqual(response.status_code, 404)

        # 404 - Try to edit another website plugin
        arg = '%s%d' % (settings.HTML_ID_PLUGIN, 487)
        url = test_reverse('wa-plugin', args=[arg])
        response = self.client.delete(url)
        self.assertEqual(response.status_code, 404)
Beispiel #7
0
    def test_get_page_view(self):
        url = test_reverse('wa-page')

        # If deconnected, shouldn't work
        self.client.logout()
        response = self.client.get(url)
        self.assertEqual(response.status_code, 403)

        self.client.login(username='******', password='******')

        # GET - new page form
        response = self.client.get(url)
        self.assertEqual(response.status_code, 200)

        # GET - Add a child
        response = self.client.get(url, {'parent': 1})
        self.assertContains(response, '<input type=\\"hidden\\" name=\\"parent\\" value=\\"1\\"')

        # GET - edit form
        url = test_reverse('wa-page', args=[1])
        response = self.client.get(url)
        self.assertContains(response, '<input id=\\"id_title\\" type=\\"text\\" name=\\"title\\" value=\\"Home\\" maxlength=\\"255\\" />')
        # Homepage doesn't show slug field
        self.assertContains(response, '<input type=\\"hidden\\" name=\\"slug\\" id=\\"id_slug\\">')
        # Other form page displays the slug field
        url = test_reverse('wa-page', args=[2])
        response = self.client.get(url)
        self.assertContains(response, '<input type=\\"text\\" name=\\"slug\\" value=\\"section_1\\"')
Beispiel #8
0
    def test_post_plugin_view(self):
        self.client.login(username='******', password='******')

        # OK - Try to edit an existing plugin of the page
        arg = '%s%d' % (settings.HTML_ID_PLUGIN, 3)
        url = test_reverse('wa-plugin', args=[arg])
        response = self.client.post(url, {'text': '<p>Another value</p>'})
        self.assertContains(response, 'html')
        self.assertContains(response, 'msg')

        # OK - Try to edit an existing plugin of another page
        arg = '%s%d' % (settings.HTML_ID_PLUGIN, 16)
        url = test_reverse('wa-plugin', args=[arg])
        response = self.client.post(url, {'text': '<p>Another value</p>'})
        self.assertContains(response, 'html')
        self.assertContains(response, 'msg')

        # 404 - Try to edit a non existing plugin
        arg = '%s%d' % (settings.HTML_ID_PLUGIN, 9999)
        url = test_reverse('wa-plugin', args=[arg])
        response = self.client.post(url, {'text': '<p>Another value</p>'})
        self.assertEqual(response.status_code, 404)

        # 404 - Try to edit another website plugin
        arg = '%s%d' % (settings.HTML_ID_PLUGIN, 487)
        url = test_reverse('wa-plugin', args=[arg])
        response = self.client.post(url, {'text': '<p>Another value</p>'})
        self.assertEqual(response.status_code, 404)

        # 400 - Empty form
        arg = '%s%d' % (settings.HTML_ID_PLUGIN, 3)
        url = test_reverse('wa-plugin', args=[arg])
        response = self.client.post(url, {})
        self.assertContains(response, 'plugin_form_form', status_code = 400)
Beispiel #9
0
    def test_dispatcher_view(self):
        "Test the access point actions in API - Dispatcher Views"

        valid_html_id_plugin = "%s%d" % (settings.HTML_ID_PLUGIN, 1)
        valid_html_id_app = "%s%d" % (settings.HTML_ID_APP, 1)
        valid_url_action = "item_list"

        url = test_reverse("wa-actions", args=[valid_html_id_plugin, valid_url_action])

        # If deconnected, shouldn't work
        self.client.logout()
        response = self.client.get(url)
        self.assertEqual(response.status_code, 403)
        response = self.client.put(url)
        self.assertEqual(response.status_code, 403)
        response = self.client.post(url)
        self.assertEqual(response.status_code, 403)
        response = self.client.delete(url)
        self.assertEqual(response.status_code, 403)

        # Connection of client
        self.client.login(username="******", password="******")

        # Call with bad number of parameters
        self.assertRaises(NoReverseMatch, test_reverse, "wa-actions")
        self.assertRaises(NoReverseMatch, test_reverse, "wa-actions", args=[valid_html_id_plugin])
        self.assertRaises(NoReverseMatch, test_reverse, "wa-actions", args=[valid_url_action])

        # Call with wrong object_slug
        # Wrong prefix
        wrong_html_id_plugin = "wrong-slug-1"
        url = test_reverse("wa-actions", args=[wrong_html_id_plugin, valid_url_action])
        response = self.client.get(url)
        self.assertContains(response, "msg", status_code=400)
        response = self.client.put(url)
        self.assertContains(response, "msg", status_code=400)
        response = self.client.post(url)
        self.assertContains(response, "msg", status_code=400)
        response = self.client.delete(url)
        self.assertContains(response, "msg", status_code=400)

        # Plugin Relation Object doesn't exist
        html_id_plugin = "%s%d" % (settings.HTML_ID_PLUGIN, 10000)
        url = test_reverse("wa-actions", args=[html_id_plugin, valid_url_action])
        response = self.client.get(url)
        self.assertContains(response, "msg", status_code=404)
        response = self.client.put(url)
        self.assertContains(response, "msg", status_code=404)
        response = self.client.post(url)
        self.assertContains(response, "msg", status_code=404)
        response = self.client.delete(url)
        self.assertContains(response, "msg", status_code=404)

        # App Object doesn't exist
        html_id_app = "%s%d" % (settings.HTML_ID_APP, 100000)
        url = test_reverse("wa-actions", args=[html_id_app, valid_url_action])
        response = self.client.get(url)
        self.assertContains(response, "msg", status_code=404)
Beispiel #10
0
    def test_page_toggle_draft(self):
        self.client.login(username='******', password='******')
        url = test_reverse('wa-page', args=[10])
        response = self.client.post(url, {'draft': '', })
        self.assertEqual(response.status_code, 200)
        self.assertEqual(Page.objects.get(pk=10).draft, True)

        url = test_reverse('wa-page', args=[10])
        response = self.client.post(url, {'draft': '', })
        self.assertEqual(Page.objects.get(pk=10).draft, False)
Beispiel #11
0
    def test_domain_put_view(self):
        url = test_reverse('wa-domain')
        
        # If connected, should work
        self.client.login(username='******', password='******')

        # If the form is empty
        response = self.client.put(url)
        self.assertEqual(response.status_code, 400)
        self.assertEqual(response.context['edit'], False)

        # If the domain aready exists
        response = self.client.put(url, {'domain': 'testserver'})
        self.assertEqual(response.status_code, 400)

        # If it is a subdomain of a RESTRICTED_DOMAIN
        saved_restricted_domains = settings.RESTRICTED_DOMAINS
        settings.RESTRICTED_DOMAINS = ['bar.com']
        response = self.client.put(url, {'domain': 'foo.bar.com'})
        self.assertEqual(response.status_code, 400)

        # If everything is ok
        response = self.client.put(url, {'domain': 'foobar.com'})
        self.assertContains(response, 'msg')

        settings.RESTRICTED_DOMAINS = saved_restricted_domains
Beispiel #12
0
    def test_facebook_video(self):
        url = test_reverse('wa-plugin')
        self.client.login(username='******', password='******')

        # Create the facebook video
        content_placeholder_1 = '%s1' % settings.HTML_ID_PLACEHOLDER_CONTENT
        plugin_id = ContentType.objects.get(app_label="plugin_video",
                                            model="plugin_video").id

        response = self.client.put(
            url, {
                'placeholder_id': content_placeholder_1,
                'plugin_type': plugin_id,
                'url':
                'https://www.facebook.com/video/video.php?v=1498994573921'
            })
        self.assertContains(response, 'msg')

        response = self.client.put(
            url, {
                'placeholder_id': content_placeholder_1,
                'plugin_type': plugin_id,
                'url': 'https://www.facebook.com/photo.php?v=1498994573921'
            })
        self.assertContains(response, 'msg')

        # Display the facebook video
        self.client.logout()
        url = '/'

        response = self.client.get(url)
        self.assertContains(response, '1498994573921')
Beispiel #13
0
    def test_domain_put_view(self):
        url = test_reverse('wa-domain')

        # If connected, should work
        self.client.login(username='******', password='******')

        # If the form is empty
        response = self.client.put(url)
        self.assertEqual(response.status_code, 400)
        self.assertEqual(response.context['edit'], False)

        # If the domain aready exists
        response = self.client.put(url, {'domain': 'testserver'})
        self.assertEqual(response.status_code, 400)

        # If it is a subdomain of a RESTRICTED_DOMAIN
        saved_restricted_domains = settings.RESTRICTED_DOMAINS
        settings.RESTRICTED_DOMAINS = ['bar.com']
        response = self.client.put(url, {'domain': 'foo.bar.com'})
        self.assertEqual(response.status_code, 400)

        # If everything is ok
        response = self.client.put(url, {'domain': 'foobar.com'})
        self.assertContains(response, 'msg')

        settings.RESTRICTED_DOMAINS = saved_restricted_domains
Beispiel #14
0
    def test_layout_view(self):
        # Test the preview
        url = test_reverse("wa-layout")

        self.client.login(username="******", password="******")

        # No parameters
        response = self.client.get(url)
        self.assertEqual(response.status_code, 400)

        # Preview content
        response = self.client.get(url, {"layout_section_slug": settings.SLUG_CONTENT})
        self.assertContains(response, settings.SLUG_CONTENT)

        # Preview other layouts
        response = self.client.get(url, {"layout_section_slug": "foobar"})
        self.assertContains(response, "foobar")

        # No parameters
        response = self.client.post(url)
        self.assertEqual(response.status_code, 400)

        # Edit
        response = self.client.post(
            url, {"layout_section_slug": settings.SLUG_CONTENT, "layout_template_slug": "100_50_50_100"}
        )
        self.assertContains(response, "msg")
Beispiel #15
0
    def test_facebook_video(self):
        url = test_reverse('wa-plugin')
        self.client.login(username='******', password='******')
        
        # Create the facebook video
        content_placeholder_1 = '%s1' % settings.HTML_ID_PLACEHOLDER_CONTENT
        plugin_id = ContentType.objects.get(
            app_label="plugin_video", model="plugin_video").id

        response = self.client.put(url, {'placeholder_id': content_placeholder_1,
                                         'plugin_type': plugin_id,
                                         'url': 'https://www.facebook.com/video/video.php?v=1498994573921'})
        self.assertContains(response, 'msg')

        response = self.client.put(url, {'placeholder_id': content_placeholder_1,
                                         'plugin_type': plugin_id,
                                         'url': 'https://www.facebook.com/photo.php?v=1498994573921'})
        self.assertContains(response, 'msg')

        # Display the facebook video
        self.client.logout()
        url = '/'

        response = self.client.get(url)
        self.assertContains(response, '1498994573921')
Beispiel #16
0
    def test_layout_view(self):
        # Test the preview
        url = test_reverse('wa-layout')
        
        self.client.login(username='******', password='******')

        # No parameters
        response = self.client.get(url)
        self.assertEqual(response.status_code, 400)

        # Preview content
        response = self.client.get(url, {'layout_section_slug': settings.SLUG_CONTENT})
        self.assertContains(response, settings.SLUG_CONTENT)

        # Preview other layouts
        response = self.client.get(url, {'layout_section_slug': 'foobar'})
        self.assertContains(response, 'foobar')
        
        # No parameters
        response = self.client.post(url)
        self.assertEqual(response.status_code, 400)

        # Edit
        response = self.client.post(url, {'layout_section_slug': settings.SLUG_CONTENT, 
                                          'layout_template_slug': '100_50_50_100'})
        self.assertContains(response, 'msg')
Beispiel #17
0
    def test_delete_page_view(self):
        self.client.login(username='******', password='******')

        # Try to delete the home page (And failed)
        url = test_reverse('wa-page', args=[1])
        response = self.client.delete(url)
        self.assertEqual(response.status_code, 400)

        # When we delete the current page, redirect
        page_20 = Page.objects.get(pk=20).get_absolute_url()
        url = page_20[:-1] + test_reverse('wa-page', args=[20])
        response = self.client.delete(url)
        self.assertEqual(response.status_code, 202)
        
        # When trying to delete a normal page
        url = test_reverse('wa-page', args=[10])
        response = self.client.delete(url)
        self.assertEqual(response.status_code, 200)
Beispiel #18
0
    def test_get_plugin_view(self):
        url = test_reverse('wa-plugin')
        self.client.login(username='******', password='******')

        # Some fields are missing
        response = self.client.get(url)
        self.assertContains(response, 'msg', status_code=400)

        response = self.client.get(url, {'placeholder_id': ''})
        self.assertContains(response, 'msg', status_code=400)

        response = self.client.get(url, {'plugin_type': ''})
        self.assertContains(response, 'msg', status_code=400)

        # Fields are Ok
        content_placeholder_1 = '%s1' % settings.HTML_ID_PLACEHOLDER_CONTENT
        plugin_id = ContentType.objects.get(app_label="plugin_text",
                                            model="plugin_text").id

        # Everything ok - Should work
        response = self.client.get(url, {
            'placeholder_id': content_placeholder_1,
            'plugin_type': plugin_id
        })
        self.assertContains(response, 'plugin_form_form', status_code=200)

        # Wrong placeholder
        response = self.client.get(url, {
            'placeholder_id': 'foobar',
            'plugin_type': plugin_id
        })
        self.assertContains(response, 'msg', status_code=400)

        # Cannot add in placeholder_default
        response = self.client.get(
            url, {
                'placeholder_id': settings.HTML_ID_PLACEHOLDER_DEFAULT,
                'plugin_type': plugin_id
            })
        self.assertContains(response, 'msg', status_code=400)

        # Cannot add in placeholder clipboard
        response = self.client.get(
            url, {
                'placeholder_id': settings.HTML_ID_PLACEHOLDER_CLIPBOARD,
                'plugin_type': plugin_id
            })
        self.assertContains(response, 'msg', status_code=400)

        # Wrong plugin_id
        response = self.client.get(url, {
            'placeholder_id': content_placeholder_1,
            'plugin_type': 9999
        })
        self.assertContains(response, 'msg', status_code=400)
Beispiel #19
0
    def test_plugins_view(self):
        url = test_reverse('wa-plugins')

        # If deconnected, shouldn't work
        self.client.logout()
        response = self.client.get(url)
        self.assertEqual(response.status_code, 403)

        self.client.login(username='******', password='******')
        response = self.client.get(url)
        self.assertContains(response, 'plugins_listform')
Beispiel #20
0
    def test_plugins_view(self):
        url = test_reverse('wa-plugins')

        # If deconnected, shouldn't work
        self.client.logout()
        response = self.client.get(url)
        self.assertEqual(response.status_code, 403)

        self.client.login(username='******', password='******')
        response = self.client.get(url)
        self.assertContains(response, 'plugins_listform')
Beispiel #21
0
    def test_domain_post_view(self):
        url = test_reverse('wa-domain', args=[1])
        
        # If connected, should work
        self.client.login(username='******', password='******')

        # If the form is empty
        response = self.client.post(url)
        self.assertEqual(response.status_code, 400)

        # If the site doesn't exists
        url = test_reverse('wa-domain', args=[10])
        response = self.client.post(url, {'domain': 'mydomainname.com'})
        self.assertEqual(response.status_code, 404)

        # We create a new site
        put_url = test_reverse('wa-domain')
        response = self.client.put(put_url, {'domain': 'mydomainname.com'})
        self.assertContains(response, 'msg')

        pk = Site.objects.get(domain='mydomainname.com').pk
        # If the domain already exists shouldn't work
        url = test_reverse('wa-domain', args=[pk])
        response = self.client.post(url, {'domain': 'testserver'})
        self.assertEqual(response.status_code, 400)

        # If nothing changed
        url = test_reverse('wa-domain', args=[pk])
        response = self.client.post(url, {'domain': 'mydomainname.com'})
        self.assertEqual(response.status_code, 200)

        # If the change was ok
        url = test_reverse('wa-domain', args=[pk])
        response = self.client.post(url, {'domain': 'example.com'})
        self.assertEqual(response.status_code, 200)
Beispiel #22
0
    def test_domain_post_view(self):
        url = test_reverse('wa-domain', args=[1])

        # If connected, should work
        self.client.login(username='******', password='******')

        # If the form is empty
        response = self.client.post(url)
        self.assertEqual(response.status_code, 400)

        # If the site doesn't exists
        url = test_reverse('wa-domain', args=[10])
        response = self.client.post(url, {'domain': 'mydomainname.com'})
        self.assertEqual(response.status_code, 404)

        # We create a new site
        put_url = test_reverse('wa-domain')
        response = self.client.put(put_url, {'domain': 'mydomainname.com'})
        self.assertContains(response, 'msg')

        pk = Site.objects.get(domain='mydomainname.com').pk
        # If the domain already exists shouldn't work
        url = test_reverse('wa-domain', args=[pk])
        response = self.client.post(url, {'domain': 'testserver'})
        self.assertEqual(response.status_code, 400)

        # If nothing changed
        url = test_reverse('wa-domain', args=[pk])
        response = self.client.post(url, {'domain': 'mydomainname.com'})
        self.assertEqual(response.status_code, 200)

        # If the change was ok
        url = test_reverse('wa-domain', args=[pk])
        response = self.client.post(url, {'domain': 'example.com'})
        self.assertEqual(response.status_code, 200)
Beispiel #23
0
    def test_get_video_form(self):
        url = test_reverse('wa-plugin')
        self.client.login(username='******', password='******')

        # Fields are Ok
        content_placeholder_1 = '%s1' % settings.HTML_ID_PLACEHOLDER_CONTENT
        plugin_id = ContentType.objects.get(
            app_label="plugin_video", model="plugin_video").id

        # Everything ok - Should work
        response = self.client.get(url, {'placeholder_id': content_placeholder_1,
                                         'plugin_type': plugin_id})
        self.assertContains(response, 'plugin_form_form', status_code = 200)
Beispiel #24
0
    def test_page_move_parent(self):
        self.client.login(username='******', password='******')

        # Move another page
        url = test_reverse('wa-page', args=[10])
        response = self.client.post(url, {'move': '',
                                          'parent': 11,})
        self.assertEqual(response.status_code, 200)

        # Refresh when current page url changed
        page_20 = Page.objects.get(pk=20).get_absolute_url()
        url = page_20[:-1] + test_reverse('wa-page', args=[20])
        response = self.client.post(url, {'move': '',
                                          'parent': 15,})
        self.assertEqual(response.status_code, 202)

        # Refresh when parent page url changed
        page_24 = Page.objects.get(pk=24).get_absolute_url()
        url = page_24[:-1] + test_reverse('wa-page', args=[22])
        response = self.client.post(url, {'move': '',
                                          'parent': 14})
        self.assertEqual(response.status_code, 202)
Beispiel #25
0
    def test_post_page_view(self):
        self.client.login(username='******', password='******')
        url = test_reverse('wa-page', args=[10])

        app_page_type = ContentType.objects.get(
            app_label="page_text", model="pageapp_text").id

        # Post the form to modify the page
        url = test_reverse('wa-page', args=[22])
        response = self.client.post(url, {'title': 'New page 2',
                                          'slug': 'section_3',
                                          'parent': 10,
                                          'app_page_type': app_page_type})
        self.assertEqual(response.status_code, 200)

        # Slug is too short
        response = self.client.post(url, {'title': 'New page 2',
                                          'slug': 'p',
                                          'parent': 10,
                                          'app_page_type': app_page_type})
        self.assertEqual(response.status_code, 203)

        # Try to change the Homepage Slug
        url = test_reverse('wa-page', args=[1])
        response = self.client.post(url, {'title': 'HomePage',
                                          'slug': 'homepage',
                                          'parent': None,
                                          'app_page_type': app_page_type})
        self.assertEqual(response.status_code, 203)

        # Try to set en empty slug to a page
        page_23 = Page.objects.get(pk=23)
        url = test_reverse('wa-page', args=[page_23.pk])
        response = self.client.post(url, {'title': page_23.title,
                                          'slug': '',
                                          'parent': page_23.parent.id,
                                          'app_page_type': page_23.app_page_type.id})
        self.assertEqual(response.status_code, 203)
Beispiel #26
0
    def test_pages_view(self):
        url = test_reverse('wa-pages')

        # If deconnected, shouldn't work
        self.client.logout()
        response = self.client.get(url)
        self.assertEqual(response.status_code, 403)

        self.client.login(username='******', password='******')

        # GET - list of pages
        response = self.client.get(url)
        self.assertContains(response, 'page_list')
        self.assertEqual(len(response.context['pages']), 91)
Beispiel #27
0
    def test_unknown_video(self):
        url = test_reverse('wa-plugin')
        self.client.login(username='******', password='******')
        
        # Try to create a NotImplemented Video
        content_placeholder_1 = '%s1' % settings.HTML_ID_PLACEHOLDER_CONTENT
        plugin_id = ContentType.objects.get(
            app_label="plugin_video", model="plugin_video").id

        response = self.client.put(url, {
                'placeholder_id': content_placeholder_1,
                'plugin_type': plugin_id,
                'url': 'http://www.wat.tv/video/depression-potes-bande-annonce-4yvwp_2ffyh_.html'})
        self.assertContains(response, 'msg', status_code = 400)
Beispiel #28
0
    def test_dailymotion_video(self):
        url = test_reverse('wa-plugin')
        self.client.login(username='******', password='******')

        # Create the dailymotion video
        content_placeholder_1 = '%s1' % settings.HTML_ID_PLACEHOLDER_CONTENT
        plugin_id = ContentType.objects.get(app_label="plugin_video",
                                            model="plugin_video").id

        response = self.client.put(
            url, {
                'placeholder_id':
                content_placeholder_1,
                'plugin_type':
                plugin_id,
                'url':
                'http://www.dailymotion.com/video/xogb25_il-s-evanouit-quand-on-le-chatouille_news'
            })
        self.assertContains(response, 'msg')

        # Display the dailymotion video
        self.client.logout()
        url = '/'

        response = self.client.get(url)
        self.assertContains(response, 'xogb25')

        # Shorten URL
        url = test_reverse('wa-plugin')
        self.client.login(username='******', password='******')
        response = self.client.put(
            url, {
                'placeholder_id': content_placeholder_1,
                'plugin_type': plugin_id,
                'url': 'http://dai.ly/zIc0si'
            })
        self.assertContains(response, 'msg')
Beispiel #29
0
    def test_put_plugin_view(self):
        url = test_reverse('wa-plugin')
        self.client.login(username='******', password='******')
        
        # Some fields are missing
        response = self.client.put(url)
        self.assertContains(response, 'msg', status_code = 400)

        response = self.client.put(url, {'placeholder_id': ''})
        self.assertContains(response, 'msg', status_code = 400)

        response = self.client.put(url, {'plugin_type': ''})
        self.assertContains(response, 'msg', status_code = 400)

        content_placeholder_1 = '%s1' % settings.HTML_ID_PLACEHOLDER_CONTENT
        plugin_id = ContentType.objects.get(
            app_label="plugin_text", model="plugin_text").id

        # Wrong placeholder
        response = self.client.put(url, {'placeholder_id': 'foobar',
                                         'plugin_type': plugin_id})
        self.assertContains(response, 'msg', status_code = 400)

        # Cannot add in placeholder_default
        response = self.client.put(url, {'placeholder_id': settings.HTML_ID_PLACEHOLDER_DEFAULT,
                                         'plugin_type': plugin_id})
        self.assertContains(response, 'msg', status_code = 400)

        # Cannot add in placeholder clipboard
        response = self.client.put(url, {'placeholder_id': settings.HTML_ID_PLACEHOLDER_CLIPBOARD,
                                         'plugin_type': plugin_id})
        self.assertContains(response, 'msg', status_code = 400)

        # Wrong plugin_id
        response = self.client.put(url, {'placeholder_id': content_placeholder_1,
                                         'plugin_type': 9999})
        self.assertContains(response, 'msg', status_code = 400)

        # Empty form
        response = self.client.put(url, {'placeholder_id': content_placeholder_1,
                                         'plugin_type': plugin_id})
        self.assertContains(response, 'plugin_form_form', status_code = 400)

        # Form ok
        response = self.client.put(url, {'placeholder_id': content_placeholder_1,
                                         'plugin_type': plugin_id,
                                         'text': '<p>Foo bar</p>'})
        self.assertContains(response, 'msg')
        self.assertContains(response, 'html')
Beispiel #30
0
    def test_get_video_form(self):
        url = test_reverse('wa-plugin')
        self.client.login(username='******', password='******')

        # Fields are Ok
        content_placeholder_1 = '%s1' % settings.HTML_ID_PLACEHOLDER_CONTENT
        plugin_id = ContentType.objects.get(app_label="plugin_video",
                                            model="plugin_video").id

        # Everything ok - Should work
        response = self.client.get(url, {
            'placeholder_id': content_placeholder_1,
            'plugin_type': plugin_id
        })
        self.assertContains(response, 'plugin_form_form', status_code=200)
Beispiel #31
0
    def test_domain_delete_view(self):
        # If connected, should work
        self.client.login(username='******', password='******')

        # We create a new site
        put_url = test_reverse('wa-domain')
        self.client.put(put_url, {'domain': 'mydomainname.com'})

        pk = Site.objects.get(domain='mydomainname.com').pk

        # If everything ok
        url = test_reverse('wa-domain', args=[pk])
        response = self.client.delete(url)
        self.assertContains(response, 'msg')

        # If the site doesn't exists
        url = test_reverse('wa-domain', args=[10])
        response = self.client.delete(url)
        self.assertEqual(response.status_code, 404)

        # If the site is the primary site
        url = test_reverse('wa-domain', args=[1])
        response = self.client.delete(url)
        self.assertEqual(response.status_code, 400)
Beispiel #32
0
    def test_domain_delete_view(self):
        # If connected, should work
        self.client.login(username='******', password='******')

        # We create a new site
        put_url = test_reverse('wa-domain')
        self.client.put(put_url, {'domain': 'mydomainname.com'})

        pk = Site.objects.get(domain='mydomainname.com').pk        

        # If everything ok
        url = test_reverse('wa-domain', args=[pk])
        response = self.client.delete(url)
        self.assertContains(response, 'msg')
        
        # If the site doesn't exists
        url = test_reverse('wa-domain', args=[10])
        response = self.client.delete(url)
        self.assertEqual(response.status_code, 404)
        
        # If the site is the primary site
        url = test_reverse('wa-domain', args=[1])
        response = self.client.delete(url)
        self.assertEqual(response.status_code, 400)
Beispiel #33
0
    def test_domain_get_view(self):
        url = test_reverse('wa-domain')

        # If deconnected, shouldn't work
        self.client.logout()
        response = self.client.get(url)
        self.assertEqual(response.status_code, 403)

        # If connected, should work
        self.client.login(username='******', password='******')

        response = self.client.get(url)
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.context['edit'], False)

        url = test_reverse('wa-domain', args=[1])
        response = self.client.get(url)
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.context['edit'], True)

        # If the site doesn't exists
        url = test_reverse('wa-domain', args=[10])
        response = self.client.get(url)
        self.assertEqual(response.status_code, 404)
Beispiel #34
0
    def test_domain_get_view(self):
        url = test_reverse('wa-domain')

        # If deconnected, shouldn't work
        self.client.logout()
        response = self.client.get(url)
        self.assertEqual(response.status_code, 403)

        # If connected, should work
        self.client.login(username='******', password='******')

        response = self.client.get(url)
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.context['edit'], False)

        url = test_reverse('wa-domain', args=[1])
        response = self.client.get(url)
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.context['edit'], True)

        # If the site doesn't exists
        url = test_reverse('wa-domain', args=[10])
        response = self.client.get(url)
        self.assertEqual(response.status_code, 404)
Beispiel #35
0
    def test_page_layout_view(self):
        url = test_reverse('wa-page-layout')

        # If deconnected, shouldn't work
        self.client.logout()
        response = self.client.get(url)
        self.assertEqual(response.status_code, 403)

        self.client.login(username='******', password='******')

        # GET
        response = self.client.get(url)
        self.assertEqual(response.status_code, 400)

        response = self.client.get(url, {'layout_section_slug': settings.SLUG_CONTENT})
        self.assertContains(response, settings.SLUG_CONTENT)
Beispiel #36
0
    def test_layouts_view(self):
        """Ensure the layouts view exists"""
        url = test_reverse("wa-layouts")

        # If deconnected, shouldn't work
        self.client.logout()
        response = self.client.get(url)
        self.assertEqual(response.status_code, 403)

        # If connected, should work
        self.client.login(username="******", password="******")

        response = self.client.get(url)
        self.assertEqual(response.status_code, 400)

        response = self.client.get(url, {"layout_section_slug": settings.SLUG_CONTENT})
        self.assertContains(response, "layouts_listform")
Beispiel #37
0
    def test_layouts_view(self):
        """Ensure the layouts view exists"""
        url = test_reverse('wa-layouts')

        # If deconnected, shouldn't work
        self.client.logout()
        response = self.client.get(url)
        self.assertEqual(response.status_code, 403)

        # If connected, should work
        self.client.login(username='******', password='******')
        
        response = self.client.get(url)
        self.assertEqual(response.status_code, 400)
        
        response = self.client.get(url, {'layout_section_slug': settings.SLUG_CONTENT})
        self.assertContains(response, 'layouts_listform')
Beispiel #38
0
    def test_unknown_video(self):
        url = test_reverse('wa-plugin')
        self.client.login(username='******', password='******')

        # Try to create a NotImplemented Video
        content_placeholder_1 = '%s1' % settings.HTML_ID_PLACEHOLDER_CONTENT
        plugin_id = ContentType.objects.get(app_label="plugin_video",
                                            model="plugin_video").id

        response = self.client.put(
            url, {
                'placeholder_id':
                content_placeholder_1,
                'plugin_type':
                plugin_id,
                'url':
                'http://www.wat.tv/video/depression-potes-bande-annonce-4yvwp_2ffyh_.html'
            })
        self.assertContains(response, 'msg', status_code=400)
Beispiel #39
0
    def test_vimeo_video(self):
        url = test_reverse('wa-plugin')
        self.client.login(username='******', password='******')
        
        # Create the vimeo video
        content_placeholder_1 = '%s1' % settings.HTML_ID_PLACEHOLDER_CONTENT
        plugin_id = ContentType.objects.get(
            app_label="plugin_video", model="plugin_video").id

        response = self.client.put(url, {'placeholder_id': content_placeholder_1,
                                         'plugin_type': plugin_id,
                                         'url': 'http://vimeo.com/35256030'})
        self.assertContains(response, 'msg')

        # Display the vimeo video
        self.client.logout()
        url = '/'

        response = self.client.get(url)
        self.assertContains(response, '35256030')
Beispiel #40
0
    def test_login_view(self):
        """Ensure the robots view exists"""
        url = test_reverse("wa-login")

        # Bad login
        response = self.client.post(url, {"email": "badlogin", "password": "******"})
        self.assertContains(response, "msg", status_code=400)

        # Bad password
        response = self.client.post(url, {"email": "*****@*****.**", "password": "******"})
        self.assertContains(response, "msg", status_code=400)

        # Inactive account
        user = User.objects.create_user(username="******", email="*****@*****.**", password="******")
        user.is_active = False
        user.save()
        response = self.client.post(url, {"email": "*****@*****.**", "password": "******"})
        self.assertContains(response, "msg", status_code=400)

        # Connection OK
        response = self.client.post(url, {"email": "*****@*****.**", "password": "******"})
        self.assertContains(response, "msg")
Beispiel #41
0
    def test_vimeo_video(self):
        url = test_reverse('wa-plugin')
        self.client.login(username='******', password='******')

        # Create the vimeo video
        content_placeholder_1 = '%s1' % settings.HTML_ID_PLACEHOLDER_CONTENT
        plugin_id = ContentType.objects.get(app_label="plugin_video",
                                            model="plugin_video").id

        response = self.client.put(
            url, {
                'placeholder_id': content_placeholder_1,
                'plugin_type': plugin_id,
                'url': 'http://vimeo.com/35256030'
            })
        self.assertContains(response, 'msg')

        # Display the vimeo video
        self.client.logout()
        url = '/'

        response = self.client.get(url)
        self.assertContains(response, '35256030')
Beispiel #42
0
    def test_login_view(self):
        """Ensure the robots view exists"""
        url = test_reverse('wa-login')

        # Bad login
        response = self.client.post(url, {
            'email': 'badlogin',
            'password': '******'
        })
        self.assertContains(response, 'msg', status_code=400)

        # Bad password
        response = self.client.post(url, {
            'email': '*****@*****.**',
            'password': '******'
        })
        self.assertContains(response, 'msg', status_code=400)

        # Inactive account
        user = User.objects.create_user(username='******',
                                        email='*****@*****.**',
                                        password='******')
        user.is_active = False
        user.save()
        response = self.client.post(url, {
            'email': '*****@*****.**',
            'password': '******'
        })
        self.assertContains(response, 'msg', status_code=400)

        # Connection OK
        response = self.client.post(url, {
            'email': '*****@*****.**',
            'password': '******'
        })
        self.assertContains(response, 'msg')
Beispiel #43
0
    def test_plugin_page_relation_view(self):
        self.client.login(username='******', password='******')

        url = test_reverse('wa-plugin-page-relation')

        content_placeholder_1 = '%s1' % settings.HTML_ID_PLACEHOLDER_CONTENT
        content_placeholder_2 = '%s2' % settings.HTML_ID_PLACEHOLDER_CONTENT
        clipboard_placeholder = '%s' % settings.HTML_ID_PLACEHOLDER_CLIPBOARD
        default_placeholder = '%s' % settings.HTML_ID_PLACEHOLDER_DEFAULT
        plugins_order = ['plugin-relation-2', 'plugin-relation-1']
        app = '%s1' % settings.HTML_ID_APP

        # 400 - Some fields are missing
        response = self.client.post(url)
        self.assertContains(response, 'msg', status_code=400)

        response = self.client.post(url,
                                    {'placeholder_id': content_placeholder_1})
        self.assertContains(response, 'msg', status_code=400)

        response = self.client.post(url, {'plugins_order[]': plugins_order})
        self.assertContains(response, 'msg', status_code=400)

        # 400 - Wrong placeholder
        response = self.client.post(url, {
            'placeholder_id': 'foobar',
            'plugins_order[]': plugins_order
        })
        self.assertContains(response, 'msg', status_code=400)

        # Ok - Try to move and reorder some plugins
        response = self.client.post(
            url, {
                'placeholder_id': content_placeholder_1,
                'plugins_order[]': plugins_order
            })
        self.assertContains(response, 'msg')

        # OK - Try to move the page_app
        response = self.client.post(url, {
            'placeholder_id': content_placeholder_2,
            'plugins_order[]': [app]
        })
        self.assertContains(response, 'msg')

        # 400 - Try to move another website plugin
        response = self.client.post(
            url, {
                'placeholder_id': content_placeholder_1,
                'plugins_order': ['plugin-relation-2', 'plugin-relation-487']
            })
        self.assertContains(response, 'msg', status_code=400)

        # Ok - Try to move another page plugin
        response = self.client.post(
            url, {
                'placeholder_id': content_placeholder_1,
                'plugins_order[]': ['plugin-relation-2', 'plugin-relation-16']
            })
        self.assertContains(response, 'msg')

        # Ok - Try to move the plugin in the clipboard
        response = self.client.post(
            url, {
                'placeholder_id': clipboard_placeholder,
                'plugins_order[]': ['plugin-relation-2']
            })
        self.assertContains(response, 'msg')

        # Fail - Try to move the app in the clipboard
        response = self.client.post(url, {
            'placeholder_id': clipboard_placeholder,
            'plugins_order[]': [app]
        })
        self.assertContains(response, 'msg', status_code=400)

        # Fail - Try to move something in the default
        response = self.client.post(
            url, {
                'placeholder_id': default_placeholder,
                'plugins_order[]': plugins_order
            })
        self.assertContains(response, 'msg', status_code=400)
Beispiel #44
0
 def test_page_move_next(self):
     self.client.login(username='******', password='******')
     url = test_reverse('wa-page', args=[10])
     response = self.client.post(url, {'move': '',
                                       'next': 12,})
     self.assertEqual(response.status_code, 200)
Beispiel #45
0
    def test_put_page_view(self):
        self.client.login(username='******', password='******')
        url = test_reverse('wa-page')

        app_page_type = ContentType.objects.get(
            app_label="page_text", model="pageapp_text").id

        ## Try to create a child for the home page
        infos = {'title': 'New page',
                 'slug': 'new-page',
                 'parent': 1,
                 'app_page_type': app_page_type}
        response = self.client.put(url, infos)
        self.assertEqual(response.status_code, 400)

        ## Try to create an empty slug page
        infos = {'title': 'New page',
                 'slug': '',
                 'parent': '',
                 'app_page_type': app_page_type}
        response = self.client.put(url, infos)
        self.assertEqual(response.status_code, 400)

        ## Try to create a used slug page
        infos = {'title': 'New page',
                 'slug': 'section_1',
                 'parent': '',
                 'app_page_type': app_page_type}
        response = self.client.put(url, infos)
        self.assertEqual(response.status_code, 400)

        ## Too short slug
        infos = {'title': 'New page',
                 'slug': 'p',
                 'parent': '',
                 'app_page_type': app_page_type}
        response = self.client.put(url, infos)
        self.assertEqual(response.status_code, 400)

        ## Parent doesn't exists
        infos = {'title': 'New page',
                 'slug': 'new-page',
                 'parent': 9999,
                 'app_page_type': app_page_type}
        response = self.client.put(url, infos)
        self.assertEqual(response.status_code, 400)

        ## Working add form
        infos = {'title': 'New page',
                 'slug': 'new-page',
                 'parent': '',
                 'app_page_type': app_page_type}
        response = self.client.put(url, infos)
        self.assertEqual(response.status_code, 202)

        ## Working add child form
        infos = {'title': 'New page 2',
                 'slug': 'new-page2',
                 'parent': 10,
                 'app_page_type': app_page_type}
        response = self.client.put(url, infos)
        self.assertEqual(response.status_code, 202)
Beispiel #46
0
    def test_plugin_page_relation_view(self):
        self.client.login(username='******', password='******')

        url = test_reverse('wa-plugin-page-relation')

        content_placeholder_1 = '%s1' % settings.HTML_ID_PLACEHOLDER_CONTENT
        content_placeholder_2 = '%s2' % settings.HTML_ID_PLACEHOLDER_CONTENT
        clipboard_placeholder = '%s' % settings.HTML_ID_PLACEHOLDER_CLIPBOARD
        default_placeholder = '%s' % settings.HTML_ID_PLACEHOLDER_DEFAULT
        plugins_order = ['plugin-relation-2', 
                         'plugin-relation-1']
        app = '%s1' % settings.HTML_ID_APP

        # 400 - Some fields are missing
        response = self.client.post(url)
        self.assertContains(response, 'msg', status_code = 400)

        response = self.client.post(url, {'placeholder_id': content_placeholder_1})
        self.assertContains(response, 'msg', status_code = 400)

        response = self.client.post(url, {'plugins_order[]': plugins_order})
        self.assertContains(response, 'msg', status_code = 400)

        # 400 - Wrong placeholder
        response = self.client.post(url, {'placeholder_id': 'foobar',
                                         'plugins_order[]': plugins_order})
        self.assertContains(response, 'msg', status_code = 400)

        # Ok - Try to move and reorder some plugins
        response = self.client.post(url, {'placeholder_id': content_placeholder_1,
                                         'plugins_order[]': plugins_order})
        self.assertContains(response, 'msg')

        # OK - Try to move the page_app
        response = self.client.post(url, {'placeholder_id': content_placeholder_2,
                                          'plugins_order[]': [app]})
        self.assertContains(response, 'msg')

        # 400 - Try to move another website plugin
        response = self.client.post(url, {'placeholder_id': content_placeholder_1,
                                          'plugins_order': ['plugin-relation-2', 
                                                            'plugin-relation-487']})
        self.assertContains(response, 'msg', status_code = 400)

        # Ok - Try to move another page plugin
        response = self.client.post(url, {'placeholder_id': content_placeholder_1,
                                          'plugins_order[]': ['plugin-relation-2', 
                                                            'plugin-relation-16']})
        self.assertContains(response, 'msg')

        # Ok - Try to move the plugin in the clipboard
        response = self.client.post(url, {'placeholder_id': clipboard_placeholder,
                                          'plugins_order[]': ['plugin-relation-2']})
        self.assertContains(response, 'msg')

        # Fail - Try to move the app in the clipboard
        response = self.client.post(url, {'placeholder_id': clipboard_placeholder,
                                          'plugins_order[]': [app]})
        self.assertContains(response, 'msg', status_code = 400)

        # Fail - Try to move something in the default
        response = self.client.post(url, {'placeholder_id': default_placeholder,
                                          'plugins_order[]': plugins_order})
        self.assertContains(response, 'msg', status_code = 400)
Beispiel #47
0
    def test_dispatcher_view(self):
        "Test the access point actions in API - Dispatcher Views"

        valid_html_id_plugin = '%s%d' % (settings.HTML_ID_PLUGIN, 1)
        valid_html_id_app = '%s%d' % (settings.HTML_ID_APP, 1)
        valid_url_action = 'item_list'

        url = test_reverse('wa-actions',
                           args=[valid_html_id_plugin, valid_url_action])

        # If deconnected, shouldn't work
        self.client.logout()
        response = self.client.get(url)
        self.assertEqual(response.status_code, 403)
        response = self.client.put(url)
        self.assertEqual(response.status_code, 403)
        response = self.client.post(url)
        self.assertEqual(response.status_code, 403)
        response = self.client.delete(url)
        self.assertEqual(response.status_code, 403)

        # Connection of client
        self.client.login(username='******', password='******')

        # Call with bad number of parameters
        self.assertRaises(NoReverseMatch, test_reverse, 'wa-actions')
        self.assertRaises(NoReverseMatch,
                          test_reverse,
                          'wa-actions',
                          args=[valid_html_id_plugin])
        self.assertRaises(NoReverseMatch,
                          test_reverse,
                          'wa-actions',
                          args=[valid_url_action])

        # Call with wrong object_slug
        # Wrong prefix
        wrong_html_id_plugin = 'wrong-slug-1'
        url = test_reverse('wa-actions',
                           args=[wrong_html_id_plugin, valid_url_action])
        response = self.client.get(url)
        self.assertContains(response, 'msg', status_code=400)
        response = self.client.put(url)
        self.assertContains(response, 'msg', status_code=400)
        response = self.client.post(url)
        self.assertContains(response, 'msg', status_code=400)
        response = self.client.delete(url)
        self.assertContains(response, 'msg', status_code=400)

        # Plugin Relation Object doesn't exist
        html_id_plugin = '%s%d' % (settings.HTML_ID_PLUGIN, 10000)
        url = test_reverse('wa-actions',
                           args=[html_id_plugin, valid_url_action])
        response = self.client.get(url)
        self.assertContains(response, 'msg', status_code=404)
        response = self.client.put(url)
        self.assertContains(response, 'msg', status_code=404)
        response = self.client.post(url)
        self.assertContains(response, 'msg', status_code=404)
        response = self.client.delete(url)
        self.assertContains(response, 'msg', status_code=404)

        # App Object doesn't exist
        html_id_app = '%s%d' % (settings.HTML_ID_APP, 100000)
        url = test_reverse('wa-actions', args=[html_id_app, valid_url_action])
        response = self.client.get(url)
        self.assertContains(response, 'msg', status_code=404)