示例#1
0
    def setUp(self):
        test_user_data = {
            'username': '******',
            'password': '******',
            'confirm_password': '******',
            'first_name': '수민',
            'last_name': '박',
            'phone_num': '010123456789',
        }
        self.user = User.objects.create_django_user(**test_user_data)

        [Amenities.objects.create(name=name) for name in self.AMENITIES_LIST]
        [Facilities.objects.create(name=name) for name in self.FACILITIES_LIST]

        self.BASE_DATA['host'] = self.user
        house = House.objects.create(**self.BASE_DATA)

        file_path = os.path.join(settings.STATIC_DIR, 'iu.jpg')
        house_image1_path = os.path.join(settings.STATIC_DIR, 'test',
                                         'test_inner_image.jpg')
        house_image2_path = os.path.join(settings.STATIC_DIR, 'test',
                                         'test_outer_image.jpg')

        img_cover = open(file_path, 'rb')
        house_image1 = open(house_image1_path, 'rb')
        house_image2 = open(house_image2_path, 'rb')

        house.img_cover.save('iu.jpg', img_cover)
        houseimage1 = HouseImage.objects.create(house=house)
        houseimage2 = HouseImage.objects.create(house=house)
        houseimage1.image.save('test_inner_image.jpg', house_image1)
        houseimage2.image.save('test_outer_image.jpg', house_image2)

        img_cover.close()
        house_image1.close()
        house_image2.close()

        self.user.is_host = True
        self.user.save()

        for amenity in self.BASE_AMENITIES:
            house.amenities.add(amenity)

        for facility in self.BASE_FACILITIES:
            house.facilities.add(facility)

        for disable_day in self.BASE_DISABLE_DAYS:
            date_instance, created = HouseDisableDay.objects.get_or_create(
                date=disable_day)
            house.disable_days.add(date_instance)

        self.token, _ = Token.objects.get_or_create(user=self.user)
        self.client.credentials(HTTP_AUTHORIZATION='Token ' + self.token.key, )
        self.assertTrue(
            upload_file_cmp(file_path=house_image1_path,
                            img_name=house.images.first().image.name))
        self.assertTrue(
            upload_file_cmp(file_path=house_image2_path,
                            img_name=house.images.last().image.name))
示例#2
0
    def test_update_house(self):
        file_path = os.path.join(settings.STATIC_DIR,
                                 'img_profile_default.png')
        house_image1_path = os.path.join(settings.STATIC_DIR, 'iu.jpg')
        house_image2_path = os.path.join(settings.STATIC_DIR, 'suzi.jpg')
        img_cover = open(file_path, 'rb')
        house_image1 = open(house_image1_path, 'rb')
        house_image2 = open(house_image2_path, 'rb')

        self.UPDATE_DATA['img_cover'] = img_cover
        self.UPDATE_DATA['house_images'] = [house_image1, house_image2]

        response = self.client.put(self.URL + f'{self.HOUSE_PK}/',
                                   self.UPDATE_DATA)

        img_cover.close()
        house_image1.close()
        house_image2.close()

        self.assertEqual(response.status_code, status.HTTP_200_OK)

        self.assertEqual(response.data['house_type'],
                         self.UPDATE_DATA['house_type'])
        self.assertEqual(response.data['name'], self.UPDATE_DATA['name'])
        self.assertEqual(response.data['description'],
                         self.UPDATE_DATA['description'])
        self.assertEqual(response.data['room'], self.UPDATE_DATA['room'])
        self.assertEqual(response.data['bed'], self.UPDATE_DATA['bed'])
        self.assertEqual(response.data['bathroom'],
                         self.UPDATE_DATA['bathroom'])
        self.assertEqual(response.data['personnel'],
                         self.UPDATE_DATA['personnel'])
        self.assertEqual(response.data['amenities'],
                         self.UPDATE_DATA['amenities'])
        self.assertEqual(response.data['facilities'],
                         self.UPDATE_DATA['facilities'])
        self.assertEqual(response.data['minimum_check_in_duration'],
                         self.UPDATE_DATA['minimum_check_in_duration'])
        self.assertEqual(response.data['maximum_check_in_duration'],
                         self.UPDATE_DATA['maximum_check_in_duration'])
        self.assertEqual(response.data['maximum_check_in_range'],
                         self.UPDATE_DATA['maximum_check_in_range'])
        self.assertEqual(response.data['price_per_night'],
                         self.UPDATE_DATA['price_per_night'])
        self.assertEqual(response.data['created_date'],
                         datetime.date.today().strftime('%Y-%m-%d'))
        self.assertEqual(response.data['modified_date'],
                         datetime.date.today().strftime('%Y-%m-%d'))
        self.assertEqual(response.data['host']['pk'], self.user.pk)
        self.assertEqual(response.data['country'], self.UPDATE_DATA['country'])
        self.assertEqual(response.data['city'], self.UPDATE_DATA['city'])
        self.assertEqual(response.data['district'],
                         self.UPDATE_DATA['district'])
        self.assertEqual(response.data['dong'], self.UPDATE_DATA['dong'])
        self.assertEqual(response.data['address1'],
                         self.UPDATE_DATA['address1'])
        # self.assertEqual(response.data['address2'], self.UPDATE_DATA['address2'])
        self.assertEqual(response.data['latitude'],
                         self.UPDATE_DATA['latitude'])
        self.assertEqual(response.data['longitude'],
                         self.UPDATE_DATA['longitude'])

        self.assertIn('disable_days', response.data)
        for index, date in enumerate(response.data['disable_days']):
            self.assertEqual(date.strftime('%Y-%m-%d'),
                             self.UPDATE_DISABLE_DAYS[index])

        self.assertIn('house_images', response.data)

        house = House.objects.get(pk=response.data['pk'])
        self.assertEqual(house.house_type, self.UPDATE_DATA['house_type'])
        self.assertEqual(house.name, self.UPDATE_DATA['name'])
        self.assertEqual(house.description, self.UPDATE_DATA['description'])
        self.assertEqual(house.room, self.UPDATE_DATA['room'])
        self.assertEqual(house.bed, self.UPDATE_DATA['bed'])
        self.assertEqual(house.bathroom, self.UPDATE_DATA['bathroom'])
        self.assertEqual(house.personnel, self.UPDATE_DATA['personnel'])
        self.assertEqual(list(house.amenities.values_list('pk', flat=True)),
                         self.UPDATE_DATA['amenities'])
        self.assertEqual(list(house.facilities.values_list('pk', flat=True)),
                         self.UPDATE_DATA['facilities'])
        self.assertEqual(house.minimum_check_in_duration,
                         self.UPDATE_DATA['minimum_check_in_duration'])
        self.assertEqual(house.maximum_check_in_duration,
                         self.UPDATE_DATA['maximum_check_in_duration'])
        self.assertEqual(house.maximum_check_in_range,
                         self.UPDATE_DATA['maximum_check_in_range'])
        self.assertEqual(house.price_per_night,
                         self.UPDATE_DATA['price_per_night'])
        self.assertEqual(house.created_date, datetime.date.today())
        self.assertEqual(house.modified_date, datetime.date.today())
        self.assertEqual(house.host.pk, self.user.pk)
        self.assertEqual(house.host.is_host, True)
        self.assertEqual(house.country, self.UPDATE_DATA['country'])
        self.assertEqual(house.city, self.UPDATE_DATA['city'])
        self.assertEqual(house.district, self.UPDATE_DATA['district'])
        self.assertEqual(house.dong, self.UPDATE_DATA['dong'])
        self.assertEqual(house.address1, self.UPDATE_DATA['address1'])
        # self.assertEqual(house.address2, self.UPDATE_DATA['address2'])
        self.assertEqual(house.latitude, Decimal(self.UPDATE_DATA['latitude']))
        self.assertEqual(house.longitude,
                         Decimal(self.UPDATE_DATA['longitude']))

        self.assertEqual(house.disable_days.count(),
                         len(self.UPDATE_DISABLE_DAYS))
        disable_day_list = list(
            house.disable_days.values_list('date', flat=True))
        for index, date in enumerate(disable_day_list):
            self.assertEqual(date.strftime('%Y-%m-%d'),
                             self.UPDATE_DISABLE_DAYS[index])

        self.assertTrue(
            upload_file_cmp(file_path=file_path,
                            img_name=house.img_cover.name))
        self.assertTrue(
            upload_file_cmp(file_path=house_image1_path,
                            img_name=house.images.first().image.name))
        self.assertTrue(
            upload_file_cmp(file_path=house_image2_path,
                            img_name=house.images.last().image.name))

        clear_imagekit_test_files()
示例#3
0
    def test_retrieve_house(self):
        response = self.client.get(self.URL + f'{self.HOUSE_PK}/')
        self.assertEqual(response.status_code, status.HTTP_200_OK)

        self.assertEqual(response.data['pk'], self.HOUSE_PK)
        self.assertEqual(response.data['house_type'], self.DATA['house_type'])
        self.assertEqual(response.data['name'], self.DATA['name'])
        self.assertEqual(response.data['description'], self.DATA['description'])
        self.assertEqual(response.data['room'], self.DATA['room'])
        self.assertEqual(response.data['bed'], self.DATA['bed'])
        self.assertEqual(response.data['bathroom'], self.DATA['bathroom'])
        self.assertEqual(response.data['personnel'], self.DATA['personnel'])
        self.assertEqual(response.data['amenities'], self.AMENITIES)
        self.assertEqual(response.data['facilities'], self.FACILITIES)
        self.assertEqual(response.data['minimum_check_in_duration'], self.DATA['minimum_check_in_duration'])
        self.assertEqual(response.data['maximum_check_in_duration'], self.DATA['maximum_check_in_duration'])
        self.assertEqual(response.data['maximum_check_in_range'], self.DATA['maximum_check_in_range'])
        self.assertEqual(response.data['price_per_night'], self.DATA['price_per_night'])
        self.assertEqual(response.data['created_date'], datetime.date.today().strftime('%Y-%m-%d'))
        self.assertEqual(response.data['modified_date'], datetime.date.today().strftime('%Y-%m-%d'))
        self.assertEqual(response.data.get('host').get('pk'),
                         self.user1.pk if (self.HOUSE_PK - 1) % 2 else self.user2.pk)
        self.assertEqual(response.data['country'], self.DATA['country'])
        self.assertEqual(response.data['city'], self.DATA['city'])
        self.assertEqual(response.data['district'], self.DATA['district'])
        self.assertEqual(response.data['dong'], self.DATA['dong'])
        self.assertEqual(response.data['address1'], self.DATA['address1'])
        # self.assertEqual(response.data['address2'], self.DATA['address2'])
        self.assertEqual(response.data['latitude'], self.DATA['latitude'])
        self.assertEqual(response.data['longitude'], self.DATA['longitude'])

        self.assertIn('disable_days', response.data)
        for index, date in enumerate(response.data['disable_days']):
            self.assertEqual(date.strftime('%Y-%m-%d'), self.DISABLE_DAYS[index])

        self.assertIn('house_images', response.data)

        house = House.objects.get(pk=response.data['pk'])
        self.assertEqual(house.pk, self.HOUSE_PK)
        self.assertEqual(house.house_type, self.DATA['house_type'])
        self.assertEqual(house.name, self.DATA['name'])
        self.assertEqual(house.description, self.DATA['description'])
        self.assertEqual(house.room, self.DATA['room'])
        self.assertEqual(house.bed, self.DATA['bed'])
        self.assertEqual(house.bathroom, self.DATA['bathroom'])
        self.assertEqual(house.personnel, self.DATA['personnel'])
        self.assertEqual(list(house.amenities.values_list('pk', flat=True)), self.AMENITIES)
        self.assertEqual(list(house.facilities.values_list('pk', flat=True)), self.FACILITIES)
        self.assertEqual(house.minimum_check_in_duration, self.DATA['minimum_check_in_duration'])
        self.assertEqual(house.maximum_check_in_duration, self.DATA['maximum_check_in_duration'])
        self.assertEqual(house.maximum_check_in_range, self.DATA['maximum_check_in_range'])
        self.assertEqual(house.price_per_night, self.DATA['price_per_night'])
        self.assertEqual(house.created_date, datetime.date.today())
        self.assertEqual(house.modified_date, datetime.date.today())
        self.assertEqual(house.host.pk,
                         self.user1.pk if (self.HOUSE_PK - 1) % 2 else self.user2.pk)
        self.assertEqual(house.country, self.DATA['country'])
        self.assertEqual(house.city, self.DATA['city'])
        self.assertEqual(house.district, self.DATA['district'])
        self.assertEqual(house.dong, self.DATA['dong'])
        self.assertEqual(house.address1, self.DATA['address1'])
        # self.assertEqual(house.address2, self.DATA['address2'])
        self.assertEqual(house.latitude, Decimal(self.DATA['latitude']))
        self.assertEqual(house.longitude, Decimal(self.DATA['longitude']))

        self.assertEqual(house.disable_days.count(), len(self.DISABLE_DAYS))
        disable_day_list = list(house.disable_days.values_list('date', flat=True))
        for index, date in enumerate(disable_day_list):
            self.assertEqual(date.strftime('%Y-%m-%d'), self.DISABLE_DAYS[index])

        self.assertTrue(upload_file_cmp(file_path=self.file_path, img_name=house.img_cover.name))
        self.assertTrue(upload_file_cmp(file_path=self.house_image1_path, img_name=house.images.first().image.name))
        self.assertTrue(upload_file_cmp(file_path=self.house_image2_path, img_name=house.images.last().image.name))

        clear_imagekit_test_files()
示例#4
0
    def test_list_house(self):
        page_num = math.ceil(self.HOUSE_COUNT / self.PAGE_SIZE)

        for i in range(int(page_num)):
            response = self.client.get(self.URL, {
                'page': i + 1,
                'page_size': self.PAGE_SIZE
            })
            self.assertEqual(response.status_code, status.HTTP_200_OK)

            self.assertIsNotNone(response.data['count'], 'count')
            self.assertEqual(response.data['count'], self.HOUSE_COUNT)

            if i < page_num - 1:
                self.assertIsNotNone(response.data['next'], 'next')
            if i > 0:
                self.assertIsNotNone(response.data['previous'], 'previous')

            results = response.data['results']

            for j in range(len(results)):
                house_result = results[j]
                self.assertEqual(house_result['pk'],
                                 ((i * self.PAGE_SIZE) + j) + 1)
                self.assertEqual(house_result['house_type'],
                                 self.DATA['house_type'])
                self.assertEqual(house_result['name'], self.DATA['name'])
                self.assertEqual(house_result['description'],
                                 self.DATA['description'])
                self.assertEqual(house_result['room'], self.DATA['room'])
                self.assertEqual(house_result['bed'], self.DATA['bed'])
                self.assertEqual(house_result['bathroom'],
                                 self.DATA['bathroom'])
                self.assertEqual(house_result['personnel'],
                                 self.DATA['personnel'])
                self.assertEqual(house_result['amenities'], self.AMENITIES)
                self.assertEqual(house_result['facilities'], self.FACILITIES)
                self.assertEqual(house_result['minimum_check_in_duration'],
                                 self.DATA['minimum_check_in_duration'])
                self.assertEqual(house_result['maximum_check_in_duration'],
                                 self.DATA['maximum_check_in_duration'])
                self.assertEqual(house_result['maximum_check_in_range'],
                                 self.DATA['maximum_check_in_range'])
                self.assertEqual(house_result['price_per_night'],
                                 self.DATA['price_per_night'])
                self.assertEqual(house_result['created_date'],
                                 datetime.date.today().strftime('%Y-%m-%d'))
                self.assertEqual(house_result['modified_date'],
                                 datetime.date.today().strftime('%Y-%m-%d'))
                self.assertEqual(
                    house_result.get('host').get('pk'), self.user1.pk if
                    ((i * self.PAGE_SIZE) + j) % 2 else self.user2.pk)
                self.assertEqual(house_result['country'], self.DATA['country'])
                self.assertEqual(house_result['city'], self.DATA['city'])
                self.assertEqual(house_result['district'],
                                 self.DATA['district'])
                self.assertEqual(house_result['dong'], self.DATA['dong'])
                self.assertEqual(house_result['address1'],
                                 self.DATA['address1'])
                self.assertEqual(
                    house_result['latitude'], self.BASE_GPS['latitude'] if i +
                    j == 0 else self.DATA['latitude'])
                self.assertEqual(
                    house_result['longitude'],
                    self.BASE_GPS['longitude'] if i +
                    j == 0 else self.DATA['longitude'])

                self.assertIn('disable_days', house_result)

                for index, date in enumerate(house_result['disable_days']):
                    self.assertEqual(date.strftime('%Y-%m-%d'),
                                     self.DISABLE_DAYS[index])

                self.assertIn('house_images', house_result)

                house = House.objects.get(pk=house_result['pk'])
                self.assertEqual(house.pk, ((i * self.PAGE_SIZE) + j) + 1)
                self.assertEqual(house.house_type, self.DATA['house_type'])
                self.assertEqual(house.name, self.DATA['name'])
                self.assertEqual(house.description, self.DATA['description'])
                self.assertEqual(house.room, self.DATA['room'])
                self.assertEqual(house.bed, self.DATA['bed'])
                self.assertEqual(house.bathroom, self.DATA['bathroom'])
                self.assertEqual(house.personnel, self.DATA['personnel'])
                self.assertEqual(
                    list(house.amenities.values_list('pk', flat=True)),
                    self.AMENITIES)
                self.assertEqual(
                    list(house.facilities.values_list('pk', flat=True)),
                    self.FACILITIES)
                self.assertEqual(house.minimum_check_in_duration,
                                 self.DATA['minimum_check_in_duration'])
                self.assertEqual(house.maximum_check_in_duration,
                                 self.DATA['maximum_check_in_duration'])
                self.assertEqual(house.maximum_check_in_range,
                                 self.DATA['maximum_check_in_range'])
                self.assertEqual(house.price_per_night,
                                 self.DATA['price_per_night'])
                self.assertEqual(house.created_date, datetime.date.today())
                self.assertEqual(house.modified_date, datetime.date.today())
                self.assertEqual(
                    house.host.pk, self.user1.pk if
                    ((i * self.PAGE_SIZE) + j) % 2 else self.user2.pk)
                self.assertEqual(house.country, self.DATA['country'])
                self.assertEqual(house.city, self.DATA['city'])
                self.assertEqual(house.district, self.DATA['district'])
                self.assertEqual(house.dong, self.DATA['dong'])
                self.assertEqual(house.address1, self.DATA['address1'])
                # self.assertEqual(house.address2, self.DATA['address2'])
                self.assertEqual(
                    house.latitude,
                    Decimal(self.BASE_GPS['latitude']) if i +
                    j == 0 else Decimal(self.DATA['latitude']))
                self.assertEqual(
                    house.longitude,
                    Decimal(self.BASE_GPS['longitude']) if i +
                    j == 0 else Decimal(self.DATA['longitude']))

                self.assertEqual(house.disable_days.count(),
                                 len(self.DISABLE_DAYS))
                disable_day_list = list(
                    house.disable_days.values_list('date', flat=True))
                for index, date in enumerate(disable_day_list):
                    self.assertEqual(date.strftime('%Y-%m-%d'),
                                     self.DISABLE_DAYS[index])

                self.assertTrue(
                    upload_file_cmp(file_path=self.file_path,
                                    img_name=house.img_cover.name))
                self.assertTrue(
                    upload_file_cmp(file_path=self.house_image1_path,
                                    img_name=house.images.first().image.name))
                self.assertTrue(
                    upload_file_cmp(file_path=self.house_image2_path,
                                    img_name=house.images.last().image.name))

        clear_imagekit_test_files()
示例#5
0
    def test_create_house(self):
        self.client.credentials(HTTP_AUTHORIZATION='Token ' + self.token.key, )
        file_path = os.path.join(settings.STATIC_DIR, 'iu.jpg')
        img_cover = open(file_path, 'rb')

        house_image1_path = os.path.join(settings.STATIC_DIR, 'test',
                                         'test_inner_image.jpg')
        house_image2_path = os.path.join(settings.STATIC_DIR, 'test',
                                         'test_outer_image.jpg')

        house_image1 = open(house_image1_path, 'rb')
        house_image2 = open(house_image2_path, 'rb')
        print(img_cover)
        print(type(img_cover))
        print(type(house_image1))
        print(type(house_image2))

        amenities_list = ['TV', '에어컨', '전자렌지', '커피포트', '컴퓨터', '공기청정기']
        facilities_list = ['수영장', '엘리베이터', '세탁소', '노래방', '오락실', '온천']

        [Amenities.objects.create(name=name) for name in amenities_list]
        [Facilities.objects.create(name=name) for name in facilities_list]

        data = {
            'house_type':
            House.HOUSE_TYPE_HOUSING,
            'name':
            '우리집',
            'description':
            '테스트용 집입니다.',
            'room':
            1,
            'bed':
            2,
            'bathroom':
            2,
            'personnel':
            3,
            'amenities': [],
            'facilities': [1, 2, 3, 4, 5],
            'minimum_check_in_duration':
            1,
            'maximum_check_in_duration':
            3,
            'maximum_check_in_range':
            90,
            'price_per_night':
            100000,
            'country':
            '대한민국',
            'city':
            '사랑시',
            'district':
            '고백구',
            'dong':
            '행복동',
            'address1':
            '777-1',
            # 'address2': '희망빌라 2동 301호',
            'latitude':
            '12.12345670000000',
            'longitude':
            '123.12345670000000',
            'disable_days': [
                '2014-01-01',
                '2014-02-01',
                '2014-03-01',
                '2014-04-01',
            ],
            'img_cover':
            img_cover,
            'house_images': [
                house_image1,
                house_image2,
            ],
        }

        response = self.client.post(self.URL, data)
        img_cover.close()
        house_image1.close()
        house_image2.close()

        self.assertEqual(response.status_code, status.HTTP_201_CREATED)

        self.assertEqual(response.data['house_type'], data['house_type'])
        self.assertEqual(response.data['name'], data['name'])
        self.assertEqual(response.data['description'], data['description'])
        self.assertEqual(response.data['room'], data['room'])
        self.assertEqual(response.data['bed'], data['bed'])
        self.assertEqual(response.data['bathroom'], data['bathroom'])
        self.assertEqual(response.data['personnel'], data['personnel'])
        self.assertEqual(response.data['amenities'], data['amenities'])
        self.assertEqual(response.data['facilities'], data['facilities'])
        self.assertEqual(response.data['minimum_check_in_duration'],
                         data['minimum_check_in_duration'])
        self.assertEqual(response.data['maximum_check_in_duration'],
                         data['maximum_check_in_duration'])
        self.assertEqual(response.data['maximum_check_in_range'],
                         data['maximum_check_in_range'])
        self.assertEqual(response.data['price_per_night'],
                         data['price_per_night'])
        self.assertEqual(response.data['created_date'],
                         datetime.date.today().strftime('%Y-%m-%d'))
        self.assertEqual(response.data['modified_date'],
                         datetime.date.today().strftime('%Y-%m-%d'))
        self.assertEqual(response.data['host']['pk'], self.user.pk)
        self.assertEqual(response.data['country'], data['country'])
        self.assertEqual(response.data['city'], data['city'])
        self.assertEqual(response.data['district'], data['district'])
        self.assertEqual(response.data['dong'], data['dong'])
        self.assertEqual(response.data['address1'], data['address1'])
        # self.assertEqual(response.data['address2'], data['address2'])
        self.assertEqual(response.data['latitude'], data['latitude'])
        self.assertEqual(response.data['longitude'], data['longitude'])

        self.assertIn('disable_days', response.data)

        for index, date in enumerate(response.data['disable_days']):
            self.assertEqual(date.strftime('%Y-%m-%d'),
                             data['disable_days'][index])

        house = House.objects.get(pk=response.data['pk'])

        self.assertIn('house_images', response.data)

        self.assertEqual(house.house_type, data['house_type'])
        self.assertEqual(house.name, data['name'])
        self.assertEqual(house.description, data['description'])
        self.assertEqual(house.room, data['room'])
        self.assertEqual(house.bed, data['bed'])
        self.assertEqual(house.bathroom, data['bathroom'])
        self.assertEqual(house.personnel, data['personnel'])
        self.assertEqual(list(house.amenities.values_list('pk', flat=True)),
                         data['amenities'])
        self.assertEqual(list(house.facilities.values_list('pk', flat=True)),
                         data['facilities'])
        self.assertEqual(house.minimum_check_in_duration,
                         data['minimum_check_in_duration'])
        self.assertEqual(house.maximum_check_in_duration,
                         data['maximum_check_in_duration'])
        self.assertEqual(house.maximum_check_in_range,
                         data['maximum_check_in_range'])
        self.assertEqual(house.price_per_night, data['price_per_night'])
        self.assertEqual(house.created_date, datetime.date.today())
        self.assertEqual(house.modified_date, datetime.date.today())
        self.assertEqual(house.host.pk, self.user.pk)
        self.assertEqual(house.host.is_host, True)
        self.assertEqual(house.country, data['country'])
        self.assertEqual(house.city, data['city'])
        self.assertEqual(house.district, data['district'])
        self.assertEqual(house.dong, data['dong'])
        self.assertEqual(house.address1, data['address1'])
        # self.assertEqual(house.address2, data['address2'])
        self.assertEqual(house.latitude, Decimal(data['latitude']))
        self.assertEqual(house.longitude, Decimal(data['longitude']))

        self.assertEqual(house.disable_days.count(), len(data['disable_days']))
        disable_day_list = list(
            house.disable_days.values_list('date', flat=True))
        for index, date in enumerate(disable_day_list):
            self.assertEqual(date.strftime('%Y-%m-%d'),
                             data['disable_days'][index])

        self.assertTrue(
            upload_file_cmp(file_path=file_path,
                            img_name=house.img_cover.name))
        self.assertTrue(
            upload_file_cmp(file_path=house_image1_path,
                            img_name=house.images.first().image.name))
        self.assertTrue(
            upload_file_cmp(file_path=house_image2_path,
                            img_name=house.images.last().image.name))

        clear_imagekit_test_files()