Skip to content

Commit

Permalink
Update labels, using testing folder structure for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkst-pieter committed Dec 3, 2024
1 parent 68b886f commit 6b67919
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 20 deletions.
60 changes: 60 additions & 0 deletions canarytokens/windows_fake_fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,65 @@
)


DUMMY_FOLDER_STRUCTURE = [
{
"name": "Projects",
"type": "folder",
"children": [
{
"name": "Project A",
"type": "folder",
"children": [
{"name": "Doc1.pdf", "type": "pdf"},
{"name": "Doc2.docx", "type": "docx"},
{"name": "Doc3.xls", "type": "xls"},
{"name": "Doc4.doc", "type": "doc"},
],
},
{
"name": "Project B",
"type": "folder",
"children": [
{"name": "Doc A.pdf", "type": "pdf"},
{"name": "Doc B.docx", "type": "docx"},
{"name": "Doc C.xls", "type": "xls"},
{"name": "Doc D.doc", "type": "doc"},
],
},
],
},
{
"name": "Testing",
"type": "folder",
"children": [
{"name": "Doc1.pdf", "type": "pdf"},
{"name": "Doc2.xlsx", "type": "xls"},
{"name": "Doc3.doc", "type": "doc"},
],
},
{
"name": "Deployment",
"type": "folder",
"children": [
{"name": "doc a.pdf", "type": "pdf"},
{"name": "doc b.docx", "type": "docx"},
{"name": "doc c.xls", "type": "xls"},
{"name": "doc d.doc", "type": "doc"},
],
},
{
"name": "Invoicing",
"type": "folder",
"children": [
{"name": "Invoice A.pdf", "type": "pdf"},
{"name": "Invoice B.xlsx", "type": "xls"},
{"name": "Invoice C.docx", "type": "docx"},
{"name": "Invoice D.doc", "type": "doc"},
],
},
]


FOLDER_MAP = {
"personal_finances": PERSONAL_FINANCES_STRUCTURE,
"home_network": HOME_NETWORK_STRUCTURE,
Expand All @@ -41,6 +100,7 @@
"med_tech": MED_TECH_STRUCTURE,
"network_admin": NETWORK_ADMIN_STRUCTURE,
"security_admin": SECURITY_ADMIN_STRUCTURE,
"testing": DUMMY_FOLDER_STRUCTURE,
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ const options: SelectOption[] = [
{value: 'home_network', label: 'Home Network'},
{value: 'personal_correspondence', label: 'Personal Correspondence'},
{value: 'photo_archive', label: 'Photo Archive'},
{value: 'security_admin', label: 'Cyber Security'},
{value: 'defense', label: 'Defense'},
{value: 'med_tech', label: 'Medical Technician'},
{value: 'network_admin', label: 'Network Admin'},
{value: 'security_admin', label: 'Security Admin'},
{value: 'network_admin', label: 'IT'},
{value: 'med_tech', label: 'Medical'},
];
</script>
34 changes: 17 additions & 17 deletions tests/integration/test_windows_fake_fs_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ def test_windows_fake_fs_token_fires(

# Create a Windows Fake File System token request
memo = "Test stuff break stuff test stuff sometimes build stuff"
root_dir = r"C:\Secrets"
file_structure = "home_network"
root_dir = r"C:\Testing"
file_structure = "testing"

token_request = WindowsFakeFSTokenRequest(
webhook_url=webhook_receiver,
Expand Down Expand Up @@ -97,23 +97,23 @@ def test_windows_fake_fs_token_fires(
[
(
[
r"C:\Secrets["
r"C:\Secrets<"
r"C:\Secrets>"
r"C:\Secrets:"
r'C:\Secrets"'
r"C:\Secrets/"
r"C:\Secrets\\"
r"C:\Secrets|"
r"C:\Secrets?"
r"C:\Secrets*"
r"C:\Secrets]"
r"C:\Testing["
r"C:\Testing<"
r"C:\Testing>"
r"C:\Testing:"
r'C:\Testing"'
r"C:\Testing/"
r"C:\Testing\\"
r"C:\Testing|"
r"C:\Testing?"
r"C:\Testing*"
r"C:\Testing]"
],
"windows_fake_fs_root contains invalid Windows Path Characters.",
),
([r"C:\Secrets "], "windows_fake_fs_root cannot end with a space."),
([r"C:\Secrets."], "windows_fake_fs_root cannot end with a fullstop."),
([r"Secrets"], "windows_fake_fs_root does not have a drive letter specified."),
([r"C:\Testing "], "windows_fake_fs_root cannot end with a space."),
([r"C:\Testing."], "windows_fake_fs_root cannot end with a fullstop."),
([r"Testing"], "windows_fake_fs_root does not have a drive letter specified."),
],
)
def test_windows_fake_fs_token_validator(
Expand All @@ -130,7 +130,7 @@ def test_windows_fake_fs_token_validator(
run_or_skip(version, runv2=runv2, runv3=runv3)

memo = "Testing"
file_structure = "home_network"
file_structure = "testing"

for root_dir in directories:
with pytest.raises(ValueError, match=expected_error_message):
Expand Down

0 comments on commit 6b67919

Please sign in to comment.