'Verify that the feature_edit_check view is behaving as expected'

def test_feature_edit_check(self):

    valid_layer_typename = Layer.objects.all()[0].alternate
    Layer.objects.all()[0].set_default_permissions()
    invalid_layer_typename = 'n0ch@nc3'
    response = self.client.post(reverse('feature_edit_check', args=(invalid_layer_typename,)))
    self.assertEquals(response.status_code, 404)
    response = self.client.post(reverse('feature_edit_check', args=(valid_layer_typename,)))
    response_json = json.loads(response.content)
    self.assertEquals(response_json['authorized'], False)
    logged_in = self.client.login(username='bobby', password='bob')
    self.assertEquals(logged_in, True)
    response = self.client.post(reverse('feature_edit_check', args=(valid_layer_typename,)))
    response_json = json.loads(response.content)
    self.assertEquals(response_json['authorized'], False)
    logged_in = self.client.login(username='admin', password='admin')
    self.assertEquals(logged_in, True)
    response = self.client.post(reverse('feature_edit_check', args=(valid_layer_typename,)))
    response_json = json.loads(response.content)
    self.assertEquals(response_json['authorized'], False)
    layer = Layer.objects.all()[0]
    layer.storeType = 'dataStore'
    layer.save()
    if settings.OGC_SERVER['default']['DATASTORE']:
        response = self.client.post(reverse('feature_edit_check', args=(valid_layer_typename,)))
        response_json = json.loads(response.content)
        self.assertEquals(response_json['authorized'], True)
