scubagoggles 0.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. scubagoggles-0.5.0/LICENSE +121 -0
  2. scubagoggles-0.5.0/MANIFEST.in +10 -0
  3. scubagoggles-0.5.0/PKG-INFO +96 -0
  4. scubagoggles-0.5.0/README.md +69 -0
  5. scubagoggles-0.5.0/pyproject.toml +38 -0
  6. scubagoggles-0.5.0/scubagoggles/Testing/Functional/SmokeTests/README.md +142 -0
  7. scubagoggles-0.5.0/scubagoggles/Testing/Functional/SmokeTests/requirements.txt +3 -0
  8. scubagoggles-0.5.0/scubagoggles/Testing/Functional/SmokeTests/selenium_browser.py +81 -0
  9. scubagoggles-0.5.0/scubagoggles/Testing/Functional/SmokeTests/smoke_test.py +82 -0
  10. scubagoggles-0.5.0/scubagoggles/Testing/Functional/SmokeTests/smoke_test_utils.py +383 -0
  11. scubagoggles-0.5.0/scubagoggles/Testing/Functional/conftest.py +49 -0
  12. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/calendar/calendar_api01_test.rego +76 -0
  13. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/calendar/calendar_api02_test.rego +49 -0
  14. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/calendar/calendar_api03_test.rego +70 -0
  15. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/calendar/calendar_api04_test.rego +49 -0
  16. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/chat/chat05_test.rego +799 -0
  17. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/chat/chat_api01_test.rego +73 -0
  18. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/chat/chat_api02_test.rego +57 -0
  19. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/chat/chat_api03_test.rego +82 -0
  20. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/chat/chat_api04_test.rego +91 -0
  21. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/classroom/classroom_api01_test.rego +90 -0
  22. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/classroom/classroom_api02_test.rego +62 -0
  23. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/classroom/classroom_api03_test.rego +65 -0
  24. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/classroom/classroom_api04_test.rego +65 -0
  25. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/classroom/classroom_api05_test.rego +65 -0
  26. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/commoncontrols/commoncontrols02_test.rego +153 -0
  27. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/commoncontrols/commoncontrols03_test.rego +521 -0
  28. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/commoncontrols/commoncontrols06_test.rego +227 -0
  29. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/commoncontrols/commoncontrols07_test.rego +25 -0
  30. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/commoncontrols/commoncontrols09_test.rego +48 -0
  31. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/commoncontrols/commoncontrols10_test.rego +489 -0
  32. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/commoncontrols/commoncontrols13_test.rego +1113 -0
  33. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/commoncontrols/commoncontrols14_test.rego +48 -0
  34. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/commoncontrols/commoncontrols15_test.rego +335 -0
  35. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/commoncontrols/commoncontrols17_test.rego +98 -0
  36. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/commoncontrols/commoncontrols_api01_test.rego +301 -0
  37. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/commoncontrols/commoncontrols_api04_test.rego +64 -0
  38. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/commoncontrols/commoncontrols_api05_test.rego +160 -0
  39. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/commoncontrols/commoncontrols_api08_test.rego +119 -0
  40. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/commoncontrols/commoncontrols_api10_test.rego +43 -0
  41. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/commoncontrols/commoncontrols_api11_test.rego +59 -0
  42. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/commoncontrols/commoncontrols_api12_test.rego +125 -0
  43. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/commoncontrols/commoncontrols_api16_test.rego +97 -0
  44. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/drive/drive05_test.rego +248 -0
  45. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/drive/drive_api01_test.rego +324 -0
  46. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/drive/drive_api02_test.rego +178 -0
  47. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/drive/drive_api03_test.rego +96 -0
  48. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/drive/drive_api04_test.rego +72 -0
  49. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/drive/drive_api06_test.rego +89 -0
  50. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/gmail/gmail02_test.rego +94 -0
  51. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/gmail/gmail03_test.rego +155 -0
  52. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/gmail/gmail04_test.rego +402 -0
  53. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/gmail/gmail13_test.rego +355 -0
  54. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/gmail/gmail15_test.rego +26 -0
  55. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/gmail/gmail16_test.rego +338 -0
  56. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/gmail/gmail17_test.rego +24 -0
  57. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/gmail/gmail18_test.rego +69 -0
  58. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/gmail/gmail_api01_test.rego +73 -0
  59. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/gmail/gmail_api05_test.rego +214 -0
  60. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/gmail/gmail_api06_test.rego +174 -0
  61. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/gmail/gmail_api07_test.rego +278 -0
  62. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/gmail/gmail_api08_test.rego +46 -0
  63. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/gmail/gmail_api09_test.rego +61 -0
  64. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/gmail/gmail_api10_test.rego +48 -0
  65. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/gmail/gmail_api11_test.rego +46 -0
  66. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/gmail/gmail_api12_test.rego +48 -0
  67. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/gmail/gmail_api14_test.rego +49 -0
  68. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/gmail/gmail_api15_test.rego +73 -0
  69. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/groups/groups_api01_test.rego +56 -0
  70. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/groups/groups_api02_test.rego +56 -0
  71. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/groups/groups_api03_test.rego +56 -0
  72. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/groups/groups_api04_test.rego +63 -0
  73. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/groups/groups_api05_test.rego +63 -0
  74. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/groups/groups_api06_test.rego +49 -0
  75. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/meet/meet05_test.rego +288 -0
  76. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/meet/meet06_test.rego +51 -0
  77. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/meet/meet_api01_test.rego +48 -0
  78. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/meet/meet_api02_test.rego +48 -0
  79. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/meet/meet_api03_test.rego +45 -0
  80. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/meet/meet_api04_test.rego +45 -0
  81. scubagoggles-0.5.0/scubagoggles/Testing/RegoTests/sites/sites_api01_test.rego +71 -0
  82. scubagoggles-0.5.0/scubagoggles/Testing/run_unit_tests.py +100 -0
  83. scubagoggles-0.5.0/scubagoggles/__init__.py +7 -0
  84. scubagoggles-0.5.0/scubagoggles/auth.py +166 -0
  85. scubagoggles-0.5.0/scubagoggles/baselines/README.md +11 -0
  86. scubagoggles-0.5.0/scubagoggles/baselines/calendar.md +221 -0
  87. scubagoggles-0.5.0/scubagoggles/baselines/chat.md +247 -0
  88. scubagoggles-0.5.0/scubagoggles/baselines/classroom.md +223 -0
  89. scubagoggles-0.5.0/scubagoggles/baselines/commoncontrols.md +1392 -0
  90. scubagoggles-0.5.0/scubagoggles/baselines/drive.md +409 -0
  91. scubagoggles-0.5.0/scubagoggles/baselines/gmail.md +1142 -0
  92. scubagoggles-0.5.0/scubagoggles/baselines/groups.md +261 -0
  93. scubagoggles-0.5.0/scubagoggles/baselines/images/MFA.PNG +0 -0
  94. scubagoggles-0.5.0/scubagoggles/baselines/meet.md +287 -0
  95. scubagoggles-0.5.0/scubagoggles/baselines/sites.md +65 -0
  96. scubagoggles-0.5.0/scubagoggles/config.py +230 -0
  97. scubagoggles-0.5.0/scubagoggles/getopa.py +259 -0
  98. scubagoggles-0.5.0/scubagoggles/main.py +506 -0
  99. scubagoggles-0.5.0/scubagoggles/orchestrator.py +600 -0
  100. scubagoggles-0.5.0/scubagoggles/policy_api.py +883 -0
  101. scubagoggles-0.5.0/scubagoggles/provider.py +695 -0
  102. scubagoggles-0.5.0/scubagoggles/purge.py +132 -0
  103. scubagoggles-0.5.0/scubagoggles/rego/Calendar.rego +235 -0
  104. scubagoggles-0.5.0/scubagoggles/rego/Chat.rego +521 -0
  105. scubagoggles-0.5.0/scubagoggles/rego/Classroom.rego +289 -0
  106. scubagoggles-0.5.0/scubagoggles/rego/Commoncontrols.rego +2051 -0
  107. scubagoggles-0.5.0/scubagoggles/rego/Drive.rego +854 -0
  108. scubagoggles-0.5.0/scubagoggles/rego/Gmail.rego +1486 -0
  109. scubagoggles-0.5.0/scubagoggles/rego/Groups.rego +271 -0
  110. scubagoggles-0.5.0/scubagoggles/rego/Meet.rego +292 -0
  111. scubagoggles-0.5.0/scubagoggles/rego/Sites.rego +43 -0
  112. scubagoggles-0.5.0/scubagoggles/rego/Utils.rego +630 -0
  113. scubagoggles-0.5.0/scubagoggles/reporter/FrontPageReport/FrontPageReportTemplate.html +29 -0
  114. scubagoggles-0.5.0/scubagoggles/reporter/IndividualReport/AlertsDescriptions.json +41 -0
  115. scubagoggles-0.5.0/scubagoggles/reporter/IndividualReport/IndividualReportTemplate.html +25 -0
  116. scubagoggles-0.5.0/scubagoggles/reporter/__init__.py +0 -0
  117. scubagoggles-0.5.0/scubagoggles/reporter/images/cisa_logo.png +0 -0
  118. scubagoggles-0.5.0/scubagoggles/reporter/images/triangle-exclamation-solid.svg +1 -0
  119. scubagoggles-0.5.0/scubagoggles/reporter/md_parser.py +409 -0
  120. scubagoggles-0.5.0/scubagoggles/reporter/reporter.py +688 -0
  121. scubagoggles-0.5.0/scubagoggles/reporter/scripts/main.js +71 -0
  122. scubagoggles-0.5.0/scubagoggles/reporter/styles/FrontPageStyle.css +65 -0
  123. scubagoggles-0.5.0/scubagoggles/reporter/styles/main.css +167 -0
  124. scubagoggles-0.5.0/scubagoggles/robust_dns.py +216 -0
  125. scubagoggles-0.5.0/scubagoggles/run_rego.py +193 -0
  126. scubagoggles-0.5.0/scubagoggles/sample-report/ActionsPlan.csv +84 -0
  127. scubagoggles-0.5.0/scubagoggles/sample-report/BaselineReports.html +305 -0
  128. scubagoggles-0.5.0/scubagoggles/sample-report/IndividualReports/CalendarReport.html +351 -0
  129. scubagoggles-0.5.0/scubagoggles/sample-report/IndividualReports/ChatReport.html +370 -0
  130. scubagoggles-0.5.0/scubagoggles/sample-report/IndividualReports/ClassroomReport.html +363 -0
  131. scubagoggles-0.5.0/scubagoggles/sample-report/IndividualReports/CommoncontrolsReport.html +976 -0
  132. scubagoggles-0.5.0/scubagoggles/sample-report/IndividualReports/DriveReport.html +445 -0
  133. scubagoggles-0.5.0/scubagoggles/sample-report/IndividualReports/GmailReport.html +764 -0
  134. scubagoggles-0.5.0/scubagoggles/sample-report/IndividualReports/GroupsReport.html +375 -0
  135. scubagoggles-0.5.0/scubagoggles/sample-report/IndividualReports/MeetReport.html +382 -0
  136. scubagoggles-0.5.0/scubagoggles/sample-report/IndividualReports/SitesReport.html +280 -0
  137. scubagoggles-0.5.0/scubagoggles/sample-report/IndividualReports/images/cisa_logo.png +0 -0
  138. scubagoggles-0.5.0/scubagoggles/sample-report/IndividualReports/images/triangle-exclamation-solid.svg +1 -0
  139. scubagoggles-0.5.0/scubagoggles/sample-report/ScubaResults_f4070c73-5faa-4f70.json +98729 -0
  140. scubagoggles-0.5.0/scubagoggles/sample-report/TestResults.json +1189 -0
  141. scubagoggles-0.5.0/scubagoggles/scuba_argument_parser.py +157 -0
  142. scubagoggles-0.5.0/scubagoggles/scuba_constants.py +47 -0
  143. scubagoggles-0.5.0/scubagoggles/user_setup.py +270 -0
  144. scubagoggles-0.5.0/scubagoggles/utils/build.sh +199 -0
  145. scubagoggles-0.5.0/scubagoggles/utils/checkOPAHash.sh +32 -0
  146. scubagoggles-0.5.0/scubagoggles/utils/test_opa.sh +24 -0
  147. scubagoggles-0.5.0/scubagoggles/utils/update_policyid_version.py +66 -0
  148. scubagoggles-0.5.0/scubagoggles/utils.py +139 -0
  149. scubagoggles-0.5.0/scubagoggles/version.py +448 -0
  150. scubagoggles-0.5.0/scubagoggles.egg-info/PKG-INFO +96 -0
  151. scubagoggles-0.5.0/scubagoggles.egg-info/SOURCES.txt +154 -0
  152. scubagoggles-0.5.0/scubagoggles.egg-info/dependency_links.txt +1 -0
  153. scubagoggles-0.5.0/scubagoggles.egg-info/entry_points.txt +2 -0
  154. scubagoggles-0.5.0/scubagoggles.egg-info/requires.txt +8 -0
  155. scubagoggles-0.5.0/scubagoggles.egg-info/top_level.txt +7 -0
  156. scubagoggles-0.5.0/setup.cfg +4 -0
@@ -0,0 +1,121 @@
1
+ Creative Commons Legal Code
2
+
3
+ CC0 1.0 Universal
4
+
5
+ CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
6
+ LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
7
+ ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
8
+ INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
9
+ REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
10
+ PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
11
+ THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
12
+ HEREUNDER.
13
+
14
+ Statement of Purpose
15
+
16
+ The laws of most jurisdictions throughout the world automatically confer
17
+ exclusive Copyright and Related Rights (defined below) upon the creator
18
+ and subsequent owner(s) (each and all, an "owner") of an original work of
19
+ authorship and/or a database (each, a "Work").
20
+
21
+ Certain owners wish to permanently relinquish those rights to a Work for
22
+ the purpose of contributing to a commons of creative, cultural and
23
+ scientific works ("Commons") that the public can reliably and without fear
24
+ of later claims of infringement build upon, modify, incorporate in other
25
+ works, reuse and redistribute as freely as possible in any form whatsoever
26
+ and for any purposes, including without limitation commercial purposes.
27
+ These owners may contribute to the Commons to promote the ideal of a free
28
+ culture and the further production of creative, cultural and scientific
29
+ works, or to gain reputation or greater distribution for their Work in
30
+ part through the use and efforts of others.
31
+
32
+ For these and/or other purposes and motivations, and without any
33
+ expectation of additional consideration or compensation, the person
34
+ associating CC0 with a Work (the "Affirmer"), to the extent that he or she
35
+ is an owner of Copyright and Related Rights in the Work, voluntarily
36
+ elects to apply CC0 to the Work and publicly distribute the Work under its
37
+ terms, with knowledge of his or her Copyright and Related Rights in the
38
+ Work and the meaning and intended legal effect of CC0 on those rights.
39
+
40
+ 1. Copyright and Related Rights. A Work made available under CC0 may be
41
+ protected by copyright and related or neighboring rights ("Copyright and
42
+ Related Rights"). Copyright and Related Rights include, but are not
43
+ limited to, the following:
44
+
45
+ i. the right to reproduce, adapt, distribute, perform, display,
46
+ communicate, and translate a Work;
47
+ ii. moral rights retained by the original author(s) and/or performer(s);
48
+ iii. publicity and privacy rights pertaining to a person's image or
49
+ likeness depicted in a Work;
50
+ iv. rights protecting against unfair competition in regards to a Work,
51
+ subject to the limitations in paragraph 4(a), below;
52
+ v. rights protecting the extraction, dissemination, use and reuse of data
53
+ in a Work;
54
+ vi. database rights (such as those arising under Directive 96/9/EC of the
55
+ European Parliament and of the Council of 11 March 1996 on the legal
56
+ protection of databases, and under any national implementation
57
+ thereof, including any amended or successor version of such
58
+ directive); and
59
+ vii. other similar, equivalent or corresponding rights throughout the
60
+ world based on applicable law or treaty, and any national
61
+ implementations thereof.
62
+
63
+ 2. Waiver. To the greatest extent permitted by, but not in contravention
64
+ of, applicable law, Affirmer hereby overtly, fully, permanently,
65
+ irrevocably and unconditionally waives, abandons, and surrenders all of
66
+ Affirmer's Copyright and Related Rights and associated claims and causes
67
+ of action, whether now known or unknown (including existing as well as
68
+ future claims and causes of action), in the Work (i) in all territories
69
+ worldwide, (ii) for the maximum duration provided by applicable law or
70
+ treaty (including future time extensions), (iii) in any current or future
71
+ medium and for any number of copies, and (iv) for any purpose whatsoever,
72
+ including without limitation commercial, advertising or promotional
73
+ purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
74
+ member of the public at large and to the detriment of Affirmer's heirs and
75
+ successors, fully intending that such Waiver shall not be subject to
76
+ revocation, rescission, cancellation, termination, or any other legal or
77
+ equitable action to disrupt the quiet enjoyment of the Work by the public
78
+ as contemplated by Affirmer's express Statement of Purpose.
79
+
80
+ 3. Public License Fallback. Should any part of the Waiver for any reason
81
+ be judged legally invalid or ineffective under applicable law, then the
82
+ Waiver shall be preserved to the maximum extent permitted taking into
83
+ account Affirmer's express Statement of Purpose. In addition, to the
84
+ extent the Waiver is so judged Affirmer hereby grants to each affected
85
+ person a royalty-free, non transferable, non sublicensable, non exclusive,
86
+ irrevocable and unconditional license to exercise Affirmer's Copyright and
87
+ Related Rights in the Work (i) in all territories worldwide, (ii) for the
88
+ maximum duration provided by applicable law or treaty (including future
89
+ time extensions), (iii) in any current or future medium and for any number
90
+ of copies, and (iv) for any purpose whatsoever, including without
91
+ limitation commercial, advertising or promotional purposes (the
92
+ "License"). The License shall be deemed effective as of the date CC0 was
93
+ applied by Affirmer to the Work. Should any part of the License for any
94
+ reason be judged legally invalid or ineffective under applicable law, such
95
+ partial invalidity or ineffectiveness shall not invalidate the remainder
96
+ of the License, and in such case Affirmer hereby affirms that he or she
97
+ will not (i) exercise any of his or her remaining Copyright and Related
98
+ Rights in the Work or (ii) assert any associated claims and causes of
99
+ action with respect to the Work, in either case contrary to Affirmer's
100
+ express Statement of Purpose.
101
+
102
+ 4. Limitations and Disclaimers.
103
+
104
+ a. No trademark or patent rights held by Affirmer are waived, abandoned,
105
+ surrendered, licensed or otherwise affected by this document.
106
+ b. Affirmer offers the Work as-is and makes no representations or
107
+ warranties of any kind concerning the Work, express, implied,
108
+ statutory or otherwise, including without limitation warranties of
109
+ title, merchantability, fitness for a particular purpose, non
110
+ infringement, or the absence of latent or other defects, accuracy, or
111
+ the present or absence of errors, whether or not discoverable, all to
112
+ the greatest extent permissible under applicable law.
113
+ c. Affirmer disclaims responsibility for clearing rights of other persons
114
+ that may apply to the Work or any use thereof, including without
115
+ limitation any person's Copyright and Related Rights in the Work.
116
+ Further, Affirmer disclaims responsibility for obtaining any necessary
117
+ consents, permissions or other rights required for any use of the
118
+ Work.
119
+ d. Affirmer understands and acknowledges that Creative Commons is not a
120
+ party to this document and has no duty or obligation with respect to
121
+ this CC0 or use of the Work.
@@ -0,0 +1,10 @@
1
+ # This manifest is used to ensure that certain non-Python files are included
2
+ # in the ScubaGoggles distribution. The following subdirectories (and their
3
+ # contents) are included:
4
+
5
+ graft scubagoggles/baselines
6
+ graft scubagoggles/rego
7
+ graft scubagoggles/reporter
8
+ graft scubagoggles/sample-report
9
+ graft scubagoggles/Testing
10
+ graft scubagoggles/utils
@@ -0,0 +1,96 @@
1
+ Metadata-Version: 2.4
2
+ Name: scubagoggles
3
+ Version: 0.5.0
4
+ Summary: SCuBA security baseline assessment tool
5
+ Author: CISA
6
+ License-Expression: CC0-1.0
7
+ Classifier: Development Status :: 4 - Beta
8
+ Classifier: Intended Audience :: Information Technology
9
+ Classifier: Topic :: Security
10
+ Classifier: Programming Language :: Python :: 3.9
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Requires-Python: >=3.9
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Requires-Dist: dnspython>=2.6.1
19
+ Requires-Dist: google-api-python-client>=2.142.0
20
+ Requires-Dist: google-auth-httplib2>=0.2.0
21
+ Requires-Dist: google-auth-oauthlib>=1.2.1
22
+ Requires-Dist: MarkupSafe>=2.1.5
23
+ Requires-Dist: pyyaml>=6.0.2
24
+ Requires-Dist: requests>=2.32.3
25
+ Requires-Dist: tqdm>=4.66.5
26
+ Dynamic: license-file
27
+
28
+ ![ScubaGoggles Logo](https://github.com/cisagov/ScubaGoggles/raw/main/docs/images/ScubaGoggles%20GitHub%20Graphic%20v2.jpg)
29
+ <div align='center' style="margin:0;" id="user-content-toc">
30
+ <ul>
31
+ <h1 style="display: inline-block;">ScubaGoggles</h1>
32
+ </ul>
33
+ <ul>
34
+ <a href="https://github.com/cisagov/ScubaGoggles/releases">
35
+ <img src="https://img.shields.io/badge/ScubaGoggles-v0.5.0-%2385B065?labelColor=%23005288" alt="ScubaGoggles version #"></a>
36
+ <a href="https://github.com/cisagov/ScubaGoggles/tree/main/baselines">
37
+ <img src="https://img.shields.io/badge/GWS_SCB-v0.5-%2385B065?labelColor=%23005288" alt="GWS SCB version #"></a>
38
+ <a href="">
39
+ <img src="https://img.shields.io/github/downloads/cisagov/ScubaGoggles/total.svg" alt="Downloads"></a>
40
+ </ul>
41
+ </div>
42
+ <h2 align='center' style="margin:0;">GWS Secure Configuration Baseline Assessment Tool </h2>
43
+
44
+ Developed by CISA, ScubaGoggles is an assessment tool that verifies a Google
45
+ Workspace (GWS) organization's configuration conforms to the policies
46
+ described in the Secure Cloud Business Applications
47
+ ([SCuBA](https://cisa.gov/scuba)) Secure Configuration
48
+ Baseline [documents](https://github.com/cisagov/ScubaGoggles/blob/main/scubagoggles/baselines/README.md).
49
+
50
+ For the Microsoft 365 (M365) rendition of this tool, see [ScubaGear](https://github.com/cisagov/ScubaGear).
51
+
52
+ > [!WARNING]
53
+ > This tool is in an alpha state and in active development. At this time, outputs could be incorrect and should be reviewed carefully.
54
+
55
+ ## Overview
56
+ We use a three-step process:
57
+ 1. **Export**. In this step, we primarily use the Google Admin SDK API to export and serialize all the relevant logs and settings into json. ScubaGoggles also uses various other Google APIs to grab organization metadata, user privileges etc.
58
+ 2. **Verify**. Compare the exported settings from the previous step with the configuration prescribed in the baselines. We do this using [OPA Rego](https://www.openpolicyagent.org/docs/latest/policy-language/#what-is-rego), a declarative query language for defining policy.
59
+ 3. **Report**. Package the results as HTML and JSON.
60
+
61
+ ## Table of Contents
62
+
63
+ ### Installation
64
+
65
+ - [Download and Python Install](https://github.com/cisagov/ScubaGoggles/blob/main/docs/installation/DownloadAndInstall.md)
66
+ - [Download the OPA Executable](https://github.com/cisagov/ScubaGoggles/blob/main/docs/installation/OPA.md)
67
+ - [Configure Defaults](https://github.com/cisagov/ScubaGoggles/blob/main/docs/installation/Defaults.md)
68
+
69
+ ### Prerequisites
70
+
71
+ - [Permissions](https://github.com/cisagov/ScubaGoggles/blob/main/docs/prerequisites/Prerequisites.md#permissions)
72
+ - [Create a Project](https://github.com/cisagov/ScubaGoggles/blob/main/docs/prerequisites/Prerequisites.md#create-a-project)
73
+
74
+ ### Authentication
75
+ - [Authentication Methods](https://github.com/cisagov/ScubaGoggles/blob/main/docs/authentication/AuthenticationMethods.md)
76
+ - [Using OAuth](https://github.com/cisagov/ScubaGoggles/blob/main/docs/authentication/OAuth.md)
77
+ - [Using a Service Account](https://github.com/cisagov/ScubaGoggles/blob/main/docs/authentication/ServiceAccount.md)
78
+
79
+ ### Usage
80
+
81
+ - [Usage: Parameters](https://github.com/cisagov/ScubaGoggles/blob/main/docs/usage/Parameters.md)
82
+ - [Usage: Config File](https://github.com/cisagov/ScubaGoggles/blob/main/docs/usage/Config.md)
83
+ - [Usage: Examples](https://github.com/cisagov/ScubaGoggles/blob/main/docs/usage/Examples.md)
84
+ - [Reviewing Output](https://github.com/cisagov/ScubaGoggles/blob/main/docs/usage/ReviewOutput.md)
85
+ - [Limitations](https://github.com/cisagov/ScubaGoggles/blob/main/docs/usage/Limitations.md)
86
+
87
+ ### Troubleshooting
88
+ - [Not Authorized to Access This Resource](https://github.com/cisagov/ScubaGoggles/blob/main/docs/troubleshooting/Troubleshooting.md#not-authorized-to-access-this-resource)
89
+ - [WinError 10013 Permission Error](https://github.com/cisagov/ScubaGoggles/blob/main/docs/troubleshooting/Troubleshooting.md#windows--winerror-10013-permission-error)
90
+ - [Unable to view HTML report due to environment limitations](https://github.com/cisagov/ScubaGoggles/blob/main/docs/troubleshooting/Troubleshooting.md#unable-to-view-html-report-due-to-environment-limitations)
91
+
92
+ ## Project License
93
+ Unless otherwise noted, this project is distributed under the Creative
94
+ Commons Zero license. With developer approval, contributions may be
95
+ submitted with an alternate compatible license. If accepted, those
96
+ contributions will be listed herein with the appropriate license.
@@ -0,0 +1,69 @@
1
+ ![ScubaGoggles Logo](https://github.com/cisagov/ScubaGoggles/raw/main/docs/images/ScubaGoggles%20GitHub%20Graphic%20v2.jpg)
2
+ <div align='center' style="margin:0;" id="user-content-toc">
3
+ <ul>
4
+ <h1 style="display: inline-block;">ScubaGoggles</h1>
5
+ </ul>
6
+ <ul>
7
+ <a href="https://github.com/cisagov/ScubaGoggles/releases">
8
+ <img src="https://img.shields.io/badge/ScubaGoggles-v0.5.0-%2385B065?labelColor=%23005288" alt="ScubaGoggles version #"></a>
9
+ <a href="https://github.com/cisagov/ScubaGoggles/tree/main/baselines">
10
+ <img src="https://img.shields.io/badge/GWS_SCB-v0.5-%2385B065?labelColor=%23005288" alt="GWS SCB version #"></a>
11
+ <a href="">
12
+ <img src="https://img.shields.io/github/downloads/cisagov/ScubaGoggles/total.svg" alt="Downloads"></a>
13
+ </ul>
14
+ </div>
15
+ <h2 align='center' style="margin:0;">GWS Secure Configuration Baseline Assessment Tool </h2>
16
+
17
+ Developed by CISA, ScubaGoggles is an assessment tool that verifies a Google
18
+ Workspace (GWS) organization's configuration conforms to the policies
19
+ described in the Secure Cloud Business Applications
20
+ ([SCuBA](https://cisa.gov/scuba)) Secure Configuration
21
+ Baseline [documents](https://github.com/cisagov/ScubaGoggles/blob/main/scubagoggles/baselines/README.md).
22
+
23
+ For the Microsoft 365 (M365) rendition of this tool, see [ScubaGear](https://github.com/cisagov/ScubaGear).
24
+
25
+ > [!WARNING]
26
+ > This tool is in an alpha state and in active development. At this time, outputs could be incorrect and should be reviewed carefully.
27
+
28
+ ## Overview
29
+ We use a three-step process:
30
+ 1. **Export**. In this step, we primarily use the Google Admin SDK API to export and serialize all the relevant logs and settings into json. ScubaGoggles also uses various other Google APIs to grab organization metadata, user privileges etc.
31
+ 2. **Verify**. Compare the exported settings from the previous step with the configuration prescribed in the baselines. We do this using [OPA Rego](https://www.openpolicyagent.org/docs/latest/policy-language/#what-is-rego), a declarative query language for defining policy.
32
+ 3. **Report**. Package the results as HTML and JSON.
33
+
34
+ ## Table of Contents
35
+
36
+ ### Installation
37
+
38
+ - [Download and Python Install](https://github.com/cisagov/ScubaGoggles/blob/main/docs/installation/DownloadAndInstall.md)
39
+ - [Download the OPA Executable](https://github.com/cisagov/ScubaGoggles/blob/main/docs/installation/OPA.md)
40
+ - [Configure Defaults](https://github.com/cisagov/ScubaGoggles/blob/main/docs/installation/Defaults.md)
41
+
42
+ ### Prerequisites
43
+
44
+ - [Permissions](https://github.com/cisagov/ScubaGoggles/blob/main/docs/prerequisites/Prerequisites.md#permissions)
45
+ - [Create a Project](https://github.com/cisagov/ScubaGoggles/blob/main/docs/prerequisites/Prerequisites.md#create-a-project)
46
+
47
+ ### Authentication
48
+ - [Authentication Methods](https://github.com/cisagov/ScubaGoggles/blob/main/docs/authentication/AuthenticationMethods.md)
49
+ - [Using OAuth](https://github.com/cisagov/ScubaGoggles/blob/main/docs/authentication/OAuth.md)
50
+ - [Using a Service Account](https://github.com/cisagov/ScubaGoggles/blob/main/docs/authentication/ServiceAccount.md)
51
+
52
+ ### Usage
53
+
54
+ - [Usage: Parameters](https://github.com/cisagov/ScubaGoggles/blob/main/docs/usage/Parameters.md)
55
+ - [Usage: Config File](https://github.com/cisagov/ScubaGoggles/blob/main/docs/usage/Config.md)
56
+ - [Usage: Examples](https://github.com/cisagov/ScubaGoggles/blob/main/docs/usage/Examples.md)
57
+ - [Reviewing Output](https://github.com/cisagov/ScubaGoggles/blob/main/docs/usage/ReviewOutput.md)
58
+ - [Limitations](https://github.com/cisagov/ScubaGoggles/blob/main/docs/usage/Limitations.md)
59
+
60
+ ### Troubleshooting
61
+ - [Not Authorized to Access This Resource](https://github.com/cisagov/ScubaGoggles/blob/main/docs/troubleshooting/Troubleshooting.md#not-authorized-to-access-this-resource)
62
+ - [WinError 10013 Permission Error](https://github.com/cisagov/ScubaGoggles/blob/main/docs/troubleshooting/Troubleshooting.md#windows--winerror-10013-permission-error)
63
+ - [Unable to view HTML report due to environment limitations](https://github.com/cisagov/ScubaGoggles/blob/main/docs/troubleshooting/Troubleshooting.md#unable-to-view-html-report-due-to-environment-limitations)
64
+
65
+ ## Project License
66
+ Unless otherwise noted, this project is distributed under the Creative
67
+ Commons Zero license. With developer approval, contributions may be
68
+ submitted with an alternate compatible license. If accepted, those
69
+ contributions will be listed herein with the appropriate license.
@@ -0,0 +1,38 @@
1
+ [build-system]
2
+ requires = ["setuptools"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "scubagoggles"
7
+ dynamic = ["version"]
8
+ classifiers = ["Development Status :: 4 - Beta",
9
+ "Intended Audience :: Information Technology",
10
+ "Topic :: Security",
11
+ "Programming Language :: Python :: 3.9",
12
+ "Programming Language :: Python :: 3.10",
13
+ "Programming Language :: Python :: 3.11",
14
+ "Programming Language :: Python :: 3.12",
15
+ "Programming Language :: Python :: 3.13"]
16
+ dependencies = ["dnspython>=2.6.1",
17
+ "google-api-python-client>=2.142.0",
18
+ "google-auth-httplib2>=0.2.0",
19
+ "google-auth-oauthlib>=1.2.1",
20
+ "MarkupSafe>=2.1.5",
21
+ "pyyaml>=6.0.2",
22
+ "requests>=2.32.3",
23
+ "tqdm>=4.66.5"]
24
+ requires-python = ">= 3.9"
25
+ description='SCuBA security baseline assessment tool'
26
+ authors = [{name = "CISA"}]
27
+ license = "CC0-1.0"
28
+ license-files = ["LICENSE"]
29
+ readme = "README.md"
30
+
31
+ [project.scripts]
32
+ scubagoggles = "scubagoggles.main:dive"
33
+
34
+ [tool.setuptools.dynamic]
35
+ version = {attr = "scubagoggles.__version__"}
36
+
37
+ [tool.setuptools.packages.find]
38
+ where = ["."]
@@ -0,0 +1,142 @@
1
+ # ScubaGoggles Functional Smoke Testing Automation
2
+ The ScubaGoggles repository consists of an automation suite to help test the functionality of the ScubaGoggles tool itself. The test automation is geared towards contributors who want to execute the functional smoke testing orchestrator as part of their development/testing activity.
3
+
4
+ This README outlines the ScubaGoggles software test automation structure and its usage. The document also contains instructions for adding new tests to the existing automation suite if necessary.
5
+
6
+ ## Table of Contents
7
+ - [Smoke Testing Prerequisites](#smoke-testing-prerequisites)
8
+ - [Pytest and Selenium](#pytest-and-selenium)
9
+ - [Google Service Account](#google-service-account)
10
+ - [Functional Smoke Testing Structure](#functional-smoke-testing-structure)
11
+ - [Smoke Testing Classes and Methods](#smoke-testing-classes-and-methods)
12
+ - [Automated workflow via GitHub Actions](#automated-workflow-via-github-actions)
13
+ - [Functional Smoke Testing Usage](#functional-smoke-testing-usage)
14
+ - [Running in a Local Development Environment](#running-in-a-local-development-environment)
15
+ - [Running Remotely via GitHub Actions](#running-remotely-via-github-actions)
16
+ - [Adding New Tests](#adding-new-tests)
17
+
18
+ ## Smoke Testing Prerequisites ##
19
+ Running the ScubaGoggles functional smoke tests requires a Windows, MacOS, or Linux computer or VM. The development environment should have Python v3.10.x installed at a minimum ([refer to our installing Python dependencies documentation if its not already installed](https://github.com/cisagov/ScubaGoggles/blob/main/docs/installation/DownloadAndInstall.md#installing-python-dependencies)), Pytest, and Selenium installed locally.
20
+
21
+ ### Pytest and Selenium ###
22
+ Pytest is a Python testing framework which is commonly used for unit, integration, and functional testing. ([Pytest Get Started](https://docs.pytest.org/en/stable/getting-started.html))
23
+
24
+ Selenium supports automation of all the major browsers in the market through the use of WebDriver. ([Selenium Get Started](https://www.selenium.dev/documentation/webdriver/getting_started/))
25
+
26
+ To install Pytest and Selenium on your development environment, open a new terminal session and run the following command:
27
+
28
+ ```
29
+ pip install pytest selenium
30
+ ```
31
+
32
+ > [!NOTE]
33
+ > The functional smoke tests use Chrome as its WebDriver when running Selenium tests. [Setup ChromeDriver](https://developer.chrome.com/docs/chromedriver/get-started) if you don't already have the Google Chrome web browser installed.
34
+
35
+ ### Google Service Account ###
36
+ The ScubaGoggles functional smoke tests must be executed with a service account. [Refer to our service account documentation on how to get setup.](https://github.com/cisagov/ScubaGoggles/blob/main/docs/authentication/ServiceAccount.md#using-a-service-account)
37
+
38
+ A `credentials.json` file is required at the root directory of the ScubaGoggles project if running the functional smoke tests in a local development environment.
39
+
40
+ Take note of the `subjectemail`, the email used to authenticate with GWS that has necessary administrator permissions, and the GWS `customerdomain` that ScubaGoggles is run against. Both credentials are required in a later step.
41
+
42
+ ## Functional Smoke Testing Structure ##
43
+ ScubaGoggles functional smoke testing has two main components: the smoke testing orchestrator and the automated workflow run via GitHub Actions.
44
+
45
+ ### Smoke Testing Classes and Methods ###
46
+ The smoke testing orchestrator ([/Testing/Functional/SmokeTests/smoke_test.py](https://github.com/cisagov/ScubaGoggles/blob/main/Testing/Functional/SmokeTests/smoke_test.py)) executes each test declared inside the `SmokeTest` class. The tests currently cover:
47
+ - if the `scubagoggles gws` command generates valid output for all baselines
48
+ - if ScubaResults.json contains API errors or exceptions
49
+ - if the generated baseline reports, i.e. BaselineReports.html, CalendarReport.html, ChatReport.html, etc., contain valid content and all links redirect accordingly
50
+
51
+ The smoke testing utils ([/Testing/Functional/SmokeTests/smoke_test_utils.py](https://github.com/cisagov/ScubaGoggles/blob/main/Testing/Functional/SmokeTests/smoke_test_utils.py)) stores helper methods which perform various operations.
52
+
53
+ The Selenium Browser class ([/Testing/Functional/SmokeTests/selenium_browser.py](https://github.com/cisagov/ScubaGoggles/blob/main/Testing/Functional/SmokeTests/selenium_browser.py)) encapsulates the setup, usage, and teardown of Selenium WebDriver instances.
54
+
55
+ The Pytest configuration methods ([/Testing/Functional/SmokeTests/conftest.py](https://github.com/cisagov/ScubaGoggles/blob/main/Testing/Functional/conftest.py)) declare various Pytest fixtures, allowing for the use of CLI arguments when invoking the Pytest command.
56
+
57
+ ### Automated Workflow via GitHub Actions ###
58
+ The automated workflow for running the functional smoke tests ([/.github/workflows/run_smoke_test.yml](https://github.com/cisagov/ScubaGoggles/blob/main/.github/workflows/run_smoke_test.yml)) is triggered on `push` events to the main branch, `pull_request` events when a pull request is opened/reopened/reviewed, and manually with custom user input via workflow_dispatch.
59
+
60
+ ## Functional Smoke Testing Usage ##
61
+ After completing all of the prerequisite steps, the functional smoke tests can be run in a local development environment or remotely via GitHub Actions.
62
+
63
+ ### Running in a Local Development Environment ###
64
+ > [!IMPORTANT]
65
+ > Ensure that you have correctly setup a Google service account and that the `credentials.json` stored at the root directory of the ScubaGoggles project is up to date. If you haven't already, please refer back to the [prerequisite step on Google Service Accounts](#google-service-account) for how to setup before proceeding.
66
+
67
+ The following arguments are required when running the functional smoke tests:
68
+ - `--subjectemail="user@domain.com"` (the email used to authenticate with GWS, must have necessary administrator permissions)
69
+ - `--customerdomain="domain.com"` (the domain that ScubaGoggles is run against)
70
+
71
+ Replace `user@domain.com` with your email and `domain.com` with your domain, then run the following command to execute the functional smoke tests:
72
+ ```
73
+ pytest ./Testing/Functional/SmokeTests/ -vvv --subjectemail="user@domain.com" --customerdomain="domain.com"
74
+ ```
75
+
76
+ Common Pytest parameters and their use cases:
77
+ - `-v` or `--verbose` (shows individual test names and results)
78
+ - `-vv` (increases verbosity further, shows detailed output about each test)
79
+ - `-vvv` (shows even more detailed output and debug-level information)
80
+ - `-s` (disables output capturing allowing print() statements and logs to be shown in the console)
81
+ - `-k` (run tests that match a keyword)
82
+
83
+ Example (only runs test_scubagoggles_output, deselects the rest):
84
+ ```
85
+ pytest ./Testing/Functional/SmokeTests/ -vvv -k test_scubagoggles_output --subjectemail="user@domain.com" --customerdomain="domain.com"
86
+ ```
87
+
88
+ - `--tb=short`, `tb=long`, or `tb=no` (provide either brief, full, or suppress the traceback output for failed tests)
89
+ - `-q` (reduces output to show only minimal information)
90
+
91
+ Run `pytest -h` for a full list of CLI options or [learn more about Pytest usage here.](https://docs.pytest.org/en/7.1.x/how-to/usage.html)
92
+
93
+ ### Running Remotely via GitHub Actions ###
94
+ Go to the [run_smoke_test.yml workflow](https://github.com/cisagov/ScubaGoggles/actions/workflows/run_smoke_test.yml) in the GitHub Actions tab, then click the "Run workflow" dropdown button.
95
+
96
+ The default values are the following:
97
+ - ref branch: `main` but can be set to any branch
98
+ - operating system: `['windows-latest', 'macos-latest']` ([list of supported GitHub-hosted runners](https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories))
99
+ - python version: `['3.10']`
100
+ - opa version: "0.60.0"
101
+
102
+ ![Screenshot (226)](https://github.com/user-attachments/assets/6f25b7a9-3981-4866-a413-93df4bae1130)
103
+
104
+ Feel free to play around with the inputs then click the "Run workflow" button when ready. The workflow will create a matrix strategy for each combination. For example, passing `['windows-latest', 'macos-latest']`, `['3.10', '3.11', 3.12']`, and OPA version `0.60.0` will create the following:
105
+
106
+ ![Screenshot (218)](https://github.com/user-attachments/assets/212b4e4b-d552-4dc9-a3f6-7f0e29accc4b)
107
+
108
+ Some factors to consider:
109
+ - Each input is required so an empty string will fail validation. `[]`, `['']`, `['', ]` may also cause the workflow to error out, although this is expected behavior.
110
+ - `ubuntu-latest` has not been tested as a value for operating system. Support can be added for this, although its dependent on if this is something we want to test for ScubaGoggles as a whole.
111
+ - Python versions <3.10.x are not supported and will cause the smoke test workflow to fail.
112
+ - [Due to the lack of an array input type from GitHub](https://github.com/orgs/community/discussions/11692), the required format is an array of strings for the operating system and python version inputs. This is something to capture as a future todo once arrays are available.
113
+
114
+ ## Adding New Tests ##
115
+ A new smoke test should be added as a method in the [SmokeTest class](https://github.com/cisagov/ScubaGoggles/blob/main/Testing/Functional/SmokeTests/smoke_test.py). Helper methods should be added in [smoke_test_utils.py](https://github.com/cisagov/ScubaGoggles/blob/main/Testing/Functional/SmokeTests/smoke_test_utils.py).
116
+
117
+ Below is an example that tests the `scubagoggles gws` command:
118
+
119
+ ```
120
+ class SmokeTest:
121
+ ...
122
+
123
+ def test_scubagoggles_execution(self, subjectemail):
124
+ """
125
+ Test if the `scubagoggles gws` command succeeds or fails.
126
+
127
+ Args:
128
+ subjectemail: The email address of an admin user who created the service account
129
+ """
130
+ try:
131
+ command: str = f"scubagoggles gws --subjectemail {subjectemail} --quiet"
132
+ result = subprocess.run(command, shell=True, check=True, capture_output=True)
133
+
134
+ if result.returncode != 0:
135
+ print(f"Scubagoggles execution failed with error:\n{result.stderr}")
136
+ assert False
137
+ else:
138
+ print("Scubagoggles execution succeeded")
139
+ print(f"Output:\n{result.stdout}")
140
+ except Exception as e:
141
+ pytest.fail(f"An error occurred, {e}")
142
+ ```
@@ -0,0 +1,3 @@
1
+ # These packages are only required for the functional smoke testing
2
+ pytest
3
+ selenium
@@ -0,0 +1,81 @@
1
+ """
2
+ selenium_browser.py declares a Browser class for use in ScubaGoggles testing.
3
+ """
4
+
5
+ from selenium import webdriver
6
+ from selenium.webdriver.chrome.options import Options
7
+
8
+
9
+ class Browser:
10
+ """
11
+ The Browser class encapsulates the setup, usage, and teardown of a
12
+ Selenium WebDriver instance for automated browser interactions.
13
+ """
14
+ def __init__(self):
15
+ chrome_options = Options()
16
+ chrome_options.add_argument('--headless=new')
17
+ chrome_options.add_argument('--log-level=3')
18
+ chrome_options.add_argument('--window-size=1200,800')
19
+ chrome_options.add_argument('--no-sandbox')
20
+ chrome_options.add_argument('--disable-dev-shm-usage')
21
+
22
+ self.driver = webdriver.Chrome(options=chrome_options)
23
+
24
+ def get(self, url):
25
+ """
26
+ Load a new web page in the current browser window.
27
+
28
+ Args:
29
+ url: The URL to load. Must be a fully qualified URL
30
+ """
31
+ self.driver.get(url)
32
+
33
+ def quit(self):
34
+ """
35
+ Quits the driver, closing every associated window.
36
+ """
37
+ self.driver.quit()
38
+
39
+ def find_element(self, by, value):
40
+ """
41
+ Find the first WebElement using the given method. This method is
42
+ affected by the 'implicit wait' times in force at the time and
43
+ execution. The find_element(...) invocation will return a matching
44
+ row, or try again repeatedly until the configured timeout is reached.
45
+
46
+ Args:
47
+ by: The locating mechanism to use, i.e. By.CLASS_NAME, By.TAG_NAME
48
+ value: The locator, i.e. "h1", "header"
49
+
50
+ Returns:
51
+ WebElement: The first matching element on the current page
52
+ """
53
+ return self.driver.find_element(by, value)
54
+
55
+ def find_elements(self, by, value):
56
+ """
57
+ Find all WebElements within the current page. This method is affected
58
+ by the 'implicit wait' times in force at the time and execution. The
59
+ find_elements(...) invocation will return as soon as there are more
60
+ than 0 items in the found collection, or will return an empty list of
61
+ the timeout is reached.
62
+
63
+ Args:
64
+ by: The locating mechanism to use, i.e. By.CLASS_NAME, By.TAG_NAME
65
+ value: The locator, i.e. "h1", "header"
66
+
67
+ Returns:
68
+ WebElement: A list of all matching WebElements, or an empty list
69
+ if nothing matches
70
+ """
71
+ return self.driver.find_elements(by, value)
72
+
73
+ def current_url(self):
74
+ """
75
+ Get a string representing the current URL that the browser is looking
76
+ at.
77
+
78
+ Returns:
79
+ The URL of the page currently loaded in the browser
80
+ """
81
+ return self.driver.current_url
@@ -0,0 +1,82 @@
1
+ """
2
+ smoke_test.py declares a SmokeTest class for ScubaGoggles automation testing.
3
+ """
4
+
5
+ import subprocess
6
+
7
+ import pytest
8
+
9
+ from smoke_test_utils import (get_output_path,
10
+ get_required_entries,
11
+ run_selenium,
12
+ sample_report_dir,
13
+ top_report_url,
14
+ verify_all_outputs_exist,
15
+ verify_output_type,
16
+ verify_scubaresults)
17
+
18
+
19
+ class SmokeTest:
20
+ """
21
+ Pytest class to encapsulate the following test cases:
22
+
23
+ - Generate the correct output files (BaselineReports.html,
24
+ ScubaResults.json, etc)
25
+ - Check the content of html files, verify href attributes are
26
+ correct, etc
27
+ - Check if ScubaResults.json contains errors in the summary. If errors
28
+ exist, then either API calls or functions produced exceptions which
29
+ need to be handled
30
+ """
31
+
32
+ @staticmethod
33
+ def test_scubagoggles_output(subjectemail: str):
34
+ """
35
+ Test if the `scubagoggles gws` command generates correct output for
36
+ all baselines.
37
+
38
+ Args:
39
+ subjectemail: The email address of a user for the service account.
40
+ If None (or the empty string), the user's OAuth credentials are
41
+ used instead.
42
+ """
43
+
44
+ svc_account_option = (f' --subjectemail {subjectemail}' if subjectemail
45
+ else '')
46
+ command = f'scubagoggles gws{svc_account_option} --quiet '
47
+
48
+ try:
49
+ subprocess.run(command, shell=True, check=True)
50
+ output_path = get_output_path()
51
+ output: list = verify_output_type(output_path, [])
52
+ report_dir = sample_report_dir()
53
+ required_entries = get_required_entries(report_dir, [])
54
+ verify_all_outputs_exist(output, required_entries)
55
+ except (OSError, ValueError, Exception) as e:
56
+ pytest.fail(f'An error occurred, {e}')
57
+
58
+ @staticmethod
59
+ def test_scubaresults():
60
+ """
61
+ Determine if ScubaResults.json contains API errors or exceptions.
62
+ """
63
+ try:
64
+ output_path = get_output_path()
65
+ verify_scubaresults(output_path)
66
+ except (ValueError, Exception) as e:
67
+ pytest.fail(f'An error occurred, {e}')
68
+
69
+ @staticmethod
70
+ def test_scubagoggles_report(browser, customerdomain):
71
+ """
72
+ Test if the generated baseline reports are correct,
73
+ i.e. BaselineReports.html, CalendarReport.html, ChatReport.html
74
+ """
75
+ try:
76
+ output_path = get_output_path()
77
+ report_path: str = top_report_url(output_path)
78
+ browser.get(report_path)
79
+ run_selenium(browser, customerdomain)
80
+ except (ValueError, AssertionError, Exception) as e:
81
+ browser.quit()
82
+ pytest.fail(f'An error occurred, {e}')