def setUp(self): self.admin = UserProfileFactory.create() self.admin.user.set_password('1234567') self.admin.make_as_admin() self.admin.save() self.user = UserProfileFactory.create() self.client = Client()
def setUp(self): self.admin = UserProfileFactory.create() self.admin.user.set_password('1234567') self.admin.make_as_admin() self.admin.save() self.client = Client() self.users = [UserProfileFactory.create() for x in range(5)] for user in self.users: user.make_as_academic_staff()
def setUp(self): self.user = UserProfileFactory.create() self.user.user.set_password('1234567') self.user.save() self.booking = BookingFactory.create(user=self.user.user) self.booking.save() self.client = Client()
def setUp(self): self.user = UserProfileFactory.create() self.user.user.set_password('1234567') self.user.save() self.semester = Settings() self.semester.start_semester = datetime.strptime("21092017", "%d%m%Y") self.semester.end_semester = datetime.strptime("22092018", "%d%m%Y") self.semester.save() self.client = Client() self.factory = RequestFactory() self.week_days = ['3', '5'] self.start_date = datetime.strptime("21092017", "%d%m%Y").date() self.end_date = datetime.strptime("22102017", "%d%m%Y").date() self.hour = datetime.strptime("08:00", "%H:%M").time() self.hour2 = datetime.strptime("10:00", "%H:%M").time() self.building_name = Building.objects.filter(name='UAC') self.place_name = Place.objects.filter(pk=3) self.parameters = { 'name': 'Reservaoiasd', 'start_hour': self.hour, 'end_hour': self.hour2, 'start_date': self.start_date, 'end_date': self.end_date, 'building': self.building_name[0].pk, 'place': self.place_name[0].pk, 'week_days': self.week_days, 'date_options': 'opt_select_date', 'tags': 'hello' }
def setUp(self): self.user = UserProfileFactory.create() self.user.user.set_password('1234567') self.user.save() self.booking = BookingFactory(user=self.user.user) print(self.booking) print(self.booking.time.all()) self.client = Client() self.id_booking = self.booking.id self.id_booktime = self.booking.time.all()[0].id
def setUp(self): self.booking = BookingFactory.create() self.booking.place.is_laboratory = True self.booking.save() self.factory = RequestFactory() self.userprofile = UserProfileFactory.create() self.userprofile.make_as_admin() self.userprofile.user.set_password('123456') self.userprofile.save() self.client = Client() self.username = self.userprofile.user.username
def test_responsible(self): username = self.user.user.username client = self.client self.user.make_as_admin() responsible_user = UserProfileFactory.create() self.parameters['date_options'] = 'opt_select_date' self.parameters['engineering_choice'] = '1' self.parameters['responsible'] = responsible_user.__str__() client.login(username=username, password='******') response = client.post('/booking/newbooking/', self.parameters) booking = Booking.objects.get(name=self.parameters['name']) self.assertEqual(booking.user.id, responsible_user.user.id)
def setUp(self): self.start_date = datetime.strptime("21092017", "%d%m%Y") self.end_date = datetime.strptime("22102017", "%d%m%Y") self.parameters = {'start_semester': "09/20/2017", 'end_semester': "09/24/2017"} self.user = UserProfileFactory.create() self.user.user.set_password('123456') self.user.make_as_admin() self.user.save() self.client = Client() self.factory = RequestFactory() self.settings = Settings()
def setUp(self): self.booking = BookingFactory.create() self.booking.place.is_laboratory = True self.booking.save() self.tag = Tag(name="teste") self.tag.save() self.tag2 = Tag(name="teste2") self.tag2.save() self.user = UserProfileFactory.create() self.user.user.set_password('1234567') self.user.save() self.client = Client() self.booking.tags.add(self.tag) self.booking.save()
def test_days_list(self): start_date = datetime.strptime("21092017", "%d%m%Y") end_date = datetime.strptime("22092017", "%d%m%Y") building_name = Building.objects.get(name='UAC') room_name = Place.objects.get(pk=9) user = UserProfileFactory.create() booking = BookingFactory.create(user=user.user, start_date=start_date, end_date=end_date) parameters = { 'search_options': 'opt_room_period', 'building_name': building_name, 'room_name': room_name, 'start_date': start_date, 'end_date': end_date } form = SearchBookingForm(data=parameters) form.is_valid() days = [] days.append(start_date.date()) days.append(end_date.date()) days2 = form.days_list() self.assertEqual(days, days2)
def test_is_academic_staff(self): userprofile = UserProfileFactory.create() self.assertFalse(userprofile.is_academic_staff()) userprofile.make_as_academic_staff() self.assertTrue(userprofile.is_academic_staff())
def test_is_admin(self): userprofile = UserProfileFactory.create() self.assertFalse(userprofile.is_admin()) userprofile.make_as_admin() self.assertTrue(userprofile.is_admin())
def user(self): userprofile = UserProfileFactory.create() return userprofile.user