Ejemplo n.º 1
0
 def test_specification_view_get_all(self, mock_date):
     mock_date.return_value = self.date
     response = self.client.get('/hierarchy/specifications/')
     expected = SpecificationSerializer(self.query.order_by('-id'),
                                        many=True).data
     self.assertEqual(response.status_code, 200)
     self.assertEqual(len(response.data), len(expected))
Ejemplo n.º 2
0
 def test_specification_view_get_filter_active_false(self, mock_date):
     mock_date.return_value = self.date
     response = self.client.get('/hierarchy/specifications/?active=false')
     expected = SpecificationSerializer(self.query.filter(active=False),
                                        many=True).data
     self.assertEqual(response.status_code, 200)
     self.assertEqual(len(response.data), len(expected))
Ejemplo n.º 3
0
 def test_specification_view_get_filter_lotnumber_contains(self, mock_date):
     mock_date.return_value = self.date
     response = self.client.get('/hierarchy/specifications/?lotnumber=lot1')
     expected = SpecificationSerializer(
         self.query.filter(lotNumber__icontains='lot1'), many=True).data
     self.assertEqual(response.status_code, 200)
     self.assertEqual(len(response.data), len(expected))
Ejemplo n.º 4
0
 def test_specification_view_get_filter_machine_name(self, mock_date):
     mock_date.return_value = self.date
     response = self.client.get('/hierarchy/specifications/?machine=mch1')
     expected = SpecificationSerializer(
         self.query.filter(machine__name__iexact='mch1'), many=True).data
     self.assertEqual(response.status_code, 200)
     self.assertEqual(len(response.data), len(expected))
Ejemplo n.º 5
0
 def test_specification_view_get_filter_modify_date(self):
     response = self.client.get(
         '/hierarchy/specifications/?startdate=082516&enddate=090216')
     expected = SpecificationSerializer(
         self.query.filter(modified__range=(dt(2016, 8, 25),
                                            dt(2016, 9, 2))),
         many=True).data
     self.assertEqual(response.status_code, 200)
     self.assertEqual(len(response.data), len(expected))
Ejemplo n.º 6
0
 def test_specification_view_get_filter_department(self, mock_date):
     mock_date.return_value = self.date
     response = self.client.get(
         '/hierarchy/specifications/?department={}'.format(
             self.department.id))
     expected = SpecificationSerializer(
         self.query.filter(machine__department__id=self.department.id),
         many=True).data
     self.assertEqual(response.status_code, 200)
     self.assertEqual(len(response.data), len(expected))