Пример #1
0
    def setUp(self):
        self.adoptees = [
            Adoptee(english_name='Madeline Jing-Mei',
                    pinyin_name='Jǐngměi',
                    chinese_name='景美'),
            Adoptee(english_name='Kim Bla', ),
            Adoptee(english_name='Search Test',
                    pinyin_name='Lala',
                    chinese_name='搜索的一例'),
            Adoptee(chinese_name='景',
                    pinyin_name='Lola')
        ]
        for adoptee in self.adoptees:
            adoptee.save()

        self.relationship = RelationshipCategory(approved=True)
        self.relationship.save()

        prototypical_storyteller_kw_args = {'story_text': 'bs',
                                            'email': '*****@*****.**',
                                            'approved': True,
                                            'relationship_to_story': self.relationship,
                                            }
        self.storytellers = [StoryTeller(related_adoptee=adoptee,
                                         **prototypical_storyteller_kw_args)
                             for adoptee in self.adoptees]

        self.photos = []

        for storyteller in self.storytellers:
            storyteller.save()
            self.photos.append(create_random_photo(storyteller))

        for adoptee, storyteller, photo in zip(self.adoptees, self.storytellers, self.photos):
            adoptee.front_story = storyteller
            image_file = create_random_image_file(config['PHOTO_FRONT_STORY_WIDTH'],
                                                  config['PHOTO_FRONT_STORY_HEIGHT'])
            adoptee.photo_front_story.save('bs.jpg', ContentFile(image_file.getvalue()))
            adoptee.save()

        self.c = Client()
        self.adoptee_search_url_name = 'adopteeSearch'
Пример #2
0
    def setUp(self):
        self.c = Client()

        relationship = RelationshipCategory(approved=True)
        relationship.save()

        adoptee = Adoptee(english_name='Madeline Jing-Mei',
                          pinyin_name='Jǐngměi',
                          chinese_name='景美')
        adoptee.save()

        prototypical_storyteller_kw_args = {'story_text': 'bs',
                                            'email': '*****@*****.**',
                                            'approved': True,
                                            'relationship_to_story': relationship,
                                            'related_adoptee': adoptee,
                                            }

        self.storyteller = StoryTeller(**prototypical_storyteller_kw_args)
        self.storyteller.save()
Пример #3
0
    def setUp(self):
        self.c = Client()
        self.upload_url = reverse('photoCreate')
        self.MIN_WIDTH = config['MIN_WIDTH']
        self.MIN_HEIGHT = config['MIN_HEIGHT']

        self.adoptees = [
            Adoptee(english_name='Madeline Jing-Mei',
                    pinyin_name='Jǐngměi',
                    chinese_name='景美'),
            Adoptee(english_name='Kim Bla', ),
            Adoptee(chinese_name='景',
                    pinyin_name='Lola'),
            Adoptee(english_name='Search Test',
                    pinyin_name='Lala',
                    chinese_name='搜索的一例'),
        ]
        for adoptee in self.adoptees:
            adoptee.save()

        self.relationship = RelationshipCategory(approved=True)
        self.relationship.save()

        prototypical_storyteller_kw_args = {'story_text': 'bsbs',
                                            'email': '*****@*****.**',
                                            'approved': True,
                                            'relationship_to_story': self.relationship,
                                            }
        self.storytellers = [StoryTeller(related_adoptee=adoptee,
                                         **prototypical_storyteller_kw_args)
                             for adoptee in self.adoptees]

        for i, storyteller in enumerate(self.storytellers):
            storyteller.save()
            adoptee = self.adoptees[i]
            adoptee.front_story = storyteller
            adoptee.save()