def test_superuser_create_issue(client, office): user = UserFactory.create(is_superuser=True) payload = json.dumps(get_issue_serialized(office, user)) assert client.login(username=user.username, password=default_password) == True response = client.post('/issues/', payload, 'application/json') assert response.status_code == 201
def test_simple_user_partial_update_office(client, office): user = UserFactory.create() payload = json.dumps({'name': 'office 1'}) assert client.login(username=user.username, password=default_password) == True response = client.patch('/offices/{}/'.format(office.id), payload) assert response.status_code == 403
def test_superuser_partial_update_issue(client, issue): user = UserFactory(is_superuser=True) payload = json.dumps({'description': 'update'}) assert client.login(username=user.username, password=default_password) == True response = client.patch('/issues/{}/'.format(issue.id), payload, 'application/json') assert response.status_code == 200
def test_admin_update_issue(client, office, issue): user = UserFactory.create(is_staff=True) payload = json.dumps(get_issue_serialized(office, user)) assert client.login(username=user.username, password=default_password) == True response = client.put('/issues/{}/'.format(issue.id), payload, 'application/json') assert response.status_code == 200
def test_admin_partial_update_office(client, office): user = UserFactory.create(is_staff=True) payload = json.dumps({'name': 'office 1'}) assert client.login(username=user.username, password=default_password) == True response = client.patch('/offices/{}/'.format(office.id), payload, 'application/json') assert response.status_code == 200
def test_superuser_update_office(client, office): user = UserFactory.create(is_superuser=True) user_url = reverse('user-detail', args=[user.id]) payload = json.dumps({'name': 'office 1', 'manager': user_url}) assert client.login(username=user.username, password=default_password) == True response = client.put('/offices/{}/'.format(office.id), payload, 'application/json') assert response.status_code == 200
def test_superuser_cancel_issue(client, issue): user = UserFactory(is_superuser=True) assert client.login(username=user.username, password=default_password) == True response = client.get('/issues/{}/cancel/'.format(issue.id)) assert response.status_code == 200
def test_admin_finish_issue(client, issue): user = UserFactory(is_staff=True) assert client.login(username=user.username, password=default_password) == True response = client.get('/issues/{}/finish/'.format(issue.id)) assert response.status_code == 200
def test_simple_user_start_issue(client, issue): user = UserFactory() assert client.login(username=user.username, password=default_password) == True response = client.get('/issues/{}/start/'.format(issue.id)) assert response.status_code == 403
def test_superuser_destroy_issue(client, issue): user = UserFactory(is_superuser=True) assert client.login(username=user.username, password=default_password) == True response = client.delete('/issues/{}/'.format(issue.id)) assert response.status_code == 403
def test_superuser_list_issue(client, issue): user = UserFactory.create(is_superuser=True) assert client.login(username=user.username, password=default_password) == True response = client.get('/issues/') assert response.status_code == 200
def test_superuser_destroy_office(client, office): user = UserFactory.create(is_superuser=True) assert client.login(username=user.username, password=default_password) == True response = client.delete('/offices/{}/'.format(office.id)) assert response.status_code == 204