Exemplo n.º 1
0
class AffixImageTests(TestCase):

    def setUp(self):
        self.author = AuthorFactory()
        self.author1 = AuthorFactory(name="donald", slug="donald")
        self.location = LocationFactory()
        self.category=CategoryFactory()
        self.image = ImageFactory(photographers=(self.author,self.author1), locations=(self.location,), categories=(self.category,))

    def test_should_return_all_photographers_of_image(self):
        photographers = self.image.get_all_photographers()
        print photographers
        self.assertEqual('V. Sasikumar donald',photographers)

    def test_should_return_all_locations(self):
        locations = self.image.get_locations_index()
        self.assertEqual('Sivaganga  Sivaganga  Tamil Nadu',locations)

    def test_alt_text(self):
        alt_text = self.image.alt_text
        self.assertEqual('PARI Stories from all over in all languages',alt_text)

    def test_default_alt_text(self):
        default_alt_text = self.image.default_alt_text
        print default_alt_text
        self.assertEqual('PARI Stories from all over in all languages',default_alt_text)

    def test_categories_index(self):
        categories_index = self.image.get_categories_index()
        self.assertEqual(1, len(categories_index))
        self.assertEqual(self.category.id, (categories_index)[0])

    def test_image_str(self):
        title = self.image.__str__()
        self.assertEqual('loom',title)
Exemplo n.º 2
0
 def setUp(self):
     self.author = AuthorFactory()
     self.author1 = AuthorFactory(name="donald", slug="donald")
     self.location = LocationFactory()
     self.category = CategoryFactory()
     self.image = ImageFactory(photographers=(self.author, self.author1),
                               locations=(self.location, ),
                               categories=(self.category, ))
Exemplo n.º 3
0
 def setUp(self):
     self.author1 = AuthorFactory.create(name='Test1')
     self.author2 = AuthorFactory.create(name='Test2')
     self.author3 = AuthorFactory.create(name='Test3')
     location1 = LocationFactory.create(name="Madurai", slug="madurai")
     image1 = ImageFactory.create(photographers=(
         self.author1,
         self.author2,
     ),
                                  locations=(location1, ))
     image2 = ImageFactory.create(photographers=(
         self.author1,
         self.author3,
     ),
                                  locations=(location1, ))
     self.album = AlbumFactory(title="Base Album")
     self.talking_album = TalkingAlbumSlideFactory(image=image1,
                                                   page=self.album)
     self.talking_album1 = TalkingAlbumSlideFactory(image=image2,
                                                    page=self.album)
Exemplo n.º 4
0
 def setUpClass(cls):
     super(TestHomePage, cls).setUpClass()
     author1 = AuthorFactory.create()
     author2 = AuthorFactory.create(name="Karthik", slug="srk")
     category1 = CategoryFactory.create(name="Resource Conflicts", slug="resource-conflicts", order=1, description="Jal, jungle, zameen")
     category2 = CategoryFactory.create(name="Adivasis", slug="adivasis", order=2, description="The first dwellers")
     category3 = CategoryFactory.create(name="Dalits", slug="dalits", order=3, description="Struggles of the oppressed")
     category4 = CategoryFactory.create(name="Rural Sports", slug="sports-games", order=4, description="Games people play")
     location1 = LocationFactory.create()
     location2 = LocationFactory.create(name="Madurai", slug="madurai")
     image = ImageFactory.create(photographers=(author1,), locations=(location1,))
     setup = DataSetup()
     article1 = setup.create_article("article1", author1, category1, location1, image)
     article2 = setup.create_article("article2", author2, category2, location2, image)
     video_article = setup.create_video_article("video article", author2, location1, image)
     talking_album = setup.create_talking_album(image)
     photo_album = setup.create_photo_album(image)
     HomePageFactory.create(carousel_0=article1, carousel_1=article2, in_focus_page1=article1, in_focus_page2=article2, video=video_article, talking_album=talking_album, photo_album=photo_album)
Exemplo n.º 5
0
 def setUp(self):
     author1 = AuthorFactory.create(name='Test1')
     author2 = AuthorFactory.create(name='Test2')
     author3 = AuthorFactory.create(name='Test3')
     location1 = LocationFactory.create(name="Madurai", slug="madurai")
     image1 = ImageFactory.create(photographers=(
         author1,
         author2,
     ),
                                  locations=(location1, ))
     self.talking_album1 = TalkingAlbumSlideFactory(
         image=image1,
         page__title="Talking Album 1",
         page__first_published_at='2011-10-24 12:43')
     self.talking_album2 = TalkingAlbumSlideFactory(
         image=image1,
         page__title="Talking Album 2",
         page__first_published_at='2011-10-25 12:43')
     self.photo_album = PhotoAlbumSlideFactory(image=image1)
Exemplo n.º 6
0
 def setUpClass(cls):
     super(TestArticlePage, cls).setUpClass()
     author = AuthorFactory.create(name="Nimesh", slug="puli")
     category = CategoryFactory.create(name="Adivasis",
                                       slug="adivasis",
                                       order=2,
                                       description="The first dwellers")
     location = LocationFactory.create(name="Madurai", slug="madurai")
     image = ImageFactory.create(photographers=(author, ),
                                 locations=(location, ))
     setup = DataSetup()
     dummy_article = setup.create_article("Dummy", author, category,
                                          location, image)
     modular_article = setup.create_article("Article Page",
                                            author,
                                            category,
                                            location,
                                            image,
                                            show_modular_content=True,
                                            modular_content=json.dumps(
                                                get_modular_content(
                                                    dummy_article.id,
                                                    image.id, location.id)))