예제 #1
0
    def test_rearrange_blog_front_page_content(self):
        """Test if we have the right content in the front pages"""
        from osha.policy.upgrades import rearrange_blog
        rearrange_blog(self.portal)

        self.assertEquals(self.director_corner_en['front-page'].Title(),
                          "Director's corner")
        self.assertEquals(
            self.director_corner_en['front-page'].getText(),
            """<p>\r\n\t<img align="left" alt="Picture of Dr Christa Sedlatschek" height="91" src="/en/teaser/Dr-Christa-Sedlatschek-appointed-to-lead-EU-OSHA/image" width="80" /></p>\r\n<h2>\r\n\t&nbsp;Short profile of Dr Christa Sedlatschek</h2>\r\n<p>\r\n\t&nbsp;<strong>Dr Christa Sedlatschek</strong>&nbsp;is a medical doctor (University of Vienna) and a specialist in occupational health.</p>\r\n<p>\r\n\t&nbsp;After completing her studies she started working in the Austrian labour inspectorate and moved to the Ministry for Labour and Social Affairs in 1993, taking over the function as Deputy Head of the department for occupational medicine.</p>\r\n<p>\r\n\tIn 1998 she was recruited by EU-OSHA where she focused on the development and dissemination of good practice information, becoming the head of the working environment unit. During that time she gained an in-depth knowledge about the EU and existing occupational safety and health (OSH) systems in the Member States.</p>\r\n<p>\r\n\tIn 2003 she moved to Berlin and started working in the Federal Institute for Occupational Safety and Health (Bundesanstalt f\xc3\xbcr Arbeitsschutz und Arbeitsmedizin - BAuA), where she became Director of the national \xe2\x80\x9cInitiative New Quality of Work - INQA\xe2\x80\x9d in 2004.</p>\r\n<p>\r\n\t\xe2\x80\x9cINQA\xe2\x80\x9d was launched by the German Federal Ministry for labour and social affairs as a consequence of the Lisbon Summit in 2000, aiming at making a contribution towards creating more and better jobs in Europe.</p>\r\n<p>\r\n\t&nbsp;</p>\r\n"""
        )
        self.assertEquals(
            self.director_corner_en['blog']['front-page'].Title(), 'OSH Blog')
        self.assertEquals(
            self.director_corner_en['blog']['front-page'].getText(),
            "<p>The aim of this blog is to bring you news about developments in occupational safety and health across the EU and beyond, and also about EU-OSHA initiatives and activities to fulfill our mission. We are one of the smallest EU agencies and cannot promise to reply to every comment, but we will read them and bear them in mind to shape our future work.</p>"
        )

        self.assertEquals(self.director_corner_de['front-page'].Title(),
                          "Der Direktor hat das Wort")
        self.assertEquals(
            self.director_corner_de['front-page'].getText(),
            """<p>\r\n\t<img align="left" alt="Bild von Dr. med. Christa Sedlatschek" height="91" src="/en/teaser/Dr-Christa-Sedlatschek-appointed-to-lead-EU-OSHA/image" width="80" /></p>\r\n<h2>\r\n\tKurzprofil von Dr. med. Christa Sedlatschek</h2>\r\n<p>\r\n\t<strong>&nbsp;Dr. med. Christa Sedlatschek</strong>&nbsp;studierte Medizin an der Universit\xc3\xa4t Wien und ist Fach\xc3\xa4rztin f\xc3\xbcr Arbeitsmedizin.</p>\r\n<p>\r\n\t&nbsp;Nach ihrem Studium war sie zun\xc3\xa4chst in der \xc3\xb6sterreichischen Arbeitsinspektion t\xc3\xa4tig und wechselte 1993 als stellvertretende Leiterin der Abteilung Arbeitsmedizin ins Arbeits- und Sozialministerium.</p>\r\n<p>\r\n\t1998 wechselte sie zur EU-OSHA, wo sie sich auf die Entwicklung und Verbreitung von Informationen \xc3\xbcber gute praktische L\xc3\xb6sungen konzentrierte und Leiterin des Referats Arbeitsumfeld wurde. In dieser Zeit erwarb sie gr\xc3\xbcndliche Kenntnisse \xc3\xbcber die EU und die bestehenden Systeme der Sicherheit und des Gesundheitsschutzes bei der Arbeit in den Mitgliedstaaten.</p>\r\n<p>\r\n\t2003 ging sie nach Berlin und nahm eine T\xc3\xa4tigkeit in der Bundesanstalt f\xc3\xbcr Arbeitsschutz und Arbeitsmedizin (BAuA) auf, wo sie 2004 Gesch\xc3\xa4ftsf\xc3\xbchrerin der Initiative Neue Qualit\xc3\xa4t der Arbeit (INQA) wurde.</p>\r\n<p>\r\n\tDie Initiative INQA wurde vom Bundesministerium f\xc3\xbcr Arbeit und Soziales nach dem Lissabonner Gipfel im Jahr 2000 mit dem Ziel ins Leben gerufen, einen Beitrag zur Schaffung von mehr und besseren Arbeitspl\xc3\xa4tzen in Europa zu leisten.</p>\r\n<p>\r\n\t&nbsp;</p>\r\n"""
        )
        self.assertEquals(
            self.director_corner_de['blog']['front-page'].Title(), 'OSH Blog')
        self.assertEquals(
            self.director_corner_de['blog']['front-page'].getText(),
            "<p>The aim of this blog is to bring you news about developments in occupational safety and health across the EU and beyond, and also about EU-OSHA initiatives and activities to fulfill our mission. We are one of the smallest EU agencies and cannot promise to reply to every comment, but we will read them and bear them in mind to shape our future work.</p>"
        )
예제 #2
0
    def test_rearrange_blog_hierarchy(self):
        """Test if we have the right object hierarchy after running the
        upgrade.
        """
        from osha.policy.upgrades import rearrange_blog
        rearrange_blog(self.portal)

        self.assertEquals(sorted(self.director_corner_en.keys()),
                          ['blog', 'front-page'])
        self.assertEquals(sorted(self.director_corner_en['blog'].keys()),
                          ['blog-entry-1', 'blog-entry-2', 'front-page'])

        self.assertEquals(sorted(self.director_corner_de.keys()),
                          ['blog', 'front-page'])
        self.assertEquals(sorted(self.director_corner_de['blog'].keys()),
                          ['front-page'])

        self.assertEquals(self.director_corner_en['front-page'].portal_type,
                          'Document')
        self.assertEquals(
            self.director_corner_en['blog']['front-page'].portal_type,
            'Document')
        self.assertEquals(self.director_corner_de['front-page'].portal_type,
                          'Document')
        self.assertEquals(
            self.director_corner_de['blog']['front-page'].portal_type,
            'Document')
예제 #3
0
    def test_rearrange_blog_translations_linked(self):
        """Test if front pages have proper translation references."""
        from osha.policy.upgrades import rearrange_blog
        rearrange_blog(self.portal)

        translations_dc = self.director_corner_en[
            'front-page'].getTranslations()
        self.assertEquals(sorted(translations_dc.keys()), ['de', 'en'])

        translations_blog = self.director_corner_en['blog'][
            'front-page'].getTranslations()
        self.assertEquals(sorted(translations_blog.keys()), ['de', 'en'])
예제 #4
0
    def test_rearrange_blog_translations_linked(self):
        """Test if front pages have proper translation references."""
        from osha.policy.upgrades import rearrange_blog
        rearrange_blog(self.portal)

        translations_dc = self.director_corner_en[
            'front-page'].getTranslations()
        self.assertEquals(sorted(translations_dc.keys()), ['de', 'en'])

        translations_blog = self.director_corner_en[
            'blog']['front-page'].getTranslations()
        self.assertEquals(sorted(translations_blog.keys()), ['de', 'en'])
예제 #5
0
    def test_rearrange_blog_director_corner_missing(self):
        """Test if we correctly handle misconfigured director's corner
        section.
        """
        from osha.policy.upgrades import rearrange_blog

        # no error should be raised
        del self.portal['en']['about']['director_corner']['blog']['front-page']
        self.assertIsNone(rearrange_blog(self.portal))
        del self.portal['en']['about']['director_corner']['front-page']
        self.assertIsNone(rearrange_blog(self.portal))
        del self.portal['en']['about']['director_corner']
        self.assertIsNone(rearrange_blog(self.portal))
예제 #6
0
    def test_rearrange_blog_director_corner_missing(self):
        """Test if we correctly handle misconfigured director's corner
        section.
        """
        from osha.policy.upgrades import rearrange_blog

        # no error should be raised
        del self.portal['en']['about']['director_corner']['blog']['front-page']
        self.assertIsNone(rearrange_blog(self.portal))
        del self.portal['en']['about']['director_corner']['front-page']
        self.assertIsNone(rearrange_blog(self.portal))
        del self.portal['en']['about']['director_corner']
        self.assertIsNone(rearrange_blog(self.portal))
예제 #7
0
    def test_rearrange_blog_front_page_content(self):
        """Test if we have the right content in the front pages"""
        from osha.policy.upgrades import rearrange_blog
        rearrange_blog(self.portal)

        self.assertEquals(
            self.director_corner_en['front-page'].Title(),
            "Director's corner"
        )
        self.assertEquals(
            self.director_corner_en['front-page'].getText(),
            """<p>\r\n\t<img align="left" alt="Picture of Dr Christa Sedlatschek" height="91" src="/en/teaser/Dr-Christa-Sedlatschek-appointed-to-lead-EU-OSHA/image" width="80" /></p>\r\n<h2>\r\n\t&nbsp;Short profile of Dr Christa Sedlatschek</h2>\r\n<p>\r\n\t&nbsp;<strong>Dr Christa Sedlatschek</strong>&nbsp;is a medical doctor (University of Vienna) and a specialist in occupational health.</p>\r\n<p>\r\n\t&nbsp;After completing her studies she started working in the Austrian labour inspectorate and moved to the Ministry for Labour and Social Affairs in 1993, taking over the function as Deputy Head of the department for occupational medicine.</p>\r\n<p>\r\n\tIn 1998 she was recruited by EU-OSHA where she focused on the development and dissemination of good practice information, becoming the head of the working environment unit. During that time she gained an in-depth knowledge about the EU and existing occupational safety and health (OSH) systems in the Member States.</p>\r\n<p>\r\n\tIn 2003 she moved to Berlin and started working in the Federal Institute for Occupational Safety and Health (Bundesanstalt f\xc3\xbcr Arbeitsschutz und Arbeitsmedizin - BAuA), where she became Director of the national \xe2\x80\x9cInitiative New Quality of Work - INQA\xe2\x80\x9d in 2004.</p>\r\n<p>\r\n\t\xe2\x80\x9cINQA\xe2\x80\x9d was launched by the German Federal Ministry for labour and social affairs as a consequence of the Lisbon Summit in 2000, aiming at making a contribution towards creating more and better jobs in Europe.</p>\r\n<p>\r\n\t&nbsp;</p>\r\n"""
        )
        self.assertEquals(
            self.director_corner_en['blog']['front-page'].Title(),
            'OSH Blog'
        )
        self.assertEquals(
            self.director_corner_en['blog']['front-page'].getText(),
            "<p>The aim of this blog is to bring you news about developments in occupational safety and health across the EU and beyond, and also about EU-OSHA initiatives and activities to fulfill our mission. We are one of the smallest EU agencies and cannot promise to reply to every comment, but we will read them and bear them in mind to shape our future work.</p>"
        )

        self.assertEquals(
            self.director_corner_de['front-page'].Title(),
            "Der Direktor hat das Wort"
        )
        self.assertEquals(
            self.director_corner_de['front-page'].getText(),
            """<p>\r\n\t<img align="left" alt="Bild von Dr. med. Christa Sedlatschek" height="91" src="/en/teaser/Dr-Christa-Sedlatschek-appointed-to-lead-EU-OSHA/image" width="80" /></p>\r\n<h2>\r\n\tKurzprofil von Dr. med. Christa Sedlatschek</h2>\r\n<p>\r\n\t<strong>&nbsp;Dr. med. Christa Sedlatschek</strong>&nbsp;studierte Medizin an der Universit\xc3\xa4t Wien und ist Fach\xc3\xa4rztin f\xc3\xbcr Arbeitsmedizin.</p>\r\n<p>\r\n\t&nbsp;Nach ihrem Studium war sie zun\xc3\xa4chst in der \xc3\xb6sterreichischen Arbeitsinspektion t\xc3\xa4tig und wechselte 1993 als stellvertretende Leiterin der Abteilung Arbeitsmedizin ins Arbeits- und Sozialministerium.</p>\r\n<p>\r\n\t1998 wechselte sie zur EU-OSHA, wo sie sich auf die Entwicklung und Verbreitung von Informationen \xc3\xbcber gute praktische L\xc3\xb6sungen konzentrierte und Leiterin des Referats Arbeitsumfeld wurde. In dieser Zeit erwarb sie gr\xc3\xbcndliche Kenntnisse \xc3\xbcber die EU und die bestehenden Systeme der Sicherheit und des Gesundheitsschutzes bei der Arbeit in den Mitgliedstaaten.</p>\r\n<p>\r\n\t2003 ging sie nach Berlin und nahm eine T\xc3\xa4tigkeit in der Bundesanstalt f\xc3\xbcr Arbeitsschutz und Arbeitsmedizin (BAuA) auf, wo sie 2004 Gesch\xc3\xa4ftsf\xc3\xbchrerin der Initiative Neue Qualit\xc3\xa4t der Arbeit (INQA) wurde.</p>\r\n<p>\r\n\tDie Initiative INQA wurde vom Bundesministerium f\xc3\xbcr Arbeit und Soziales nach dem Lissabonner Gipfel im Jahr 2000 mit dem Ziel ins Leben gerufen, einen Beitrag zur Schaffung von mehr und besseren Arbeitspl\xc3\xa4tzen in Europa zu leisten.</p>\r\n<p>\r\n\t&nbsp;</p>\r\n"""
        )
        self.assertEquals(
            self.director_corner_de['blog']['front-page'].Title(),
            'OSH Blog'
        )
        self.assertEquals(
            self.director_corner_de['blog']['front-page'].getText(),
            "<p>The aim of this blog is to bring you news about developments in occupational safety and health across the EU and beyond, and also about EU-OSHA initiatives and activities to fulfill our mission. We are one of the smallest EU agencies and cannot promise to reply to every comment, but we will read them and bear them in mind to shape our future work.</p>"
        )
예제 #8
0
    def test_rearrange_blog_hierarchy(self):
        """Test if we have the right object hierarchy after running the
        upgrade.
        """
        from osha.policy.upgrades import rearrange_blog
        rearrange_blog(self.portal)

        self.assertEquals(
            sorted(self.director_corner_en.keys()),
            ['blog', 'front-page']
        )
        self.assertEquals(
            sorted(self.director_corner_en['blog'].keys()),
            ['blog-entry-1', 'blog-entry-2', 'front-page']
        )

        self.assertEquals(
            sorted(self.director_corner_de.keys()),
            ['blog', 'front-page']
        )
        self.assertEquals(
            sorted(self.director_corner_de['blog'].keys()),
            ['front-page']
        )

        self.assertEquals(
            self.director_corner_en['front-page'].portal_type, 'Document')
        self.assertEquals(
            self.director_corner_en['blog']['front-page'].portal_type,
            'Document'
        )
        self.assertEquals(
            self.director_corner_de['front-page'].portal_type, 'Document')
        self.assertEquals(
            self.director_corner_de['blog']['front-page'].portal_type,
            'Document')