def test_filter_issues_with_extended_fields(self):
    self.client.force_authenticate(user=get_user_model().objects.get(username='app_owner_user'))
    url = reverse('issueextfields-list', kwargs={'task_id': 1})
    self.client.post(url, {'name': '广场', 'isOptional': False})
    self.client.post(url, {'name': '手机型号', 'default': 'iPhone', 'type': 'string'})
    self.client.post(reverse('issues-list'), {'priority': '紧急', 'appId': 1, 'taskId': 1, 'statusId': 1, 'title': 'aaaa', 'detail': 'bbbb', 'extFields': {'广场': '通州万达', '手机型号': '华为'}}, format='json')
    self.client.post(reverse('issues-list'), {'priority': '紧急', 'appId': 1, 'taskId': 1, 'statusId': 1, 'title': 'aaaa', 'detail': 'bbbb', 'extFields': {'广场': '通州万达', '手机型号': '苹果'}}, format='json')
    self.client.post(reverse('issues-list'), {'priority': '紧急', 'appId': 1, 'taskId': 1, 'statusId': 1, 'title': 'aaaa', 'detail': 'bbbb', 'extFields': {'广场': '大望路万达', '手机型号': '华为'}}, format='json')
    url = reverse('issues-list')
    data = {'广场': '大望路万达', 'appId': 1}
    response = self.client.get(url, data, format='json')
    self.assertEqual(response.data['data']['total'], 1)
    data = {'广场': '大望路万达', 'appId': 6}
    response = self.client.get(url, data, format='json')
    self.assertEqual(response.data['data']['total'], 0)
    data = {'广场': '通州万达', 'appId': 1}
    response = self.client.get(url, data, format='json')
    self.assertEqual(response.data['data']['total'], 2)
    data = {'手机型号': '华为', 'appId': 1, 'taskId': 1}
    response = self.client.get(url, data, format='json')
    self.assertEqual(response.data['data']['total'], 2)
    data = {'手机型号': '华为', '广场': '通州万达', 'appId': 1, 'taskId': 1}
    response = self.client.get(url, data, format='json')
    self.assertEqual(response.data['data']['total'], 1)
    data = {'手机型号': '华为', '广场': '大望路万达'}
    response = self.client.get(url, data, format='json')
    self.assertEqual(response.data['data']['total'], 1)
    data = {'手机型号': '苹果', '广场': '大望路万达'}
    response = self.client.get(url, data, format='json')
    self.assertEqual(response.data['data']['total'], 0)
    data = {'广场': '大望路万达'}
    response = self.client.get(url, data, format='json')
    self.assertEqual(response.data['data']['total'], 1)
    data = {'手机型号': '华为'}
    response = self.client.get(url, data, format='json')
    self.assertEqual(response.data['data']['total'], 2)
    data = {'广场': '通州万达'}
    response = self.client.get(url, data, format='json')
    self.assertEqual(response.data['data']['total'], 2)
    data = {'广场': '通州万达', 'pageSize': 1}
    response = self.client.get(url, data, format='json')
    self.assertEqual(response.data['data']['total'], 2)
    data = {'广场': '通州万达', 'pageSize': 1, 'page': 2}
    response = self.client.get(url, data, format='json')
    self.assertEqual(response.data['data']['total'], 2)
def test_filter_issues_with_extended_fields(self):
    self.client.force_authenticate(user=get_user_model().objects.get(username='app_owner_user'))
    url = reverse('issueextfields-list', kwargs={'task_id': 1})
    self.client.post(url, {'name': '广场', 'isOptional': False})
    self.client.post(url, {'name': '手机型号', 'default': 'iPhone', 'type': 'string'})
    self.client.post(reverse('issues-list'), {'priority': '紧急', 'appId': 1, 'taskId': 1, 'statusId': 1, 'title': 'aaaa', 'detail': 'bbbb', 'extFields': {'广场': '通州万达', '手机型号': '华为'}}, format='json')
    self.client.post(reverse('issues-list'), {'priority': '紧急', 'appId': 1, 'taskId': 1, 'statusId': 1, 'title': 'aaaa', 'detail': 'bbbb', 'extFields': {'广场': '通州万达', '手机型号': '苹果'}}, format='json')
    self.client.post(reverse('issues-list'), {'priority': '紧急', 'appId': 1, 'taskId': 1, 'statusId': 1, 'title': 'aaaa', 'detail': 'bbbb', 'extFields': {'广场': '大望路万达', '手机型号': '华为'}}, format='json')
    url = reverse('issues-list')
    data = {'广场': '大望路万达', 'appId': 1}
    response = self.client.get(url, data, format='json')
    self.assertEqual(response.data['data']['total'], 1)
    data = {'广场': '大望路万达', 'appId': 6}
    response = self.client.get(url, data, format='json')
    self.assertEqual(response.data['data']['total'], 0)
    data = {'广场': '通州万达', 'appId': 1}
    response = self.client.get(url, data, format='json')
    self.assertEqual(response.data['data']['total'], 2)
    data = {'手机型号': '华为', 'appId': 1, 'taskId': 1}
    response = self.client.get(url, data, format='json')
    self.assertEqual(response.data['data']['total'], 2)
    data = {'手机型号': '华为', '广场': '通州万达', 'appId': 1, 'taskId': 1}
    response = self.client.get(url, data, format='json')
    self.assertEqual(response.data['data']['total'], 1)
    data = {'手机型号': '华为', '广场': '大望路万达'}
    response = self.client.get(url, data, format='json')
    self.assertEqual(response.data['data']['total'], 1)
    data = {'手机型号': '苹果', '广场': '大望路万达'}
    response = self.client.get(url, data, format='json')
    self.assertEqual(response.data['data']['total'], 0)
    data = {'广场': '大望路万达'}
    response = self.client.get(url, data, format='json')
    self.assertEqual(response.data['data']['total'], 1)
    data = {'手机型号': '华为'}
    response = self.client.get(url, data, format='json')
    self.assertEqual(response.data['data']['total'], 2)
    data = {'广场': '通州万达'}
    response = self.client.get(url, data, format='json')
    self.assertEqual(response.data['data']['total'], 2)
    data = {'广场': '通州万达', 'pageSize': 1}
    response = self.client.get(url, data, format='json')
    self.assertEqual(response.data['data']['total'], 2)
    data = {'广场': '通州万达', 'pageSize': 1, 'page': 2}
    response = self.client.get(url, data, format='json')
    self.assertEqual(response.data['data']['total'], 2)