sharetest_scenarios.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * Copyright (C) 2024-present Puter Technologies Inc.
  3. *
  4. * This file is part of Puter.
  5. *
  6. * Puter is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU Affero General Public License as published
  8. * by the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU Affero General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Affero General Public License
  17. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  18. */
  19. module.exports = [
  20. {
  21. sequence: [
  22. {
  23. title: 'Kyle creates a file',
  24. call: 'create-example-file',
  25. as: 'testuser_kyle',
  26. with: {
  27. name: 'example.txt',
  28. contents: 'secret file',
  29. }
  30. },
  31. {
  32. title: 'Eric tries to access it',
  33. call: 'assert-no-access',
  34. as: 'testuser_eric',
  35. with: {
  36. path: '/testuser_kyle/Desktop/example.txt'
  37. }
  38. },
  39. ]
  40. },
  41. {
  42. sequence: [
  43. {
  44. title: 'Stan creates a file',
  45. call: 'create-example-file',
  46. as: 'testuser_stan',
  47. with: {
  48. name: 'example.txt',
  49. contents: 'secret file',
  50. }
  51. },
  52. {
  53. title: 'Stan grants permission to Eric',
  54. call: 'grant',
  55. as: 'testuser_stan',
  56. with: {
  57. to: 'testuser_eric',
  58. permission: 'fs:/testuser_stan/Desktop/example.txt:read'
  59. }
  60. },
  61. {
  62. title: 'Eric tries to access it',
  63. call: 'assert-access',
  64. as: 'testuser_eric',
  65. with: {
  66. path: '/testuser_stan/Desktop/example.txt',
  67. level: 'read'
  68. }
  69. },
  70. ]
  71. },
  72. {
  73. sequence: [
  74. {
  75. title: 'Stan grants Kyle\'s file to Eric',
  76. call: 'grant',
  77. as: 'testuser_stan',
  78. with: {
  79. to: 'testuser_eric',
  80. permission: 'fs:/testuser_kyle/Desktop/example.txt:read'
  81. }
  82. },
  83. {
  84. title: 'Eric tries to access it',
  85. call: 'assert-no-access',
  86. as: 'testuser_eric',
  87. with: {
  88. path: '/testuser_kyle/Desktop/example.txt',
  89. }
  90. },
  91. ]
  92. },
  93. ];