Skip to content

Commit

Permalink
Assert newlines in helptext
Browse files Browse the repository at this point in the history
  • Loading branch information
asmacdo committed Sep 27, 2024
1 parent 50d61df commit 7af83a4
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions dandi/tests/test_helptext.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import pytest

Check notice

Code scanning / CodeQL

Unused import Note test

Import of 'pytest' is not used.

import subprocess


def get_helptext(command):
result = subprocess.run([*command, '--help'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
return result.stdout

def test_resource_identifier_helptext():
# The \n chars must be included for correct rendering
correct = "Accepted resource identifier patterns:\n - DANDI:<dandiset id>[/<version>]\n"

ls_helptext = get_helptext(['dandi', 'ls'])
assert correct in ls_helptext

download_helptext = get_helptext(['dandi', 'download'])
assert correct in download_helptext

0 comments on commit 7af83a4

Please sign in to comment.