from funittest import dataprovider
from funittest import scripts
from funittest import interpreter
from funittest.testrunner import Test
from funittest import Schema
from funittest import register_tst

import os

class AddLink(Test):
    schema = Schema()

    def setUp(self):    
        interpreter.open("")        
        user=dataprovider.cmfplone.user.get('sampleadmin')
        logical.cmfplone.application.login(user)        
        self.article = dataprovider.plonearticle.article.get("article1")
        scripts.plonearticle.article.existing_article(self.article)

    def step_1(self):
        "Add a link to an article and save the article"
        interpreter.annotate("Test: Add a link to the article and save the article")
        link = dataprovider.plonearticle.articlelink.get("Link 1")
        logical.plonearticle.article.add_link(link)
        logical.plonearticle.article.save_article(self.article)
        
    def test(self):
        self.expect_ok(1)

register_tst("PloneArticle", AddLink())
Beispiel #2
0
from funittest.testrunner import Test
from funittest import Schema
from funittest import register_tst

import os


class AddLink(Test):
    schema = Schema()

    def setUp(self):
        interpreter.open("")
        user = dataprovider.cmfplone.user.get('sampleadmin')
        logical.cmfplone.application.login(user)
        self.article = dataprovider.plonearticle.article.get("article1")
        scripts.plonearticle.article.existing_article(self.article)

    def step_1(self):
        "Add a link to an article and save the article"
        interpreter.annotate(
            "Test: Add a link to the article and save the article")
        link = dataprovider.plonearticle.articlelink.get("Link 1")
        logical.plonearticle.article.add_link(link)
        logical.plonearticle.article.save_article(self.article)

    def test(self):
        self.expect_ok(1)


register_tst("PloneArticle", AddLink())
from funittest import Schema
from funittest import register_tst

import os


class AddFile(Test):
    schema = Schema()

    _uses_file_upload = 1

    def setUp(self):
        interpreter.open("")
        user = dataprovider.cmfplone.user.get('sampleadmin')
        logical.cmfplone.application.login(user)
        self._article = dataprovider.plonearticle.article.get("article1")
        scenarios.cmfplone.addcontent(content=self._article)

    def step_1(self):
        "Add a file to an article"
        interpreter.annotate("Test: Add a file to the article")
        file = dataprovider.plonearticle.articlefile.get("File 1")
        logical.plonearticle.article.add_file(file)
        logical.plonearticle.article.save_article(self._article)

    def test(self):
        self.expect_ok(1)


register_tst("PloneArticle", AddFile())
Beispiel #4
0
from funittest import interpreter
from funittest.testrunner import Test
from funittest import Schema
from funittest import register_tst

import os

class BrowseImage(Test):
    schema = Schema()
    
    _uses_file_upload = 1


    def setUp(self):
        interpreter.open("")        
        user=dataprovider.cmfplone.user.get('sampleadmin')
        logical.cmfplone.application.login(user)        
        article = dataprovider.plonearticle.article.get("article1")
        scripts.plonearticle.article.existing_article(article)

    def step_1(self):
        "Browse an image to be added to the article"
        interpreter.annotate("Test: Browe a image to be added to the article")
        image = dataprovider.plonearticle.articleimage.get("Image 1")
        logical.plonearticle.article.browse_image(image)

    def test(self):
        self.expect_ok(1)

register_tst("PloneArticle", BrowseImage())
from funittest import Schema
from funittest import register_tst

import os

class DeleteFile(Test):
    schema = Schema()

    _uses_file_upload = 1

    def setUp(self):    
        interpreter.open("")        
        user=dataprovider.cmfplone.user.get('sampleadmin')
        logical.cmfplone.application.login(user)        
        self.article = dataprovider.plonearticle.article.get("article1")
        files = [dataprovider.plonearticle.articlefile.get("File 1"),]
        images = []
        links = []
        scripts.plonearticle.article.existing_article_with_attachments(self.article, files, images, links)

    def step_1(self):
        file = dataprovider.plonearticle.articlefile.get("File 1")
        "Delete a file in an article"
        logical.plonearticle.article.delete_file(file)
        logical.plonearticle.article.save_article(self.article)

    def test(self):
        self.expect_ok(1)

register_tst("PloneArticle", DeleteFile())
        physical.plonearticle.attachment_upload.cancel()  
        logical.plonearticle.article.save_article(self.article)
        
    def test_cancel_adding_an_image(self):
        "Cancel adding an image"
        interpreter.annotate("Test: Add an image to the article and cancel")
        image = dataprovider.plonearticle.articleimage.get("Image 1")
        physical.cmfplone.tab.access("edit")
        physical.cmfplone.schemata.access("images")
        physical.plonearticle.attachment_upload.access()
        physical.plonearticle.attachment_upload.fill(image)
        # Not saving here.
        physical.plonearticle.attachment_upload.cancel()  
        logical.plonearticle.article.save_article(self.article)

    def test_add_two_images_and_change_position(self):
        "Add two images and change their position"
        interpreter.annotate("Test: Add two images and change their position")

        images = []
        images.append(dataprovider.plonearticle.articleimage.get("Image 1"))
        images.append(dataprovider.plonearticle.articleimage.get("Image 2"))
        logical.plonearticle.article.add_multiple_images(images)

        # Change position of images       
        interpreter.click("//a[@class='file_move_down'][1]")
        interpreter.click("//a[@class='file_move_down'][1]")
        logical.plonearticle.article.save_article(self.article)
        
register_tst("PloneArticle", AddImage())
        logical.plonearticle.article.save_article(self.article)

    def test_cancel_adding_an_image(self):
        "Cancel adding an image"
        interpreter.annotate("Test: Add an image to the article and cancel")
        image = dataprovider.plonearticle.articleimage.get("Image 1")
        physical.cmfplone.tab.access("edit")
        physical.cmfplone.schemata.access("images")
        physical.plonearticle.attachment_upload.access()
        physical.plonearticle.attachment_upload.fill(image)
        # Not saving here.
        physical.plonearticle.attachment_upload.cancel()
        logical.plonearticle.article.save_article(self.article)

    def test_add_two_images_and_change_position(self):
        "Add two images and change their position"
        interpreter.annotate("Test: Add two images and change their position")

        images = []
        images.append(dataprovider.plonearticle.articleimage.get("Image 1"))
        images.append(dataprovider.plonearticle.articleimage.get("Image 2"))
        logical.plonearticle.article.add_multiple_images(images)

        # Change position of images
        interpreter.click("//a[@class='file_move_down'][1]")
        interpreter.click("//a[@class='file_move_down'][1]")
        logical.plonearticle.article.save_article(self.article)


register_tst("PloneArticle", AddImage())
class DeleteFile(Test):
    schema = Schema()

    _uses_file_upload = 1

    def setUp(self):
        interpreter.open("")
        user = dataprovider.cmfplone.user.get('sampleadmin')
        logical.cmfplone.application.login(user)
        self.article = dataprovider.plonearticle.article.get("article1")
        files = [
            dataprovider.plonearticle.articlefile.get("File 1"),
        ]
        images = []
        links = []
        scripts.plonearticle.article.existing_article_with_attachments(
            self.article, files, images, links)

    def step_1(self):
        file = dataprovider.plonearticle.articlefile.get("File 1")
        "Delete a file in an article"
        logical.plonearticle.article.delete_file(file)
        logical.plonearticle.article.save_article(self.article)

    def test(self):
        self.expect_ok(1)


register_tst("PloneArticle", DeleteFile())
from funittest import scenarios
from funittest.testrunner import Test
from funittest import Schema
from funittest import register_tst

import os

class AddFile(Test):
    schema = Schema()

    _uses_file_upload = 1

    def setUp(self):    
        interpreter.open("")
        user=dataprovider.cmfplone.user.get('sampleadmin')
        logical.cmfplone.application.login(user)
        self._article = dataprovider.plonearticle.article.get("article1")
        scenarios.cmfplone.addcontent(content=self._article)

    def step_1(self):
        "Add a file to an article"
        interpreter.annotate("Test: Add a file to the article")
        file = dataprovider.plonearticle.articlefile.get("File 1")
        logical.plonearticle.article.add_file(file)
        logical.plonearticle.article.save_article(self._article)

    def test(self):
        self.expect_ok(1)

register_tst("PloneArticle", AddFile())