예제 #1
0
    def test_return_attribute_of_subtheme(self):
        """
        Adding a theme and subtheme to the database and then testing to see if it's data is
        retrieved correctly
        """

        theme = Theme("Test_Theme")
        theme.save()
        theme.commit()

        sub_theme = SubTheme(theme.id, "Test_Sub_Theme")
        sub_theme.save()
        sub_theme.commit()

        attributes = Attributes("1234567890-123456789-123456789",
                                "_test_attribute_", "_table_name_",
                                sub_theme.id, 1)
        attributes.save()
        attributes.commit()

        response = self.testing_client.get('/data',
                                           data=dict(subtheme=theme.id))

        self.assertEqual(theme.json(), response.get_json())

        attributes.delete()
        attributes.commit()

        sub_theme.delete()
        sub_theme.commit()

        theme.delete()
        theme.commit()
예제 #2
0
    def test_return_subthemes_of_theme(self):
        """
        Adding a theme and subtheme (linked to to that theme) to the database and then
        testing to see if it is retrieved correctly
        """
        theme = Theme(name='Test_Theme')
        theme.save()
        theme.commit()

        sub_theme = SubTheme(theme.id, "Test_Sub_Theme")
        sub_theme.save()
        sub_theme.commit()

        response = self.testing_client.get('/data', data=dict(theme=theme.id))

        self.assertEqual(sub_theme.json(), response.get_json())

        sub_theme.delete()
        sub_theme.commit()

        theme.delete()
        theme.commit()