Exemple #1
0
    def setUp(self):
        locations_testing.create_workshops_sections_and_cells()
        sows_testings.create_statuses()
        sows_events_testings.create_types()
        piglets_testing.create_piglets_statuses()
        staff_testings.create_svinbin_users()

        self.tour1 = Tour.objects.get_or_create_by_week_in_current_year(
            week_number=1)
        self.tour2 = Tour.objects.get_or_create_by_week_in_current_year(
            week_number=2)

        self.loc_ws1 = Location.objects.get(workshop__number=1)
        self.loc_ws3 = Location.objects.get(workshop__number=3)
        self.loc_ws5 = Location.objects.get(workshop__number=5)

        self.loc_ws3_cells = Location.objects.filter(
            sowAndPigletsCell__isnull=False)

        self.ops_dict = gen_operations_dict()

        operations = dict()
        for op_key in self.ops_dict.keys():
            operations[op_key] = False

        self.request_json = {
            'operations': operations,
            'filters': {
                'start_date': None,
                'end_date': None,
                'farm_id': None
            },
            'target': None
        }
Exemple #2
0
    def get(self, request, format=None):
        locations_testing.create_workshops_sections_and_cells()
        sows_testing.create_statuses()
        piglets_testing.create_piglets_statuses()
        staff_testing.create_svinbin_users()
        sows_testing.create_boars()
        sows_events_testing.create_types()

        return Response({'msg': 'success'})
Exemple #3
0
 def setUp(self):
     self.client = APIClient()
     locations_testing.create_workshops_sections_and_cells()
     sows_testing.create_statuses()
     sows_testing.create_boars()
     sows_events_testing.create_types()
     piglets_testing.create_piglets_statuses()
     staff_testing.create_svinbin_users()
     self.user = staff_testing.create_employee()
     self.brig3 = User.objects.get(username='******')
     self.tour1 = Tour.objects.get_or_create_by_week_in_current_year(1)
Exemple #4
0
    def setUp(self):
        self.client = APIClient()
        locations_testing.create_workshops_sections_and_cells()
        sows_testing.create_statuses()
        sows_testing.create_boars()
        staff_testing.create_svinbin_users()
        self.tour1 = Tour.objects.get_or_create_by_week_in_current_year(week_number=1)

        self.loc_ws1 = Location.objects.get(workshop__number=1)
        self.loc_ws2 = Location.objects.get(workshop__number=2)

        self.brig1 = User.objects.get(username='******')
        self.brig2 = User.objects.get(username='******')
        self.brig3 = User.objects.get(username='******')
Exemple #5
0
    def setUp(self):
        self.client = APIClient()
        locations_testing.create_workshops_sections_and_cells()
        sows_testing.create_statuses()
        sows_testing.create_boars()
        sows_events_testing.create_types()
        staff_testing.create_svinbin_users()
        self.boar = Boar.objects.all().first()
        self.user = staff_testing.create_employee() # is_seminator = True

        self.brig1 = User.objects.get(username='******')
        self.brig2 = User.objects.get(username='******')
        self.brig3 = User.objects.get(username='******')
        self.brig4 = User.objects.get(username='******')
        self.brig5 = User.objects.get(username='******')
Exemple #6
0
    def setUp(self):
        self.client = APIClient()
        locations_testing.create_workshops_sections_and_cells()
        sows_testing.create_statuses()
        piglets_testing.create_piglets_statuses()
        sows_events_testings.create_types()
        staff_testing.create_svinbin_users()

        self.tour1 = Tour.objects.get_or_create_by_week_in_current_year(week_number=1)
        self.tour2 = Tour.objects.get_or_create_by_week_in_current_year(week_number=2)
        self.tour3 = Tour.objects.get_or_create_by_week_in_current_year(week_number=3)
        self.tour4 = Tour.objects.get_or_create_by_week_in_current_year(week_number=4)

        self.loc_ws1 = Location.objects.get(workshop__number=1)
        self.loc_ws2 = Location.objects.get(workshop__number=2)

        self.loc_ws3 = Location.objects.get(workshop__number=3)
        self.loc_ws3_sec1 = Location.objects.get(section__workshop__number=3, section__number=1)
        self.loc_ws3_sec2 = Location.objects.get(section__workshop__number=3, section__number=2)

        self.loc_ws4 = Location.objects.get(workshop__number=4)
        self.loc_ws4_cell1 = Location.objects.filter(pigletsGroupCell__isnull=False)[0]
        self.loc_ws4_cell2 = Location.objects.filter(pigletsGroupCell__isnull=False)[1]

        self.loc_ws8 = Location.objects.get(workshop__number=8)

        self.loc_ws5 = Location.objects.get(workshop__number=5)
        self.loc_ws6 = Location.objects.get(workshop__number=6)
        self.loc_ws7 = Location.objects.get(workshop__number=7)

        # self.user = staff_testing.create_employee()
        # self.client.force_authenticate(user=self.user)

        self.brig1 = staff_testing.create_employee(workshop=self.loc_ws1.workshop)
        self.brig2 = staff_testing.create_employee(workshop=self.loc_ws2.workshop)
        self.brig3 = staff_testing.create_employee(workshop=self.loc_ws3.workshop)
        self.brig4 = staff_testing.create_employee(workshop=self.loc_ws4.workshop)
        self.brig5 = staff_testing.create_employee(workshop=self.loc_ws5.workshop)
        self.brig6 = staff_testing.create_employee(workshop=self.loc_ws6.workshop)
        self.brig7 = staff_testing.create_employee(workshop=self.loc_ws7.workshop)
        self.brig8 = staff_testing.create_employee(workshop=self.loc_ws8.workshop)

        self.admin = User.objects.get(username='******')
Exemple #7
0
    def setUp(self):
        locations_testing.create_workshops_sections_and_cells()
        sows_testing.create_statuses()
        sows_events_testings.create_types()
        piglets_testing.create_piglets_statuses()
        staff_testing.create_svinbin_users()
        self.client = APIClient()
        self.user = staff_testing.create_employee()
        self.brig1 = User.objects.get(username='******')
        self.brig2 = User.objects.get(username='******')
        self.brig3 = User.objects.get(username='******')
        self.brig4 = User.objects.get(username='******')
        self.brig5 = User.objects.get(username='******')

        self.loc_ws1 = Location.objects.get(workshop__number=1)
        self.loc_ws2 = Location.objects.get(workshop__number=2)

        self.loc_ws3 = Location.objects.get(workshop__number=3)
        self.loc_ws3_sec1 = Location.objects.get(section__workshop__number=3,
                                                 section__number=1)
        self.loc_ws3_sec2 = Location.objects.get(section__workshop__number=3,
                                                 section__number=2)
Exemple #8
0
    def setUp(self):
        self.client = APIClient()
        locations_testing.create_workshops_sections_and_cells()
        sows_testing.create_statuses()
        sows_testing.create_boars()
        sows_events_testing.create_types()
        piglets_testing.create_piglets_statuses()
        staff_testing.create_svinbin_users()
        self.user = staff_testing.create_employee()
        self.boar = Boar.objects.all().first()

        self.tour1 = Tour.objects.get_or_create_by_week_in_current_year(week_number=1)
        self.tour2 = Tour.objects.get_or_create_by_week_in_current_year(week_number=2)
        self.tour3 = Tour.objects.get_or_create_by_week_in_current_year(week_number=3)
        self.tour4 = Tour.objects.get_or_create_by_week_in_current_year(week_number=4)

        self.loc_ws1 = Location.objects.get(workshop__number=1)
        self.loc_ws2 = Location.objects.get(workshop__number=2)

        self.loc_ws3 = Location.objects.get(workshop__number=3)
        self.loc_ws3_sec1 = Location.objects.get(section__workshop__number=3, section__number=1)
        self.loc_ws3_sec2 = Location.objects.get(section__workshop__number=3, section__number=2)

        self.loc_ws4 = Location.objects.get(workshop__number=4)
        self.loc_ws4_cell1 = Location.objects.filter(pigletsGroupCell__isnull=False)[0]
        self.loc_ws4_cell2 = Location.objects.filter(pigletsGroupCell__isnull=False)[1]

        self.loc_ws8 = Location.objects.get(workshop__number=8)

        self.loc_ws5 = Location.objects.get(workshop__number=5)
        self.loc_ws6 = Location.objects.get(workshop__number=6)
        self.loc_ws7 = Location.objects.get(workshop__number=7)

        self.brig1 = User.objects.get(username='******')
        self.brig2 = User.objects.get(username='******')
        self.brig3 = User.objects.get(username='******')
        self.brig4 = User.objects.get(username='******')
        self.brig5 = User.objects.get(username='******')
Exemple #9
0
    def setUp(self):
        locations_testing.create_workshops_sections_and_cells()
        sows_testings.create_statuses()
        sows_events_testings.create_types()
        piglets_testing.create_piglets_statuses()
        staff_testings.create_svinbin_users()

        start_date = date(2020, 1, 1)
        end_date = timezone.now().date() + timedelta(1)
        ReportDate.objects.create_bulk_if_none_from_range(start_date, end_date)

        self.tour1 = Tour.objects.get_or_create_by_week_in_current_year(
            week_number=1)
        self.tour2 = Tour.objects.get_or_create_by_week_in_current_year(
            week_number=2)

        self.loc_ws1 = Location.objects.get(workshop__number=1)
        self.loc_ws3 = Location.objects.get(workshop__number=3)

        self.loc_ws3_cells = Location.objects.filter(
            sowAndPigletsCell__isnull=False)

        self.ops_dict = gen_operations_dict()
Exemple #10
0
 def setUp(self):
     locations_testing.create_workshops_sections_and_cells()
     sows_testing.create_statuses()
     sows_events_testings.create_types()
     piglets_testing.create_piglets_statuses()
     staff_testing.create_svinbin_users()