mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-25 01:16:14 +01:00
Merge pull request #1421 from dmach/test-submitrequest-supersede
Add behave tests for 'createrequest -a submit --supersede' and 'submitrequest --supersede'
This commit is contained in:
commit
bca89c2f4a
37
behave/features/createrequest.feature
Normal file
37
behave/features/createrequest.feature
Normal file
@ -0,0 +1,37 @@
|
||||
Feature: `osc createrequest` command
|
||||
|
||||
|
||||
# common steps for all scenarios
|
||||
Background:
|
||||
Given I set working directory to "{context.osc.temp}"
|
||||
And I execute osc with args "branch test:factory/test-pkgA"
|
||||
# the package gets forked from the devel project!
|
||||
And I execute osc with args "co home:Admin:branches:test:devel/test-pkgA"
|
||||
And I set working directory to "{context.osc.temp}/home:Admin:branches:test:devel/test-pkgA"
|
||||
|
||||
|
||||
@destructive
|
||||
Scenario: Run `osc createrequest`
|
||||
When I copy file "{context.fixtures}/pac/test-pkgA-1.spec" to "{context.osc.temp}/home:Admin:branches:test:devel/test-pkgA/new_file"
|
||||
And I execute osc with args "add new_file"
|
||||
And I execute osc with args "ci -m 'commit description'"
|
||||
And I execute osc with args "createrequest -a submit -m 'request description'"
|
||||
Then the exit code is 0
|
||||
|
||||
|
||||
@destructive
|
||||
Scenario: Run `osc createrequest --supersede`
|
||||
Given I copy file "{context.fixtures}/pac/test-pkgA-1.spec" to "{context.osc.temp}/home:Admin:branches:test:devel/test-pkgA/new_file"
|
||||
And I execute osc with args "add new_file"
|
||||
And I execute osc with args "ci -m 'commit description'"
|
||||
And I execute osc with args "createrequest -a submit -m 'request description'"
|
||||
And the exit code is 0
|
||||
And I execute osc with args "api /request/1"
|
||||
And stdout doesn't contain "<state name=\"superseded\">"
|
||||
When I copy file "{context.fixtures}/pac/test-pkgA-1.spec" to "{context.osc.temp}/home:Admin:branches:test:devel/test-pkgA/another_file"
|
||||
And I execute osc with args "add new_file"
|
||||
And I execute osc with args "ci -m 'commit description'"
|
||||
And I execute osc with args "createrequest -a submit -m 'request description' --supersede 1"
|
||||
Then the exit code is 0
|
||||
And I execute osc with args "api /request/1"
|
||||
And stdout contains "<state name=\"superseded\".*superseded_by=\"2\">"
|
@ -1,5 +1,6 @@
|
||||
import errno
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
|
||||
@ -86,14 +87,28 @@ def run_in_context(context, cmd, can_fail=False, **run_args):
|
||||
def step_impl(context, text):
|
||||
if re.search(text.format(context=context), context.cmd_stdout):
|
||||
return
|
||||
raise AssertionError("Stdout doesn't contain: %s" % text)
|
||||
raise AssertionError("Stdout doesn't contain expected pattern: %s" % text)
|
||||
|
||||
|
||||
@behave.step("stdout doesn't contain \"{text}\"")
|
||||
def step_impl(context, text):
|
||||
if not re.search(text.format(context=context), context.cmd_stdout):
|
||||
return
|
||||
raise AssertionError("Stdout is not supposed to contain pattern: %s" % text)
|
||||
|
||||
|
||||
@behave.step("stderr contains \"{text}\"")
|
||||
def step_impl(context, text):
|
||||
if re.search(text.format(context=context), context.cmd_stderr):
|
||||
return
|
||||
raise AssertionError("Stderr doesn't contain: %s" % text)
|
||||
raise AssertionError("Stderr doesn't contain expected pattern: %s" % text)
|
||||
|
||||
|
||||
@behave.step("stderr doesn't contain \"{text}\"")
|
||||
def step_impl(context, text):
|
||||
if not re.search(text.format(context=context), context.cmd_stderr):
|
||||
return
|
||||
raise AssertionError("Stderr is not supposed to contain pattern: %s" % text)
|
||||
|
||||
|
||||
@behave.step("stdout is")
|
||||
|
37
behave/features/submitrequest.feature
Normal file
37
behave/features/submitrequest.feature
Normal file
@ -0,0 +1,37 @@
|
||||
Feature: `osc submitrequest` command
|
||||
|
||||
|
||||
# common steps for all scenarios
|
||||
Background:
|
||||
Given I set working directory to "{context.osc.temp}"
|
||||
And I execute osc with args "branch test:factory/test-pkgA"
|
||||
# the package gets forked from the devel project!
|
||||
And I execute osc with args "co home:Admin:branches:test:devel/test-pkgA"
|
||||
And I set working directory to "{context.osc.temp}/home:Admin:branches:test:devel/test-pkgA"
|
||||
|
||||
|
||||
@destructive
|
||||
Scenario: Run `osc submitrequest`
|
||||
When I copy file "{context.fixtures}/pac/test-pkgA-1.spec" to "{context.osc.temp}/home:Admin:branches:test:devel/test-pkgA/new_file"
|
||||
And I execute osc with args "add new_file"
|
||||
And I execute osc with args "ci -m 'commit description'"
|
||||
And I execute osc with args "submitrequest -m 'request description'"
|
||||
Then the exit code is 0
|
||||
|
||||
|
||||
@destructive
|
||||
Scenario: Run `osc submitrequest --supersede`
|
||||
Given I copy file "{context.fixtures}/pac/test-pkgA-1.spec" to "{context.osc.temp}/home:Admin:branches:test:devel/test-pkgA/new_file"
|
||||
And I execute osc with args "add new_file"
|
||||
And I execute osc with args "ci -m 'commit description'"
|
||||
And I execute osc with args "submitrequest -m 'request description'"
|
||||
And the exit code is 0
|
||||
And I execute osc with args "api /request/1"
|
||||
And stdout doesn't contain "<state name=\"superseded\">"
|
||||
When I copy file "{context.fixtures}/pac/test-pkgA-1.spec" to "{context.osc.temp}/home:Admin:branches:test:devel/test-pkgA/another_file"
|
||||
And I execute osc with args "add new_file"
|
||||
And I execute osc with args "ci -m 'commit description'"
|
||||
And I execute osc with args "submitrequest -m 'request description' --supersede 1"
|
||||
Then the exit code is 0
|
||||
And I execute osc with args "api /request/1"
|
||||
And stdout contains "<state name=\"superseded\".*superseded_by=\"2\">"
|
Loading…
Reference in New Issue
Block a user