def test_filter_issues_by_status_order(self):
    self.client.force_authenticate(user=get_user_model().objects.get(username='admin_user'))
    url = reverse('usergroups-list')
    data = {'type': UserGroupType.OWNER, 'appId': 6}
    response = self.client.get(url, data, format='json')
    group_id = response.data['data']['results'][0]['id']
    url = reverse('usergroupmems-list', kwargs={'group_id': group_id})
    data = {'account': 'app_owner_user'}
    self.client.post(url, data, format='json')
    self.client.force_authenticate(user=get_user_model().objects.get(username='app_owner_user'))
    response = self.client.get(reverse('issues-list'), {'statusNameOrder': '关闭,处理中,待处理,挂起,验证', 'appId': 6})
    expect_order = ['关闭', '处理中', '待处理', '挂起', '验证']
    real_order = OrderedDict.fromkeys([item['statusName'] for item in response.data['data']['results']]).keys()
    self.assertEqual(expect_order, list(real_order))
    response = self.client.get(reverse('issues-list'), {'statusNameOrder': '挂起,验证,关闭,处理中,待处理', 'appId': 6})
    expect_order = ['挂起', '验证', '关闭', '处理中', '待处理']
    real_order = OrderedDict.fromkeys([item['statusName'] for item in response.data['data']['results']]).keys()
    self.assertEqual(expect_order, list(real_order))
def test_filter_issues_by_status_order(self):
    self.client.force_authenticate(user=get_user_model().objects.get(username='admin_user'))
    url = reverse('usergroups-list')
    data = {'type': UserGroupType.OWNER, 'appId': 6}
    response = self.client.get(url, data, format='json')
    group_id = response.data['data']['results'][0]['id']
    url = reverse('usergroupmems-list', kwargs={'group_id': group_id})
    data = {'account': 'app_owner_user'}
    self.client.post(url, data, format='json')
    self.client.force_authenticate(user=get_user_model().objects.get(username='app_owner_user'))
    response = self.client.get(reverse('issues-list'), {'statusNameOrder': '关闭,处理中,待处理,挂起,验证', 'appId': 6})
    expect_order = ['关闭', '处理中', '待处理', '挂起', '验证']
    real_order = OrderedDict.fromkeys([item['statusName'] for item in response.data['data']['results']]).keys()
    self.assertEqual(expect_order, list(real_order))
    response = self.client.get(reverse('issues-list'), {'statusNameOrder': '挂起,验证,关闭,处理中,待处理', 'appId': 6})
    expect_order = ['挂起', '验证', '关闭', '处理中', '待处理']
    real_order = OrderedDict.fromkeys([item['statusName'] for item in response.data['data']['results']]).keys()
    self.assertEqual(expect_order, list(real_order))