From 18fc3a57881ad1482f809de702cd507ef0f4c32e Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 22 Jan 2017 13:33:08 +0200 Subject: Add scenario for checking Gitano help works --- 70-git.liw.fi.yarn | 6 ++++++ 900-implements.yarn | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) 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) -- cgit v1.2.1