mirror of
https://github.com/openSUSE/osc.git
synced 2025-03-03 14:42:11 +01:00
- added testcase for the "def commit" method + _missing_ log message from a5a0917fce7124f9cc8458a9ee41ced521aa502e
missing log for a5a0917fce7124f9cc8458a9ee41ced521aa502e: - added support for @POST, @PUT, @DELETE decorators - support optional "exception" keyword arg for the decorators (the specified exception will be raised before returning the response) - moved "_check_digests" into the common module
This commit is contained in:
parent
3cf8a5bf88
commit
9c2f1d85ca
104
tests/commit_fixtures/oscrc
Normal file
104
tests/commit_fixtures/oscrc
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
[general]
|
||||||
|
# URL to access API server, e.g. https://api.opensuse.org
|
||||||
|
# you also need a section [https://api.opensuse.org] with the credentials
|
||||||
|
apiurl = http://localhost
|
||||||
|
# Downloaded packages are cached here. Must be writable by you.
|
||||||
|
#packagecachedir = /var/tmp/osbuild-packagecache
|
||||||
|
# Wrapper to call build as root (sudo, su -, ...)
|
||||||
|
#su-wrapper = su -c
|
||||||
|
# rootdir to setup the chroot environment
|
||||||
|
# can contain %(repo)s, %(arch)s, %(project)s and %(package)s for replacement, e.g.
|
||||||
|
# /srv/oscbuild/%(repo)s-%(arch)s or
|
||||||
|
# /srv/oscbuild/%(repo)s-%(arch)s-%(project)s-%(package)s
|
||||||
|
#build-root = /var/tmp/build-root
|
||||||
|
# compile with N jobs (default: "getconf _NPROCESSORS_ONLN")
|
||||||
|
#build-jobs = N
|
||||||
|
# build-type to use - values can be (depending on the capabilities of the 'build' script)
|
||||||
|
# empty - chroot build
|
||||||
|
# kvm - kvm VM build (needs build-device, build-swap, build-memory)
|
||||||
|
# xen - xen VM build (needs build-device, build-swap, build-memory)
|
||||||
|
# experimental:
|
||||||
|
# qemu - qemu VM build
|
||||||
|
# lxc - lxc build
|
||||||
|
#build-type =
|
||||||
|
# build-device is the disk-image file to use as root for VM builds
|
||||||
|
# e.g. /var/tmp/FILE.root
|
||||||
|
#build-device = /var/tmp/FILE.root
|
||||||
|
# build-swap is the disk-image to use as swap for VM builds
|
||||||
|
# e.g. /var/tmp/FILE.swap
|
||||||
|
#build-swap = /var/tmp/FILE.swap
|
||||||
|
# build-memory is the amount of memory used in the VM
|
||||||
|
# value in MB - e.g. 512
|
||||||
|
#build-memory = 512
|
||||||
|
# build-vmdisk-rootsize is the size of the disk-image used as root in a VM build
|
||||||
|
# values in MB - e.g. 4096
|
||||||
|
#build-vmdisk-rootsize = 4096
|
||||||
|
# build-vmdisk-swapsize is the size of the disk-image used as swap in a VM build
|
||||||
|
# values in MB - e.g. 1024
|
||||||
|
#build-vmdisk-swapsize = 1024
|
||||||
|
# Numeric uid:gid to assign to the "abuild" user in the build-root
|
||||||
|
# or "caller" to use the current users uid:gid
|
||||||
|
# This is convenient when sharing the buildroot with ordinary userids
|
||||||
|
# on the host.
|
||||||
|
# This should not be 0
|
||||||
|
# build-uid =
|
||||||
|
# extra packages to install when building packages locally (osc build)
|
||||||
|
# this corresponds to osc build's -x option and can be overridden with that
|
||||||
|
# -x '' can also be given on the command line to override this setting, or
|
||||||
|
# you can have an empty setting here.
|
||||||
|
#extra-pkgs = vim gdb strace
|
||||||
|
# build platform is used if the platform argument is omitted to osc build
|
||||||
|
#build_repository = openSUSE_Factory
|
||||||
|
# default project for getpac or bco
|
||||||
|
#getpac_default_project = openSUSE:Factory
|
||||||
|
# alternate filesystem layout: have multiple subdirs, where colons were.
|
||||||
|
#checkout_no_colon = 0
|
||||||
|
# local files to ignore with status, addremove, ....
|
||||||
|
#exclude_glob = .osc CVS .svn .* _linkerror *~ #*# *.orig *.bak *.changes.*
|
||||||
|
# keep passwords in plaintext. If you see this comment, your osc
|
||||||
|
# already uses the encrypted password, and only keeps them in plain text
|
||||||
|
# for backwards compatibility. Default will change to 0 in future releases.
|
||||||
|
# You can remove the plaintext password without harm, if you do not need
|
||||||
|
# backwards compatibility.
|
||||||
|
#plaintext_passwd = 1
|
||||||
|
# limit the age of requests shown with 'osc req list'.
|
||||||
|
# this is a default only, can be overridden by 'osc req list -D NNN'
|
||||||
|
# Use 0 for unlimted.
|
||||||
|
#request_list_days = 0
|
||||||
|
# show info useful for debugging
|
||||||
|
#debug = 1
|
||||||
|
# show HTTP traffic useful for debugging
|
||||||
|
#http_debug = 1
|
||||||
|
# Skip signature verification of packages used for build.
|
||||||
|
#no_verify = 1
|
||||||
|
# jump into the debugger in case of errors
|
||||||
|
#post_mortem = 1
|
||||||
|
# print call traces in case of errors
|
||||||
|
#traceback = 1
|
||||||
|
# use KDE/Gnome/MacOS/Windows keyring for credentials if available
|
||||||
|
#use_keyring = 1
|
||||||
|
# check for unversioned/removed files before commit
|
||||||
|
#check_filelist = 1
|
||||||
|
# check for pending requests after executing an action (e.g. checkout, update, commit)
|
||||||
|
#check_for_request_on_action = 0
|
||||||
|
# what to do with the source package if the submitrequest has been accepted. If
|
||||||
|
# nothing is specified the API default is used
|
||||||
|
#submitrequest_on_accept_action = cleanup|update|noupdate
|
||||||
|
#review requests interactively (default: off)
|
||||||
|
#request_show_review = 1
|
||||||
|
# Directory with executables to validate sources, esp before committing
|
||||||
|
#source_validator_directory = /usr/lib/osc/source_validators
|
||||||
|
|
||||||
|
[http://localhost]
|
||||||
|
user = Admin
|
||||||
|
pass = opensuse
|
||||||
|
passx = QlpoOTFBWSZTWeTSblkAAAGBgAIBygAgADDACGNEHxaYXckU4UJDk0m5ZA==
|
||||||
|
# set aliases for this apiurl
|
||||||
|
# aliases = foo, bar
|
||||||
|
# email used in .changes, unless the one from osc meta prj <user> will be used
|
||||||
|
# email =
|
||||||
|
# additional headers to pass to a request, e.g. for special authentication
|
||||||
|
#http_headers = Host: foofoobar,
|
||||||
|
# User: mumblegack
|
||||||
|
# Force using of keyring for this API
|
||||||
|
#keyring = 1
|
1
tests/commit_fixtures/osctest/.osc/_apiurl
Normal file
1
tests/commit_fixtures/osctest/.osc/_apiurl
Normal file
@ -0,0 +1 @@
|
|||||||
|
http://localhost
|
1
tests/commit_fixtures/osctest/.osc/_packages
Normal file
1
tests/commit_fixtures/osctest/.osc/_packages
Normal file
@ -0,0 +1 @@
|
|||||||
|
<project name="osctest" />
|
1
tests/commit_fixtures/osctest/.osc/_project
Normal file
1
tests/commit_fixtures/osctest/.osc/_project
Normal file
@ -0,0 +1 @@
|
|||||||
|
osctest
|
1
tests/commit_fixtures/osctest/add/.osc/_apiurl
Normal file
1
tests/commit_fixtures/osctest/add/.osc/_apiurl
Normal file
@ -0,0 +1 @@
|
|||||||
|
http://localhost
|
5
tests/commit_fixtures/osctest/add/.osc/_files
Normal file
5
tests/commit_fixtures/osctest/add/.osc/_files
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<directory name="simple" rev="1" srcmd5="2df1eacfe03a3bec2112529e7f4dc39a" vrev="1">
|
||||||
|
<entry md5="0d62ceea6020d75154078a20d8c9f9ba" mtime="1282047302" name="foo" size="23" />
|
||||||
|
<entry md5="17b9e9e1a032ed44e7a584dc6303ffa8" mtime="1282047303" name="merge" size="48" />
|
||||||
|
<entry md5="7efa70f68983fad1cf487f69dedf93e9" mtime="1282047303" name="nochange" size="25" />
|
||||||
|
</directory>
|
1
tests/commit_fixtures/osctest/add/.osc/_osclib_version
Normal file
1
tests/commit_fixtures/osctest/add/.osc/_osclib_version
Normal file
@ -0,0 +1 @@
|
|||||||
|
1.0
|
1
tests/commit_fixtures/osctest/add/.osc/_package
Normal file
1
tests/commit_fixtures/osctest/add/.osc/_package
Normal file
@ -0,0 +1 @@
|
|||||||
|
add
|
1
tests/commit_fixtures/osctest/add/.osc/_project
Normal file
1
tests/commit_fixtures/osctest/add/.osc/_project
Normal file
@ -0,0 +1 @@
|
|||||||
|
osctest
|
1
tests/commit_fixtures/osctest/add/.osc/_to_be_added
Normal file
1
tests/commit_fixtures/osctest/add/.osc/_to_be_added
Normal file
@ -0,0 +1 @@
|
|||||||
|
add
|
1
tests/commit_fixtures/osctest/add/.osc/foo
Normal file
1
tests/commit_fixtures/osctest/add/.osc/foo
Normal file
@ -0,0 +1 @@
|
|||||||
|
This is a simple test.
|
4
tests/commit_fixtures/osctest/add/.osc/merge
Normal file
4
tests/commit_fixtures/osctest/add/.osc/merge
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
Is it
|
||||||
|
possible to
|
||||||
|
merge this file?
|
||||||
|
I hope so...
|
1
tests/commit_fixtures/osctest/add/.osc/nochange
Normal file
1
tests/commit_fixtures/osctest/add/.osc/nochange
Normal file
@ -0,0 +1 @@
|
|||||||
|
This file didn't change.
|
1
tests/commit_fixtures/osctest/add/add
Normal file
1
tests/commit_fixtures/osctest/add/add
Normal file
@ -0,0 +1 @@
|
|||||||
|
added file
|
0
tests/commit_fixtures/osctest/add/exists
Normal file
0
tests/commit_fixtures/osctest/add/exists
Normal file
1
tests/commit_fixtures/osctest/add/foo
Normal file
1
tests/commit_fixtures/osctest/add/foo
Normal file
@ -0,0 +1 @@
|
|||||||
|
This is a simple test.
|
4
tests/commit_fixtures/osctest/add/merge
Normal file
4
tests/commit_fixtures/osctest/add/merge
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
Is it
|
||||||
|
possible to
|
||||||
|
merge this file?
|
||||||
|
I hope so...
|
1
tests/commit_fixtures/osctest/add/nochange
Normal file
1
tests/commit_fixtures/osctest/add/nochange
Normal file
@ -0,0 +1 @@
|
|||||||
|
This file didn't change.
|
1
tests/commit_fixtures/osctest/conflict/.osc/_apiurl
Normal file
1
tests/commit_fixtures/osctest/conflict/.osc/_apiurl
Normal file
@ -0,0 +1 @@
|
|||||||
|
http://localhost
|
5
tests/commit_fixtures/osctest/conflict/.osc/_files
Normal file
5
tests/commit_fixtures/osctest/conflict/.osc/_files
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<directory name="conflict" rev="1" srcmd5="2df1eacfe03a3bec2112529e7f4dc39a" vrev="1">
|
||||||
|
<entry md5="0d62ceea6020d75154078a20d8c9f9ba" mtime="1282130148" name="foo" size="23" />
|
||||||
|
<entry md5="17b9e9e1a032ed44e7a584dc6303ffa8" mtime="1282130148" name="merge" size="48" />
|
||||||
|
<entry md5="7efa70f68983fad1cf487f69dedf93e9" mtime="1282130148" name="nochange" size="25" />
|
||||||
|
</directory>
|
1
tests/commit_fixtures/osctest/conflict/.osc/_in_conflict
Normal file
1
tests/commit_fixtures/osctest/conflict/.osc/_in_conflict
Normal file
@ -0,0 +1 @@
|
|||||||
|
merge
|
@ -0,0 +1 @@
|
|||||||
|
1.0
|
1
tests/commit_fixtures/osctest/conflict/.osc/_package
Normal file
1
tests/commit_fixtures/osctest/conflict/.osc/_package
Normal file
@ -0,0 +1 @@
|
|||||||
|
conflict
|
1
tests/commit_fixtures/osctest/conflict/.osc/_project
Normal file
1
tests/commit_fixtures/osctest/conflict/.osc/_project
Normal file
@ -0,0 +1 @@
|
|||||||
|
osctest
|
1
tests/commit_fixtures/osctest/conflict/.osc/foo
Normal file
1
tests/commit_fixtures/osctest/conflict/.osc/foo
Normal file
@ -0,0 +1 @@
|
|||||||
|
This is a simple test.
|
4
tests/commit_fixtures/osctest/conflict/.osc/merge
Normal file
4
tests/commit_fixtures/osctest/conflict/.osc/merge
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
Is it
|
||||||
|
possible to
|
||||||
|
merge this file?
|
||||||
|
I hope so...
|
1
tests/commit_fixtures/osctest/conflict/.osc/nochange
Normal file
1
tests/commit_fixtures/osctest/conflict/.osc/nochange
Normal file
@ -0,0 +1 @@
|
|||||||
|
This file didn't change.
|
1
tests/commit_fixtures/osctest/conflict/foo
Normal file
1
tests/commit_fixtures/osctest/conflict/foo
Normal file
@ -0,0 +1 @@
|
|||||||
|
This is a simple test.
|
4
tests/commit_fixtures/osctest/conflict/merge
Normal file
4
tests/commit_fixtures/osctest/conflict/merge
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
Is it possible
|
||||||
|
to
|
||||||
|
merge this file?
|
||||||
|
I hope so...
|
1
tests/commit_fixtures/osctest/conflict/nochange
Normal file
1
tests/commit_fixtures/osctest/conflict/nochange
Normal file
@ -0,0 +1 @@
|
|||||||
|
This file didn't change.
|
1
tests/commit_fixtures/osctest/delete/.osc/_apiurl
Normal file
1
tests/commit_fixtures/osctest/delete/.osc/_apiurl
Normal file
@ -0,0 +1 @@
|
|||||||
|
http://localhost
|
5
tests/commit_fixtures/osctest/delete/.osc/_files
Normal file
5
tests/commit_fixtures/osctest/delete/.osc/_files
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<directory name="simple" rev="1" srcmd5="2df1eacfe03a3bec2112529e7f4dc39a" vrev="1">
|
||||||
|
<entry md5="0d62ceea6020d75154078a20d8c9f9ba" mtime="1282047302" name="foo" size="23" />
|
||||||
|
<entry md5="17b9e9e1a032ed44e7a584dc6303ffa8" mtime="1282047303" name="merge" size="48" />
|
||||||
|
<entry md5="7efa70f68983fad1cf487f69dedf93e9" mtime="1282047303" name="nochange" size="25" />
|
||||||
|
</directory>
|
@ -0,0 +1 @@
|
|||||||
|
1.0
|
1
tests/commit_fixtures/osctest/delete/.osc/_package
Normal file
1
tests/commit_fixtures/osctest/delete/.osc/_package
Normal file
@ -0,0 +1 @@
|
|||||||
|
delete
|
1
tests/commit_fixtures/osctest/delete/.osc/_project
Normal file
1
tests/commit_fixtures/osctest/delete/.osc/_project
Normal file
@ -0,0 +1 @@
|
|||||||
|
osctest
|
1
tests/commit_fixtures/osctest/delete/.osc/_to_be_deleted
Normal file
1
tests/commit_fixtures/osctest/delete/.osc/_to_be_deleted
Normal file
@ -0,0 +1 @@
|
|||||||
|
nochange
|
1
tests/commit_fixtures/osctest/delete/.osc/foo
Normal file
1
tests/commit_fixtures/osctest/delete/.osc/foo
Normal file
@ -0,0 +1 @@
|
|||||||
|
This is a simple test.
|
4
tests/commit_fixtures/osctest/delete/.osc/merge
Normal file
4
tests/commit_fixtures/osctest/delete/.osc/merge
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
Is it
|
||||||
|
possible to
|
||||||
|
merge this file?
|
||||||
|
I hope so...
|
1
tests/commit_fixtures/osctest/delete/.osc/nochange
Normal file
1
tests/commit_fixtures/osctest/delete/.osc/nochange
Normal file
@ -0,0 +1 @@
|
|||||||
|
This file didn't change.
|
0
tests/commit_fixtures/osctest/delete/exists
Normal file
0
tests/commit_fixtures/osctest/delete/exists
Normal file
1
tests/commit_fixtures/osctest/delete/foo
Normal file
1
tests/commit_fixtures/osctest/delete/foo
Normal file
@ -0,0 +1 @@
|
|||||||
|
This is a simple test.
|
4
tests/commit_fixtures/osctest/delete/merge
Normal file
4
tests/commit_fixtures/osctest/delete/merge
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
Is it
|
||||||
|
possible to
|
||||||
|
merge this file?
|
||||||
|
I hope so...
|
1
tests/commit_fixtures/osctest/multiple/.osc/_apiurl
Normal file
1
tests/commit_fixtures/osctest/multiple/.osc/_apiurl
Normal file
@ -0,0 +1 @@
|
|||||||
|
http://localhost
|
5
tests/commit_fixtures/osctest/multiple/.osc/_files
Normal file
5
tests/commit_fixtures/osctest/multiple/.osc/_files
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<directory name="simple" rev="1" srcmd5="2df1eacfe03a3bec2112529e7f4dc39a" vrev="1">
|
||||||
|
<entry md5="0d62ceea6020d75154078a20d8c9f9ba" mtime="1282047302" name="foo" size="23" />
|
||||||
|
<entry md5="17b9e9e1a032ed44e7a584dc6303ffa8" mtime="1282047303" name="merge" size="48" />
|
||||||
|
<entry md5="7efa70f68983fad1cf487f69dedf93e9" mtime="1282047303" name="nochange" size="25" />
|
||||||
|
</directory>
|
@ -0,0 +1 @@
|
|||||||
|
1.0
|
1
tests/commit_fixtures/osctest/multiple/.osc/_package
Normal file
1
tests/commit_fixtures/osctest/multiple/.osc/_package
Normal file
@ -0,0 +1 @@
|
|||||||
|
multiple
|
1
tests/commit_fixtures/osctest/multiple/.osc/_project
Normal file
1
tests/commit_fixtures/osctest/multiple/.osc/_project
Normal file
@ -0,0 +1 @@
|
|||||||
|
osctest
|
2
tests/commit_fixtures/osctest/multiple/.osc/_to_be_added
Normal file
2
tests/commit_fixtures/osctest/multiple/.osc/_to_be_added
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
add
|
||||||
|
add2
|
@ -0,0 +1,2 @@
|
|||||||
|
foo
|
||||||
|
merge
|
1
tests/commit_fixtures/osctest/multiple/.osc/foo
Normal file
1
tests/commit_fixtures/osctest/multiple/.osc/foo
Normal file
@ -0,0 +1 @@
|
|||||||
|
This is a simple test.
|
4
tests/commit_fixtures/osctest/multiple/.osc/merge
Normal file
4
tests/commit_fixtures/osctest/multiple/.osc/merge
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
Is it
|
||||||
|
possible to
|
||||||
|
merge this file?
|
||||||
|
I hope so...
|
1
tests/commit_fixtures/osctest/multiple/.osc/nochange
Normal file
1
tests/commit_fixtures/osctest/multiple/.osc/nochange
Normal file
@ -0,0 +1 @@
|
|||||||
|
This file didn't change.
|
1
tests/commit_fixtures/osctest/multiple/add
Normal file
1
tests/commit_fixtures/osctest/multiple/add
Normal file
@ -0,0 +1 @@
|
|||||||
|
added file
|
1
tests/commit_fixtures/osctest/multiple/add2
Normal file
1
tests/commit_fixtures/osctest/multiple/add2
Normal file
@ -0,0 +1 @@
|
|||||||
|
add2
|
0
tests/commit_fixtures/osctest/multiple/exists
Normal file
0
tests/commit_fixtures/osctest/multiple/exists
Normal file
1
tests/commit_fixtures/osctest/multiple/nochange
Normal file
1
tests/commit_fixtures/osctest/multiple/nochange
Normal file
@ -0,0 +1 @@
|
|||||||
|
This file did change.
|
1
tests/commit_fixtures/osctest/nochanges/.osc/_apiurl
Normal file
1
tests/commit_fixtures/osctest/nochanges/.osc/_apiurl
Normal file
@ -0,0 +1 @@
|
|||||||
|
http://localhost
|
5
tests/commit_fixtures/osctest/nochanges/.osc/_files
Normal file
5
tests/commit_fixtures/osctest/nochanges/.osc/_files
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<directory name="simple" rev="1" srcmd5="2df1eacfe03a3bec2112529e7f4dc39a" vrev="1">
|
||||||
|
<entry md5="0d62ceea6020d75154078a20d8c9f9ba" mtime="1282047302" name="foo" size="23" skipped="True" />
|
||||||
|
<entry md5="17b9e9e1a032ed44e7a584dc6303ffa8" mtime="1282047303" name="merge" size="48" />
|
||||||
|
<entry md5="7efa70f68983fad1cf487f69dedf93e9" mtime="1282047303" name="nochange" size="25" />
|
||||||
|
</directory>
|
@ -0,0 +1 @@
|
|||||||
|
1.0
|
1
tests/commit_fixtures/osctest/nochanges/.osc/_package
Normal file
1
tests/commit_fixtures/osctest/nochanges/.osc/_package
Normal file
@ -0,0 +1 @@
|
|||||||
|
nochanges
|
1
tests/commit_fixtures/osctest/nochanges/.osc/_project
Normal file
1
tests/commit_fixtures/osctest/nochanges/.osc/_project
Normal file
@ -0,0 +1 @@
|
|||||||
|
osctest
|
1
tests/commit_fixtures/osctest/nochanges/.osc/foo
Normal file
1
tests/commit_fixtures/osctest/nochanges/.osc/foo
Normal file
@ -0,0 +1 @@
|
|||||||
|
This is a simple test.
|
4
tests/commit_fixtures/osctest/nochanges/.osc/merge
Normal file
4
tests/commit_fixtures/osctest/nochanges/.osc/merge
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
Is it
|
||||||
|
possible to
|
||||||
|
merge this file?
|
||||||
|
I hope so...
|
1
tests/commit_fixtures/osctest/nochanges/.osc/nochange
Normal file
1
tests/commit_fixtures/osctest/nochanges/.osc/nochange
Normal file
@ -0,0 +1 @@
|
|||||||
|
This file didn't change.
|
0
tests/commit_fixtures/osctest/nochanges/exists
Normal file
0
tests/commit_fixtures/osctest/nochanges/exists
Normal file
1
tests/commit_fixtures/osctest/nochanges/nochange
Normal file
1
tests/commit_fixtures/osctest/nochanges/nochange
Normal file
@ -0,0 +1 @@
|
|||||||
|
This file didn't change.
|
1
tests/commit_fixtures/osctest/simple/.osc/_apiurl
Normal file
1
tests/commit_fixtures/osctest/simple/.osc/_apiurl
Normal file
@ -0,0 +1 @@
|
|||||||
|
http://localhost
|
5
tests/commit_fixtures/osctest/simple/.osc/_files
Normal file
5
tests/commit_fixtures/osctest/simple/.osc/_files
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<directory name="simple" rev="1" srcmd5="2df1eacfe03a3bec2112529e7f4dc39a" vrev="1">
|
||||||
|
<entry md5="0d62ceea6020d75154078a20d8c9f9ba" mtime="1282047302" name="foo" size="23" />
|
||||||
|
<entry md5="17b9e9e1a032ed44e7a584dc6303ffa8" mtime="1282047303" name="merge" size="48" />
|
||||||
|
<entry md5="7efa70f68983fad1cf487f69dedf93e9" mtime="1282047303" name="nochange" size="25" />
|
||||||
|
</directory>
|
@ -0,0 +1 @@
|
|||||||
|
1.0
|
1
tests/commit_fixtures/osctest/simple/.osc/_package
Normal file
1
tests/commit_fixtures/osctest/simple/.osc/_package
Normal file
@ -0,0 +1 @@
|
|||||||
|
simple
|
1
tests/commit_fixtures/osctest/simple/.osc/_project
Normal file
1
tests/commit_fixtures/osctest/simple/.osc/_project
Normal file
@ -0,0 +1 @@
|
|||||||
|
osctest
|
1
tests/commit_fixtures/osctest/simple/.osc/foo
Normal file
1
tests/commit_fixtures/osctest/simple/.osc/foo
Normal file
@ -0,0 +1 @@
|
|||||||
|
This is a simple test.
|
4
tests/commit_fixtures/osctest/simple/.osc/merge
Normal file
4
tests/commit_fixtures/osctest/simple/.osc/merge
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
Is it
|
||||||
|
possible to
|
||||||
|
merge this file?
|
||||||
|
I hope so...
|
1
tests/commit_fixtures/osctest/simple/.osc/nochange
Normal file
1
tests/commit_fixtures/osctest/simple/.osc/nochange
Normal file
@ -0,0 +1 @@
|
|||||||
|
This file didn't change.
|
0
tests/commit_fixtures/osctest/simple/exists
Normal file
0
tests/commit_fixtures/osctest/simple/exists
Normal file
1
tests/commit_fixtures/osctest/simple/foo
Normal file
1
tests/commit_fixtures/osctest/simple/foo
Normal file
@ -0,0 +1 @@
|
|||||||
|
This is a simple test.
|
4
tests/commit_fixtures/osctest/simple/merge
Normal file
4
tests/commit_fixtures/osctest/simple/merge
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
Is it
|
||||||
|
possible to
|
||||||
|
merge this file?
|
||||||
|
I hope so...
|
2
tests/commit_fixtures/osctest/simple/nochange
Normal file
2
tests/commit_fixtures/osctest/simple/nochange
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
This file didn't change but
|
||||||
|
is modified.
|
6
tests/commit_fixtures/testAddfile_cfilesremote
Normal file
6
tests/commit_fixtures/testAddfile_cfilesremote
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<directory name="simple" rev="2" srcmd5="2df1eacfe03a3bec2112529e7f4dc39a" vrev="2">
|
||||||
|
<entry md5="0d62ceea6020d75154078a20d8c9f9ba" mtime="1282047302" name="foo" size="23" />
|
||||||
|
<entry md5="17b9e9e1a032ed44e7a584dc6303ffa8" mtime="1282047303" name="merge" size="48" />
|
||||||
|
<entry md5="7efa70f68983fad1cf487f69dedf93e9" mtime="1282047303" name="nochange" size="25" />
|
||||||
|
<entry md5="b423d194c75e59ee4d8d2e07ba24323d" mtime="1111111111" name="add" size="11" />
|
||||||
|
</directory>
|
5
tests/commit_fixtures/testAddfile_filesremote
Normal file
5
tests/commit_fixtures/testAddfile_filesremote
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<directory name="simple" rev="1" srcmd5="2df1eacfe03a3bec2112529e7f4dc39a" vrev="1">
|
||||||
|
<entry md5="0d62ceea6020d75154078a20d8c9f9ba" mtime="1282047302" name="foo" size="23" />
|
||||||
|
<entry md5="17b9e9e1a032ed44e7a584dc6303ffa8" mtime="1282047303" name="merge" size="48" />
|
||||||
|
<entry md5="7efa70f68983fad1cf487f69dedf93e9" mtime="1282047303" name="nochange" size="25" />
|
||||||
|
</directory>
|
5
tests/commit_fixtures/testConflictfile_filesremote
Normal file
5
tests/commit_fixtures/testConflictfile_filesremote
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<directory name="conflict" rev="1" srcmd5="2df1eacfe03a3bec2112529e7f4dc39a" vrev="1">
|
||||||
|
<entry md5="0d62ceea6020d75154078a20d8c9f9ba" mtime="1282130148" name="foo" size="23" />
|
||||||
|
<entry md5="17b9e9e1a032ed44e7a584dc6303ffa8" mtime="1282130148" name="merge" size="48" />
|
||||||
|
<entry md5="7efa70f68983fad1cf487f69dedf93e9" mtime="1282130148" name="nochange" size="25" />
|
||||||
|
</directory>
|
4
tests/commit_fixtures/testDeletefile_cfilesremote
Normal file
4
tests/commit_fixtures/testDeletefile_cfilesremote
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<directory name="simple" rev="2" srcmd5="2df1eacfe03a3bec2112529e7f4dc39a" vrev="2">
|
||||||
|
<entry md5="0d62ceea6020d75154078a20d8c9f9ba" mtime="1282047302" name="foo" size="23" />
|
||||||
|
<entry md5="17b9e9e1a032ed44e7a584dc6303ffa8" mtime="1282047303" name="merge" size="48" />
|
||||||
|
</directory>
|
5
tests/commit_fixtures/testDeletefile_filesremote
Normal file
5
tests/commit_fixtures/testDeletefile_filesremote
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<directory name="simple" rev="1" srcmd5="2df1eacfe03a3bec2112529e7f4dc39a" vrev="1">
|
||||||
|
<entry md5="0d62ceea6020d75154078a20d8c9f9ba" mtime="1282047302" name="foo" size="23" />
|
||||||
|
<entry md5="17b9e9e1a032ed44e7a584dc6303ffa8" mtime="1282047303" name="merge" size="48" />
|
||||||
|
<entry md5="7efa70f68983fad1cf487f69dedf93e9" mtime="1282047303" name="nochange" size="25" />
|
||||||
|
</directory>
|
5
tests/commit_fixtures/testMultiple_cfilesremote
Normal file
5
tests/commit_fixtures/testMultiple_cfilesremote
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<directory name="simple" rev="2" srcmd5="2df1eacfe03a3bec2112529e7f4dc39a" vrev="2">
|
||||||
|
<entry md5="b423d194c75e59ee4d8d2e07ba24323d" mtime="1111111111" name="add" size="11" />
|
||||||
|
<entry md5="ea467af882b32a275fe62eb05aba6ee1" mtime="0000000000" name="add2" size="5" />
|
||||||
|
<entry md5="2abd19de6a38ff2890af64f453df96b1" mtime="2222222222" name="nochange" size="22" />
|
||||||
|
</directory>
|
5
tests/commit_fixtures/testMultiple_filesremote
Normal file
5
tests/commit_fixtures/testMultiple_filesremote
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<directory name="simple" rev="1" srcmd5="2df1eacfe03a3bec2112529e7f4dc39a" vrev="1">
|
||||||
|
<entry md5="0d62ceea6020d75154078a20d8c9f9ba" mtime="1282047302" name="foo" size="23" />
|
||||||
|
<entry md5="17b9e9e1a032ed44e7a584dc6303ffa8" mtime="1282047303" name="merge" size="48" />
|
||||||
|
<entry md5="7efa70f68983fad1cf487f69dedf93e9" mtime="1282047303" name="nochange" size="25" />
|
||||||
|
</directory>
|
5
tests/commit_fixtures/testNoChanges_filesremote
Normal file
5
tests/commit_fixtures/testNoChanges_filesremote
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<directory name="conflict" rev="1" srcmd5="2df1eacfe03a3bec2112529e7f4dc39a" vrev="1">
|
||||||
|
<entry md5="0d62ceea6020d75154078a20d8c9f9ba" mtime="1282130148" name="foo" size="23" />
|
||||||
|
<entry md5="17b9e9e1a032ed44e7a584dc6303ffa8" mtime="1282130148" name="merge" size="48" />
|
||||||
|
<entry md5="7efa70f68983fad1cf487f69dedf93e9" mtime="1282130148" name="nochange" size="25" />
|
||||||
|
</directory>
|
5
tests/commit_fixtures/testPartial_cfilesremote
Normal file
5
tests/commit_fixtures/testPartial_cfilesremote
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<directory name="simple" rev="1" srcmd5="2df1eacfe03a3bec2112529e7f4dc39a" vrev="1">
|
||||||
|
<entry md5="b423d194c75e59ee4d8d2e07ba24323d" mtime="1111111111" name="add" size="11" />
|
||||||
|
<entry md5="17b9e9e1a032ed44e7a584dc6303ffa8" mtime="1282047303" name="merge" size="48" />
|
||||||
|
<entry md5="2abd19de6a38ff2890af64f453df96b1" mtime="2222222222" name="nochange" size="22" />
|
||||||
|
</directory>
|
5
tests/commit_fixtures/testPartial_filesremote
Normal file
5
tests/commit_fixtures/testPartial_filesremote
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<directory name="simple" rev="1" srcmd5="2df1eacfe03a3bec2112529e7f4dc39a" vrev="1">
|
||||||
|
<entry md5="0d62ceea6020d75154078a20d8c9f9ba" mtime="1282047302" name="foo" size="23" />
|
||||||
|
<entry md5="17b9e9e1a032ed44e7a584dc6303ffa8" mtime="1282047303" name="merge" size="48" />
|
||||||
|
<entry md5="7efa70f68983fad1cf487f69dedf93e9" mtime="1282047303" name="nochange" size="25" />
|
||||||
|
</directory>
|
5
tests/commit_fixtures/testSimple_cfilesremote
Normal file
5
tests/commit_fixtures/testSimple_cfilesremote
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<directory name="simple" rev="2" srcmd5="2df1eacfe03a3bec2112529e7f4dc39a" vrev="2">
|
||||||
|
<entry md5="0d62ceea6020d75154078a20d8c9f9ba" mtime="1282047302" name="foo" size="23" />
|
||||||
|
<entry md5="17b9e9e1a032ed44e7a584dc6303ffa8" mtime="1282047303" name="merge" size="48" />
|
||||||
|
<entry md5="382588b92f5976de693f44c4d6df27b7" mtime="1282047303" name="nochange" size="41" />
|
||||||
|
</directory>
|
5
tests/commit_fixtures/testSimple_filesremote
Normal file
5
tests/commit_fixtures/testSimple_filesremote
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<directory name="simple" rev="1" srcmd5="2df1eacfe03a3bec2112529e7f4dc39a" vrev="1">
|
||||||
|
<entry md5="0d62ceea6020d75154078a20d8c9f9ba" mtime="1282047302" name="foo" size="23" />
|
||||||
|
<entry md5="17b9e9e1a032ed44e7a584dc6303ffa8" mtime="1282047303" name="merge" size="48" />
|
||||||
|
<entry md5="7efa70f68983fad1cf487f69dedf93e9" mtime="1282047303" name="nochange" size="25" />
|
||||||
|
</directory>
|
163
tests/test_commit.py
Normal file
163
tests/test_commit.py
Normal file
@ -0,0 +1,163 @@
|
|||||||
|
import osc.core
|
||||||
|
import osc.oscerr
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
from common import GET, PUT, POST, DELETE, OscTestCase
|
||||||
|
from xml.etree import cElementTree as ET
|
||||||
|
FIXTURES_DIR = os.path.join(os.getcwd(), 'commit_fixtures')
|
||||||
|
|
||||||
|
def suite():
|
||||||
|
import unittest
|
||||||
|
return unittest.makeSuite(TestCommit)
|
||||||
|
|
||||||
|
rev_dummy = '<revision rev="upload">\n <srcmd5>ffffffffffffffffffffffffffffffff</srcmd5>\n</revision>'
|
||||||
|
|
||||||
|
class TestCommit(OscTestCase):
|
||||||
|
def _get_fixtures_dir(self):
|
||||||
|
return FIXTURES_DIR
|
||||||
|
|
||||||
|
@GET('http://localhost/source/osctest/simple?rev=latest', file='testSimple_filesremote')
|
||||||
|
@PUT('http://localhost/source/osctest/simple/nochange?rev=upload',
|
||||||
|
exp='This file didn\'t change but\nis modified.\n', text=rev_dummy)
|
||||||
|
@POST('http://localhost/source/osctest/simple?comment=&cmd=commit&rev=upload&user=Admin', text='<revision rev="2" />',
|
||||||
|
exp='')
|
||||||
|
@GET('http://localhost/source/osctest/simple?rev=2', file='testSimple_cfilesremote')
|
||||||
|
def test_simple(self):
|
||||||
|
"""a simple commit (only one modified file)"""
|
||||||
|
self._change_to_pkg('simple')
|
||||||
|
p = osc.core.Package('.')
|
||||||
|
p.commit()
|
||||||
|
exp = 'Sending nochange\nTransmitting file data .\nCommitted revision 2.\n'
|
||||||
|
self.assertEqual(sys.stdout.getvalue(), exp)
|
||||||
|
self._check_digests('testSimple_cfilesremote')
|
||||||
|
self.assertTrue(os.path.exists('nochange'))
|
||||||
|
self.assertEqual(open('nochange', 'r').read(), open(os.path.join('.osc', 'nochange'), 'r').read())
|
||||||
|
self._check_status(p, 'nochange', ' ')
|
||||||
|
|
||||||
|
@GET('http://localhost/source/osctest/add?rev=latest', file='testAddfile_filesremote')
|
||||||
|
@PUT('http://localhost/source/osctest/add/add?rev=upload',
|
||||||
|
exp='added file\n', text=rev_dummy)
|
||||||
|
@POST('http://localhost/source/osctest/add?comment=&cmd=commit&rev=upload&user=Admin', text='<revision rev="2" />',
|
||||||
|
exp='')
|
||||||
|
@GET('http://localhost/source/osctest/add?rev=2', file='testAddfile_cfilesremote')
|
||||||
|
def test_addfile(self):
|
||||||
|
"""commit a new file"""
|
||||||
|
self._change_to_pkg('add')
|
||||||
|
p = osc.core.Package('.')
|
||||||
|
p.commit()
|
||||||
|
exp = 'Sending add\nTransmitting file data .\nCommitted revision 2.\n'
|
||||||
|
self.assertEqual(sys.stdout.getvalue(), exp)
|
||||||
|
self._check_digests('testAddfile_cfilesremote')
|
||||||
|
self.assertTrue(os.path.exists('add'))
|
||||||
|
self.assertEqual(open('add', 'r').read(), open(os.path.join('.osc', 'add'), 'r').read())
|
||||||
|
self.assertFalse(os.path.exists(os.path.join('.osc', '_to_be_added')))
|
||||||
|
self._check_status(p, 'add', ' ')
|
||||||
|
|
||||||
|
@GET('http://localhost/source/osctest/delete?rev=latest', file='testDeletefile_filesremote')
|
||||||
|
@DELETE('http://localhost/source/osctest/delete/nochange?rev=upload', text='<status code="ok" />')
|
||||||
|
@POST('http://localhost/source/osctest/delete?comment=&cmd=commit&rev=upload&user=Admin', text='<revision rev="2" />',
|
||||||
|
exp='')
|
||||||
|
@GET('http://localhost/source/osctest/delete?rev=2', file='testDeletefile_cfilesremote')
|
||||||
|
def test_deletefile(self):
|
||||||
|
"""delete a file"""
|
||||||
|
self._change_to_pkg('delete')
|
||||||
|
osc.core.Package('.').commit()
|
||||||
|
exp = 'Deleting nochange\nTransmitting file data \nCommitted revision 2.\n'
|
||||||
|
self.assertEqual(sys.stdout.getvalue(), exp)
|
||||||
|
self._check_digests('testDeletefile_cfilesremote')
|
||||||
|
self.assertFalse(os.path.exists('nochange'))
|
||||||
|
self.assertFalse(os.path.exists(os.path.join('.osc', 'nochange')))
|
||||||
|
self.assertFalse(os.path.exists(os.path.join('.osc', '_to_be_deleted')))
|
||||||
|
|
||||||
|
@GET('http://localhost/source/osctest/conflict?rev=latest', file='testConflictfile_filesremote')
|
||||||
|
def test_conflictfile(self):
|
||||||
|
"""package has a file which is in conflict state"""
|
||||||
|
self._change_to_pkg('conflict')
|
||||||
|
ret = osc.core.Package('.').commit()
|
||||||
|
self.assertTrue(ret == 1)
|
||||||
|
exp = 'Please resolve all conflicts before committing using "osc resolved FILE"!\n'
|
||||||
|
self.assertEqual(sys.stdout.getvalue(), exp)
|
||||||
|
self._check_digests('testConflictfile_filesremote')
|
||||||
|
self._check_conflictlist('merge\n')
|
||||||
|
|
||||||
|
@GET('http://localhost/source/osctest/nochanges?rev=latest', file='testNoChanges_filesremote')
|
||||||
|
def test_nochanges(self):
|
||||||
|
"""package has no changes (which can be committed)"""
|
||||||
|
self._change_to_pkg('nochanges')
|
||||||
|
ret = osc.core.Package('.').commit()
|
||||||
|
self.assertTrue(ret == 1)
|
||||||
|
exp = 'nothing to do for package nochanges\n'
|
||||||
|
self.assertEqual(sys.stdout.getvalue(), exp)
|
||||||
|
|
||||||
|
@GET('http://localhost/source/osctest/multiple?rev=latest', file='testMultiple_filesremote')
|
||||||
|
@DELETE('http://localhost/source/osctest/multiple/foo?rev=upload', text='<status code="ok" />')
|
||||||
|
@DELETE('http://localhost/source/osctest/multiple/merge?rev=upload', text='<status code="ok" />')
|
||||||
|
@PUT('http://localhost/source/osctest/multiple/add?rev=upload', exp='added file\n', text=rev_dummy)
|
||||||
|
@PUT('http://localhost/source/osctest/multiple/add2?rev=upload', exp='add2\n', text=rev_dummy)
|
||||||
|
@PUT('http://localhost/source/osctest/multiple/nochange?rev=upload', exp='This file did change.\n', text=rev_dummy)
|
||||||
|
@POST('http://localhost/source/osctest/multiple?comment=&cmd=commit&rev=upload&user=Admin', text='<revision rev="2" />',
|
||||||
|
exp='')
|
||||||
|
@GET('http://localhost/source/osctest/multiple?rev=2', file='testMultiple_cfilesremote')
|
||||||
|
def test_multiple(self):
|
||||||
|
"""a simple commit (only one modified file)"""
|
||||||
|
self._change_to_pkg('multiple')
|
||||||
|
p = osc.core.Package('.')
|
||||||
|
p.commit()
|
||||||
|
exp = 'Sending add\nSending add2\nDeleting foo\nDeleting ' \
|
||||||
|
'merge\nSending nochange\nTransmitting file data ...\nCommitted revision 2.\n'
|
||||||
|
self.assertEqual(sys.stdout.getvalue(), exp)
|
||||||
|
self._check_digests('testMultiple_cfilesremote')
|
||||||
|
self.assertFalse(os.path.exists(os.path.join('.osc', '_to_be_added')))
|
||||||
|
self.assertFalse(os.path.exists(os.path.join('.osc', '_to_be_deleted')))
|
||||||
|
self.assertFalse(os.path.exists(os.path.join('.osc', 'foo')))
|
||||||
|
self.assertFalse(os.path.exists(os.path.join('.osc', 'merge')))
|
||||||
|
self.assertRaises(IOError, p.status, 'foo')
|
||||||
|
self.assertRaises(IOError, p.status, 'merge')
|
||||||
|
self._check_status(p, 'add', ' ')
|
||||||
|
self._check_status(p, 'add2', ' ')
|
||||||
|
self._check_status(p, 'nochange', ' ')
|
||||||
|
|
||||||
|
@GET('http://localhost/source/osctest/multiple?rev=latest', file='testPartial_filesremote')
|
||||||
|
@DELETE('http://localhost/source/osctest/multiple/foo?rev=upload', text='<status code="ok" />')
|
||||||
|
@PUT('http://localhost/source/osctest/multiple/add?rev=upload', exp='added file\n', text=rev_dummy)
|
||||||
|
@PUT('http://localhost/source/osctest/multiple/nochange?rev=upload', exp='This file did change.\n', text=rev_dummy)
|
||||||
|
@POST('http://localhost/source/osctest/multiple?comment=&cmd=commit&rev=upload&user=Admin', text='<revision rev="2" />',
|
||||||
|
exp='')
|
||||||
|
@GET('http://localhost/source/osctest/multiple?rev=2', file='testPartial_cfilesremote')
|
||||||
|
def test_partial(self):
|
||||||
|
"""commit only some files"""
|
||||||
|
self._change_to_pkg('multiple')
|
||||||
|
p = osc.core.Package('.')
|
||||||
|
p.todo = ['foo', 'add', 'nochange']
|
||||||
|
p.commit()
|
||||||
|
exp = 'Sending add\nDeleting foo\n' \
|
||||||
|
'Sending nochange\nTransmitting file data ...\nCommitted revision 2.\n'
|
||||||
|
self.assertTrue(sys.stdout.getvalue(), exp)
|
||||||
|
self._check_digests('testPartial_cfilesremote')
|
||||||
|
self._check_addlist('add2\n')
|
||||||
|
self._check_deletelist('merge\n')
|
||||||
|
self._check_status(p, 'add2', 'A')
|
||||||
|
self._check_status(p, 'merge', 'D')
|
||||||
|
self._check_status(p, 'add', ' ')
|
||||||
|
self._check_status(p, 'nochange', ' ')
|
||||||
|
self.assertRaises(IOError, p.status, 'foo')
|
||||||
|
|
||||||
|
@GET('http://localhost/source/osctest/simple?rev=latest', file='testSimple_filesremote')
|
||||||
|
@PUT('http://localhost/source/osctest/simple/nochange?rev=upload', exp='This file didn\'t change but\nis modified.\n',
|
||||||
|
exception=IOError('test exception'), text=rev_dummy)
|
||||||
|
@POST('http://localhost/source/osctest/simple?comment=&cmd=deleteuploadrev&rev=upload&user=Admin', text='<revision rev="2" />',
|
||||||
|
exp='')
|
||||||
|
def test_interrupt(self):
|
||||||
|
"""interrupt a commit"""
|
||||||
|
self._change_to_pkg('simple')
|
||||||
|
p = osc.core.Package('.')
|
||||||
|
self.assertRaises(IOError, p.commit)
|
||||||
|
exp = 'Sending nochange\nTransmitting file data .'
|
||||||
|
self.assertEqual(sys.stdout.getvalue(), exp)
|
||||||
|
self._check_digests('testSimple_filesremote')
|
||||||
|
self.assertTrue(os.path.exists('nochange'))
|
||||||
|
self._check_status(p, 'nochange', 'M')
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
import unittest
|
||||||
|
unittest.main()
|
Loading…
x
Reference in New Issue
Block a user