from rest_framework import status
from billjobs.tests.generics import GenericAPIStatusCode

class GroupAPIAnonymousStatusCode(GenericAPIStatusCode):
    """
    Tests status code returned by /groups endpoint for anonymous user
    Permissions are tested in tests_api.py
    """

    def setUp(self):
        super().setUp()
        self.url = self.endpoints['groups']
        self.data = {'name': 'group name'}

    def test_api_group_put_is_405(self):
        """
        Test group api with PUT method return HTTP_405_METHOD_NOT_ALLOWED
        """
        super().status_code_is(
                'PUT', self.url, self.data, status.HTTP_405_METHOD_NOT_ALLOWED)

    def test_api_group_delete_is_405(self):
        """
        Test group api with DELETE method return HTTP_405_METHOD_NOT_ALLOWED
        """
        super().status_code_is(
                'DELETE', self.url, None, status.HTTP_405_METHOD_NOT_ALLOWED)


@@ -893,28 +893,378 @@
 TP_405_METHOD_NOT_ALLOWED)%0A%0A
+class GroupAPIUserStatusCode(GenericAPIStatusCode):%0A    %22%22%22%0A    Tests status code returned by /groups endpoint for user%0A    Permissions are tested in tests_api.py%0A    %22%22%22%0A%0A    def setUp(self):%0A        super().setUp()%0A        super().force_authenticate(self.user)%0A        self.url = self.endpoints%5B'groups'%5D%0A        self.data = %7B'name': 'group name'%7D%0A

add class to tests group api status code with logged user