def setUp(self): # Create a user and log in. created_user = UserFactory.create( username='******', password=make_password('test-password'), nickname='test-nickname', gender='남자', birthday='1996-01-14') token_data = {'username': '******', 'password': '******'} response = self.client.post('/api/token/', token_data, format='json') access_token = response.data['access'] self.client.credentials(HTTP_AUTHORIZATION='Bearer ' + access_token) # Create 10 Clothes for current user populate_clothes(10) # Create 3 ClothesSets for current user created_clothes_set = populate_clothes_set(3) # Create 1 ClothesSetReviews for current user self.created_review = populate_clothes_set_review(1)[0] self.clothes_set = created_clothes_set[0].id self.start_datetime = str(datetime(1996, 1, 14, 12, 0)) self.start_datetime = 'T'.join(self.start_datetime.split(' ')) self.end_datetime = str(datetime(1996, 1, 14, 21, 0)) self.end_datetime = 'T'.join(self.end_datetime.split(' ')) self.location = 1 self.review = 3 self.comment = 'test-comment'
def setUp(self): # Create a user and log in. created_user = UserFactory.create( username='******', password=make_password('test-password'), nickname='test-nickname', gender='남자', birthday='1996-01-14') token_data = {'username': '******', 'password': '******'} response = self.client.post('/api/token/', token_data, format='json') access_token = response.data['access'] self.client.credentials(HTTP_AUTHORIZATION='Bearer ' + access_token) # Create 10 Clothes for current user. populate_clothes(10) # Create 3 Clothes Set for current user. created_clothes_set = populate_clothes_set(3) self.clothes_set = created_clothes_set[0].id self.start_datetime = str(datetime(1996, 1, 14, 12, 0)) self.start_datetime = 'T'.join(self.start_datetime.split(' ')) self.end_datetime = str(datetime(1996, 1, 14, 21, 0)) self.end_datetime = 'T'.join(self.end_datetime.split(' ')) self.location = 1 self.review = 3 self.comment = 'test-comment' # location_code, date, time, temp, sensible_temp, humidity, wind_speed, precipitation, x, y WeatherFactory.create(location_code=self.location, date='1996-01-14', time=14, temp=20, sensible_temp=20, humidity=30, wind_speed=1, precipitation=0, x=0, y=0) WeatherFactory.create(location_code=self.location, date='1996-01-14', time=17, temp=10, sensible_temp=10, humidity=50, wind_speed=3, precipitation=5, x=0, y=0)
def setUp(self): # Create a user and log in. created_user = UserFactory.create( username='******', password=make_password('test-password'), nickname='test-nickname', gender='남자', birthday='1996-01-14') token_data = {'username': '******', 'password': '******'} response = self.client.post('/api/token/', token_data, format='json') access_token = response.data['access'] self.client.credentials(HTTP_AUTHORIZATION='Bearer ' + access_token) # Create 10 Clothes for current user created_clothes = populate_clothes(10) # Create 3 ClothesSets for current user self.created_clothes_set = populate_clothes_set(3) self.clothes = [] for clothe in created_clothes: self.clothes.append(clothe.id) if len(self.clothes) == 5: break self.name = 'test-name' self.style = '화려' self.image_url = 'https://www.naver.com'
def setUp(self): # Create a user and log in. created_user = UserFactory.create( username='******', password=make_password('test-password'), nickname='test-nickname', gender='남자', birthday='1996-01-14') token_data = {'username': '******', 'password': '******'} response = self.client.post('/api/token/', token_data, format='json') access_token = response.data['access'] self.client.credentials(HTTP_AUTHORIZATION='Bearer ' + access_token) # Create 10 Clothes for current user created_clothes = populate_clothes(10) self.clothes = [] for clothe in created_clothes: self.clothes.append(clothe.id) if len(self.clothes) == 5: break self.name = 'test-name' self.style = '화려' with open("temp/sample_image.png", 'rb') as image: self.image = base64.b64encode(image.read())
def setUp(self): # Create a user and log in. created_user = UserFactory.create( username='******', password=make_password('test-password'), nickname='test-nickname', gender='남자', birthday='1996-01-14') token_data = {'username': '******', 'password': '******'} response = self.client.post('/api/token/', token_data, format='json') access_token = response.data['access'] self.client.credentials(HTTP_AUTHORIZATION='Bearer ' + access_token) # Create 10 Clothes for current user populate_clothes(10) # Create 1 ClothesSets for current user self.created_clothes_set = populate_clothes_set(1)[0]