summaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--testing/__init__.py0
-rw-r--r--testing/resources/aws_config_with_multiple_sections.ini12
-rw-r--r--testing/resources/aws_config_with_secret.ini4
-rw-r--r--testing/resources/aws_config_with_secret_and_session_token.ini5
-rw-r--r--testing/resources/aws_config_with_session_token.ini3
-rw-r--r--testing/resources/aws_config_without_secrets.ini3
-rw-r--r--testing/resources/aws_config_without_secrets_with_spaces.ini4
-rw-r--r--testing/resources/bad_json.notjson3
-rw-r--r--testing/resources/bad_json_latin1.nonjson3
-rw-r--r--testing/resources/bad_xml.notxml1
-rw-r--r--testing/resources/bad_yaml.notyaml2
-rw-r--r--testing/resources/cannot_parse_ast.notpy1
-rw-r--r--testing/resources/does_exist0
-rw-r--r--testing/resources/duplicate_key_json.notjson4
-rw-r--r--testing/resources/non_ascii_pretty_formatted_json.json10
-rw-r--r--testing/resources/nonsense.txt6
-rw-r--r--testing/resources/not_pretty_formatted_json.json6
-rw-r--r--testing/resources/ok_json.json3
-rw-r--r--testing/resources/ok_xml.xml4
-rw-r--r--testing/resources/ok_yaml.yaml1
-rw-r--r--testing/resources/pretty_formatted_json.json9
-rw-r--r--testing/resources/tab_pretty_formatted_json.json9
-rw-r--r--testing/resources/top_sorted_json.json16
-rw-r--r--testing/resources/unsorted_pretty_formatted_json.json9
-rw-r--r--testing/util.py16
25 files changed, 134 insertions, 0 deletions
diff --git a/testing/__init__.py b/testing/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/testing/__init__.py
diff --git a/testing/resources/aws_config_with_multiple_sections.ini b/testing/resources/aws_config_with_multiple_sections.ini
new file mode 100644
index 0000000..2053b9a
--- /dev/null
+++ b/testing/resources/aws_config_with_multiple_sections.ini
@@ -0,0 +1,12 @@
+# file with AWS access key ids, AWS secret access keys and AWS session tokens in multiple sections
+[default]
+aws_access_key_id = AKIASLARTIBARTFAST11
+aws_secret_access_key = 7xebzorgm5143ouge9gvepxb2z70bsb2rtrh099e
+[production]
+aws_access_key_id = AKIAVOGONSVOGONS0042
+aws_secret_access_key = z2rpgs5uit782eapz5l1z0y2lurtsyyk6hcfozlb
+[staging]
+aws_access_key_id = AKIAJIMMINYCRICKET0A
+aws_secret_access_key = ixswosj8gz3wuik405jl9k3vdajsnxfhnpui38ez
+[test]
+aws_session_token = foo
diff --git a/testing/resources/aws_config_with_secret.ini b/testing/resources/aws_config_with_secret.ini
new file mode 100644
index 0000000..bb55017
--- /dev/null
+++ b/testing/resources/aws_config_with_secret.ini
@@ -0,0 +1,4 @@
+# file with an AWS access key id and an AWS secret access key
+[production]
+aws_access_key_id = AKIAVOGONSVOGONS0042
+aws_secret_access_key = z2rpgs5uit782eapz5l1z0y2lurtsyyk6hcfozlb
diff --git a/testing/resources/aws_config_with_secret_and_session_token.ini b/testing/resources/aws_config_with_secret_and_session_token.ini
new file mode 100644
index 0000000..4496765
--- /dev/null
+++ b/testing/resources/aws_config_with_secret_and_session_token.ini
@@ -0,0 +1,5 @@
+# file with an AWS access key id, an AWS secret access key and an AWS session token
+[production]
+aws_access_key_id = AKIAVOGONSVOGONS0042
+aws_secret_access_key = z2rpgs5uit782eapz5l1z0y2lurtsyyk6hcfozlb
+aws_session_token = foo
diff --git a/testing/resources/aws_config_with_session_token.ini b/testing/resources/aws_config_with_session_token.ini
new file mode 100644
index 0000000..b03f127
--- /dev/null
+++ b/testing/resources/aws_config_with_session_token.ini
@@ -0,0 +1,3 @@
+# file with an AWS session token
+[production]
+aws_session_token = foo
diff --git a/testing/resources/aws_config_without_secrets.ini b/testing/resources/aws_config_without_secrets.ini
new file mode 100644
index 0000000..26d1692
--- /dev/null
+++ b/testing/resources/aws_config_without_secrets.ini
@@ -0,0 +1,3 @@
+# file with an AWS access key id but no AWS secret access key
+[production]
+aws_access_key_id = AKIASLARTIBARTFAST11
diff --git a/testing/resources/aws_config_without_secrets_with_spaces.ini b/testing/resources/aws_config_without_secrets_with_spaces.ini
new file mode 100644
index 0000000..b169952
--- /dev/null
+++ b/testing/resources/aws_config_without_secrets_with_spaces.ini
@@ -0,0 +1,4 @@
+# file with an AWS access key id but no valid AWS secret access key only space characters
+[production]
+aws_access_key_id = AKIASLARTARGENTINA86
+aws_secret_access_key =
diff --git a/testing/resources/bad_json.notjson b/testing/resources/bad_json.notjson
new file mode 100644
index 0000000..66f1111
--- /dev/null
+++ b/testing/resources/bad_json.notjson
@@ -0,0 +1,3 @@
+{
+ "hello": "world",
+}
diff --git a/testing/resources/bad_json_latin1.nonjson b/testing/resources/bad_json_latin1.nonjson
new file mode 100644
index 0000000..3b39473
--- /dev/null
+++ b/testing/resources/bad_json_latin1.nonjson
@@ -0,0 +1,3 @@
+{
+ "": 1,
+}
diff --git a/testing/resources/bad_xml.notxml b/testing/resources/bad_xml.notxml
new file mode 100644
index 0000000..e6edcc7
--- /dev/null
+++ b/testing/resources/bad_xml.notxml
@@ -0,0 +1 @@
+<im><not><terminated><lol>
diff --git a/testing/resources/bad_yaml.notyaml b/testing/resources/bad_yaml.notyaml
new file mode 100644
index 0000000..3767076
--- /dev/null
+++ b/testing/resources/bad_yaml.notyaml
@@ -0,0 +1,2 @@
+# It's surprisingly hard to make invalid yaml
+a: "
diff --git a/testing/resources/cannot_parse_ast.notpy b/testing/resources/cannot_parse_ast.notpy
new file mode 100644
index 0000000..150ca8d
--- /dev/null
+++ b/testing/resources/cannot_parse_ast.notpy
@@ -0,0 +1 @@
+if True:
diff --git a/testing/resources/does_exist b/testing/resources/does_exist
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/testing/resources/does_exist
diff --git a/testing/resources/duplicate_key_json.notjson b/testing/resources/duplicate_key_json.notjson
new file mode 100644
index 0000000..8a43262
--- /dev/null
+++ b/testing/resources/duplicate_key_json.notjson
@@ -0,0 +1,4 @@
+{
+ "hello": "world",
+ "hello": "planet"
+}
diff --git a/testing/resources/non_ascii_pretty_formatted_json.json b/testing/resources/non_ascii_pretty_formatted_json.json
new file mode 100644
index 0000000..05d0d00
--- /dev/null
+++ b/testing/resources/non_ascii_pretty_formatted_json.json
@@ -0,0 +1,10 @@
+{
+ "alist": [
+ 2,
+ 34,
+ 234
+ ],
+ "blah": null,
+ "foo": "bar",
+ "non_ascii": "中文にほんご한국어"
+}
diff --git a/testing/resources/nonsense.txt b/testing/resources/nonsense.txt
new file mode 100644
index 0000000..6c7fe83
--- /dev/null
+++ b/testing/resources/nonsense.txt
@@ -0,0 +1,6 @@
+some nonsense text generated at https://baconipsum.com/
+Bacon ipsum dolor amet ipsum fugiat pastrami pork belly, non ball tip flank est short loin. Fatback landjaeger meatloaf flank. Sunt boudin duis occaecat mollit velit. Capicola lorem frankfurter doner strip steak jerky rump elit laborum mollit. Venison cupidatat laboris duis ut chuck proident mollit. Minim do rump, eu jerky ham turkey chuck in tempor venison pariatur voluptate landjaeger beef.
+
+Duis aliqua esse, exercitation in ball tip ut capicola sausage dolore frankfurter occaecat. Duis in nulla consequat salami. Est shoulder tempor commodo shankle short ribs. In meatball aliqua boudin tenderloin, meatloaf leberkas hamburger quis pig dolore ea eu. Ham hock ex laboris, filet mignon sunt doner cillum short loin prosciutto voluptate.
+
+Occaecat pork doner meatloaf nulla biltong ullamco tenderloin culpa brisket. Culpa jowl ea shank t-bone shankle voluptate nostrud incididunt leberkas pork loin. Bacon kevin jerky pork belly t-bone labore duis. Boudin corned beef adipisicing aute, fatback ribeye nulla pancetta anim venison. Short ribs kevin pastrami cow drumstick velit. Turkey exercitation jowl, fatback labore swine do voluptate.
diff --git a/testing/resources/not_pretty_formatted_json.json b/testing/resources/not_pretty_formatted_json.json
new file mode 100644
index 0000000..58b1d02
--- /dev/null
+++ b/testing/resources/not_pretty_formatted_json.json
@@ -0,0 +1,6 @@
+{
+ "foo":
+ "bar",
+ "alist": [2, 34, 234],
+ "blah": null
+}
diff --git a/testing/resources/ok_json.json b/testing/resources/ok_json.json
new file mode 100644
index 0000000..ea50c5d
--- /dev/null
+++ b/testing/resources/ok_json.json
@@ -0,0 +1,3 @@
+{
+ "hello": "world"
+}
diff --git a/testing/resources/ok_xml.xml b/testing/resources/ok_xml.xml
new file mode 100644
index 0000000..134f37c
--- /dev/null
+++ b/testing/resources/ok_xml.xml
@@ -0,0 +1,4 @@
+<document>
+ <hello>Hi</hello>
+ <world>Earth</world>
+</document>
diff --git a/testing/resources/ok_yaml.yaml b/testing/resources/ok_yaml.yaml
new file mode 100644
index 0000000..1679c64
--- /dev/null
+++ b/testing/resources/ok_yaml.yaml
@@ -0,0 +1 @@
+im: ok yaml
diff --git a/testing/resources/pretty_formatted_json.json b/testing/resources/pretty_formatted_json.json
new file mode 100644
index 0000000..ae9b1b2
--- /dev/null
+++ b/testing/resources/pretty_formatted_json.json
@@ -0,0 +1,9 @@
+{
+ "alist": [
+ 2,
+ 34,
+ 234
+ ],
+ "blah": null,
+ "foo": "bar"
+}
diff --git a/testing/resources/tab_pretty_formatted_json.json b/testing/resources/tab_pretty_formatted_json.json
new file mode 100644
index 0000000..abda648
--- /dev/null
+++ b/testing/resources/tab_pretty_formatted_json.json
@@ -0,0 +1,9 @@
+{
+ "alist": [
+ 2,
+ 34,
+ 234
+ ],
+ "blah": null,
+ "foo": "bar"
+}
diff --git a/testing/resources/top_sorted_json.json b/testing/resources/top_sorted_json.json
new file mode 100644
index 0000000..62083e7
--- /dev/null
+++ b/testing/resources/top_sorted_json.json
@@ -0,0 +1,16 @@
+{
+ "01-alist": [
+ 2,
+ 34,
+ 234
+ ],
+ "alist": [
+ 2,
+ 34,
+ 234
+ ],
+ "00-foo": "bar",
+ "02-blah": null,
+ "blah": null,
+ "foo": "bar"
+}
diff --git a/testing/resources/unsorted_pretty_formatted_json.json b/testing/resources/unsorted_pretty_formatted_json.json
new file mode 100644
index 0000000..fe8bf5e
--- /dev/null
+++ b/testing/resources/unsorted_pretty_formatted_json.json
@@ -0,0 +1,9 @@
+{
+ "foo": "bar",
+ "alist": [
+ 34,
+ 2,
+ 234
+ ],
+ "blah": null
+}
diff --git a/testing/util.py b/testing/util.py
new file mode 100644
index 0000000..2bbbe64
--- /dev/null
+++ b/testing/util.py
@@ -0,0 +1,16 @@
+from __future__ import annotations
+
+import os.path
+import subprocess
+
+
+TESTING_DIR = os.path.abspath(os.path.dirname(__file__))
+
+
+def get_resource_path(path):
+ return os.path.join(TESTING_DIR, 'resources', path)
+
+
+def git_commit(*args, **kwargs):
+ cmd = ('git', 'commit', '--no-gpg-sign', '--no-verify', '--no-edit', *args)
+ subprocess.check_call(cmd, **kwargs)