Coder Social home page Coder Social logo

data-govt-nz / ckanext-protected_resources Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 2.0 53 KB

A plugin for CKAN that enables a system administrator to protect dataset resources from accidental deletion

License: GNU Affero General Public License v3.0

Shell 8.53% Python 80.07% HTML 11.41%

ckanext-protected_resources's People

Contributors

ebuckley avatar markstuart avatar niall-madecurious avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ckanext-protected_resources's Issues

Automated Testing

Currently we are testing this plugin as part of a larger selenium test suite used in another project. It makes sense for this project to own it's own unit tests.

Here are the automated feature tests we have currently.

@protected-resource
Feature: Sysadmins can mark resources as protected to avoid acidental deletion
  Background: There is a user with editor permissions in an organiation
    Given an Organisation "Ministry of Silly Walks"
    And a admin User "admin" "[email protected]"
    And a User "sfry" "[email protected]"
    And "sfry" has Admin Permission in Organisation "Ministry of Silly Walks"
    And A dataset with two resources
    
  @fixture.cleanup_datasets
  Scenario: As a sysadmin I can't delete a protected dataset
    Given A protected resource "abalone_data.csv" on the "Abalone data" dataset
    And I login with the user "admin"
    And I am on the Dataset Page for "Abalone Data"
    When I press "Manage"
    And I wait for "1" seconds
    Then I should see the text on the page "This dataset contains a protected resource"


  @fixture.cleanup_datasets
  Scenario: As a sysadmin I can delete a non-protected resource
    Given A protected resource "abalone_data.csv" on the "Abalone data" dataset
    And I login with the user "admin"
    And I am on the Dataset Page for "Abalone Data"
    And I press "data.json"
    And I wait for "1" seconds
    When I press "Manage"
    Then I should see
      """
      Delete
     """

  @fixture.cleanup_datasets
  Scenario: As an admin I can't delete a protected dataset
    Given A protected resource "abalone_data.csv" on the "Abalone data" dataset
    And I login with the user "sfry"
    And I am on the Dataset Page for "Abalone Data"
    When I press "Manage"
    And I wait for "1" seconds
    Then I should see the text on the page "This dataset contains a protected resource"

  @fixture.cleanup_datasets
  Scenario: As an admin I can't delete a protected dataset
    Given A protected resource "abalone_data.csv" on the "Abalone data" dataset
    And I login with the user "sfry"
    And I am on the Dataset Page for "Abalone Data"
    And I press "abalone_data.csv"
    And I wait for "1" seconds
    When I press "Manage"
    And I wait for "1" seconds
    Then I should see the text on the page "This resource is protected"

  @fixture.cleanup_datasets
  Scenario: As a sysadmin I can lock a non-protected resource
    Given I login with the user "admin"
    And I am on the Dataset Page for "Abalone Data"
    When I press "data.json"
    And I wait for "1" seconds
    Then I should see the text on the page "Lock Resource"

  @fixture.cleanup_datasets
  Scenario: As a sysadmin I can unlock a protected resource
    Given A protected resource "abalone_data.csv" on the "Abalone data" dataset
    And I login with the user "admin"
    And I am on the Dataset Page for "Abalone Data"
    When I press "abalone_data.csv"
    And I wait for "1" seconds
    Then I should see the text on the page "Unlock Resource"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.