Skip to content
Browse files

Added test to verify backend description line

  • Loading branch information...
1 parent cfa927a commit 798a5601a23b991b7fd4c0a2ca1867b70ae0a6ba @simoncadman committed
Showing with 12 additions and 2 deletions.
  1. +4 −1 backend.py
  2. +8 −1 test_backend.py
View
5 backend.py
@@ -46,10 +46,13 @@ def is_exe(fpath):
return exe_file
return None
+def getBackendDescription ( ) :
+ return "network cloudprint \"Unknown\" \"Google Cloud Print\""
+
if __name__ == '__main__':
if len(sys.argv) == 1:
- print("network cloudprint \"Unknown\" \"Google Cloud Print\"")
+ print(getBackendDescription())
try:
libpath = "/usr/lib/cloudprint-cups/"
View
9 test_backend.py
@@ -28,4 +28,11 @@ def test_whichFails():
def test_whichSuceeds():
assert backend.which('bash') == '/bin/bash'
-
+
+def test_backendDescription():
+ import re
+ backendtest = re.compile("^\w+ \w+ \"\w+\" \".+\"$")
+ description = backend.getBackendDescription()
+ assert isinstance(description, str)
+ assert description.startswith('network')
+ assert backendtest.match(description) != None

0 comments on commit 798a560

Please sign in to comment.
Something went wrong with that request. Please try again.