summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2017-01-22 13:33:08 +0200
committerLars Wirzenius <liw@liw.fi>2017-01-22 13:33:08 +0200
commit18fc3a57881ad1482f809de702cd507ef0f4c32e (patch)
treee381fc72802712852b2994a60582497205885695
parent1193f3eee3707c12416fa6f0b9870e5dedfc486f (diff)
downloadserver-yarns-18fc3a57881ad1482f809de702cd507ef0f4c32e.tar.gz
Add scenario for checking Gitano help works
-rw-r--r--70-git.liw.fi.yarn6
-rw-r--r--900-implements.yarn42
2 files changed, 48 insertions, 0 deletions
diff --git a/70-git.liw.fi.yarn b/70-git.liw.fi.yarn
index 3e96f89..aff3f34 100644
--- a/70-git.liw.fi.yarn
+++ b/70-git.liw.fi.yarn
@@ -11,3 +11,9 @@ cgit for browing public repositories.
AND HTTP body matches "cgit"
AND HTTP body matches "obnam"
AND HTTP body matches "bumper"
+
+It must also have Gitano accessible over ssh.
+
+ WHEN user runs Gitano help
+ THEN exit code is 0
+ AND standard error matches "Gitano"
diff --git a/900-implements.yarn b/900-implements.yarn
index 0195a72..0855bb5 100644
--- a/900-implements.yarn
+++ b/900-implements.yarn
@@ -32,3 +32,45 @@
pattern = h.get_next_match()
m = re.search(pattern, body)
h.assertNotEqual(m, None)
+
+## Running commands and checking results
+
+ IMPLEMENTS WHEN user runs Gitano (.*)
+ import os, re, cliapp, yarnhelper
+ h = yarnhelper.YarnHelper()
+ server = os.environ['SERVER']
+ cmd = h.get_next_match()
+ argv = ['ssh', 'git@' + server] + cmd.split()
+ exit, out, err = cliapp.runcmd_unchecked(argv)
+ h.set_variable('argv', argv)
+ h.set_variable('exit', int(exit))
+ h.set_variable('stdout', out)
+ h.set_variable('stderr', err)
+
+ IMPLEMENTS THEN exit code is (\d+)
+ import yarnhelper
+ h = yarnhelper.YarnHelper()
+ code = h.get_next_match()
+ h.assertEqual(h.get_variable('exit'), int(code))
+
+ IMPLEMENTS THEN standard output matches "(.+)"
+ import re, cliapp, yarnhelper
+ h = yarnhelper.YarnHelper()
+ pattern = h.get_next_match()
+ stdout = h.get_variable('stdout')
+ m = re.search(pattern, stdout)
+ print 'pattern:', repr(pattern)
+ print 'argv:', repr(h.get_variable('argv'))
+ print 'stdout:', repr(stdout)
+ h.assertNotEqual(m, None)
+
+ IMPLEMENTS THEN standard error matches "(.+)"
+ import re, cliapp, yarnhelper
+ h = yarnhelper.YarnHelper()
+ pattern = h.get_next_match()
+ stderr = h.get_variable('stderr')
+ m = re.search(pattern, stderr)
+ print 'pattern:', repr(pattern)
+ print 'argv:', repr(h.get_variable('argv'))
+ print 'stderr:', repr(stderr)
+ h.assertNotEqual(m, None)