Beispiel #1
0
    def test_get_admin_list(self):
        result = get_admin_list('character', current_user=self.admin)
        self.assertIn('info', result)
        self.assertIsInstance(result['info'], list)
        self.assertEqual(len(result['info']), 2)

        result = get_admin_list('inventory_type', current_user=self.admin)
        self.assertIn('info', result)
        self.assertIsInstance(result['info'], list)
        self.assertEqual(len(result['info']), 0)
Beispiel #2
0
 def test_add_admin_list_item(self):
     add_admin_list_item('character',
                         self.applicant_character.id,
                         current_user=self.admin)
     new_list = get_admin_list('character', current_user=self.admin)
     self.assertEqual(len(new_list['info']), 3)
     self.assertTrue(self.applicant_character.redlisted)
Beispiel #3
0
    def test_get_admin_list_forbidden(self):
        with self.assertRaises(ForbiddenException):
            get_admin_list('character', current_user=self.recruiter)

        with self.assertRaises(ForbiddenException):
            get_admin_list('character', current_user=self.senior_recruiter)

        with self.assertRaises(ForbiddenException):
            get_admin_list('character', current_user=self.senior_recruiter)

        with self.assertRaises(ForbiddenException):
            get_admin_list('character', current_user=self.applicant)
Beispiel #4
0
    def test_remove_admin_list_item(self):
        remove_admin_list_item('character',
                               self.redlisted_character_1.id,
                               current_user=self.admin)
        new_list = get_admin_list('character', current_user=self.admin)
        self.assertEqual(len(new_list['info']), 1)

        with self.assertRaises(BadRequestException):
            remove_admin_list_item('character',
                                   self.redlisted_character_1.id,
                                   current_user=self.admin)
Beispiel #5
0
 def test_admin_list_add_multi(self):
     new_items = [
         self.applicant_character.id, self.not_applicant_character.id
     ]
     put_admin_list('character',
                    new_items,
                    do_replace=False,
                    current_user=self.admin)
     new_list = get_admin_list('character', current_user=self.admin)
     self.assertEqual(len(new_list['info']), 4)
     self.assertTrue(self.applicant_character.redlisted)
     self.assertTrue(self.not_applicant_character.redlisted)
Beispiel #6
0
def api_get_admin_list(kind):
    """
    Gets a specified redlist.

    Args:
        kind (string)

    Returns
    (GET):
        response (array) of
        {
            id (int),
            name (string),
        }

    Error codes:
        Forbidden (403): If logged in user is not an admin
        BadRequest (400): If list type is not known
    """
    return jsonify(get_admin_list(kind, current_user=current_user))
Beispiel #7
0
 def test_add_new_region_to_admin_list(self):
     add_admin_list_item('region', 10000050, current_user=self.admin)
     new_list = get_admin_list('region', current_user=self.admin)
     self.assertEqual(len(new_list['info']), 1)
     self.assertTrue(Region.get(10000050).redlisted)