mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-12 16:56:15 +01:00
- added testcases for the new "get_diff" method
This commit is contained in:
parent
ca61d08bf3
commit
19c63111b6
104
tests/difffile_fixtures/oscrc
Normal file
104
tests/difffile_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/difffile_fixtures/osctest/.osc/_apiurl
Normal file
1
tests/difffile_fixtures/osctest/.osc/_apiurl
Normal file
@ -0,0 +1 @@
|
||||
http://localhost
|
1
tests/difffile_fixtures/osctest/.osc/_packages
Normal file
1
tests/difffile_fixtures/osctest/.osc/_packages
Normal file
@ -0,0 +1 @@
|
||||
<project name="osctest" />
|
1
tests/difffile_fixtures/osctest/.osc/_project
Normal file
1
tests/difffile_fixtures/osctest/.osc/_project
Normal file
@ -0,0 +1 @@
|
||||
osctest
|
@ -0,0 +1 @@
|
||||
http://localhost
|
@ -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
|
@ -0,0 +1 @@
|
||||
remote_localdelete
|
@ -0,0 +1 @@
|
||||
osctest
|
@ -0,0 +1 @@
|
||||
merge
|
@ -0,0 +1 @@
|
||||
This is a simple test.
|
@ -0,0 +1,4 @@
|
||||
Is it
|
||||
possible to
|
||||
merge this file?
|
||||
I hope so...
|
@ -0,0 +1 @@
|
||||
This file didn't change.
|
1
tests/difffile_fixtures/osctest/remote_localdelete/foo
Normal file
1
tests/difffile_fixtures/osctest/remote_localdelete/foo
Normal file
@ -0,0 +1 @@
|
||||
This is a simple test.
|
@ -0,0 +1 @@
|
||||
This file didn't change.
|
@ -0,0 +1 @@
|
||||
toadd2
|
@ -0,0 +1 @@
|
||||
http://localhost
|
@ -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
|
@ -0,0 +1 @@
|
||||
remote_localmodified
|
@ -0,0 +1 @@
|
||||
osctest
|
@ -0,0 +1 @@
|
||||
This is a simple test.
|
@ -0,0 +1,4 @@
|
||||
Is it
|
||||
possible to
|
||||
merge this file?
|
||||
I hope so...
|
@ -0,0 +1 @@
|
||||
This file didn't change.
|
1
tests/difffile_fixtures/osctest/remote_localmodified/foo
Normal file
1
tests/difffile_fixtures/osctest/remote_localmodified/foo
Normal file
@ -0,0 +1 @@
|
||||
This is a simple test.
|
@ -0,0 +1,4 @@
|
||||
Is it
|
||||
possible to
|
||||
merge this file?
|
||||
I hope so...
|
@ -0,0 +1,2 @@
|
||||
This file didn't change.
|
||||
oh it does
|
@ -0,0 +1 @@
|
||||
toadd1
|
@ -0,0 +1 @@
|
||||
toadd2
|
@ -0,0 +1 @@
|
||||
http://localhost
|
@ -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
|
@ -0,0 +1 @@
|
||||
remote_simple
|
@ -0,0 +1 @@
|
||||
osctest
|
@ -0,0 +1 @@
|
||||
toadd1
|
1
tests/difffile_fixtures/osctest/remote_simple/.osc/foo
Normal file
1
tests/difffile_fixtures/osctest/remote_simple/.osc/foo
Normal file
@ -0,0 +1 @@
|
||||
This is a simple test.
|
4
tests/difffile_fixtures/osctest/remote_simple/.osc/merge
Normal file
4
tests/difffile_fixtures/osctest/remote_simple/.osc/merge
Normal file
@ -0,0 +1,4 @@
|
||||
Is it
|
||||
possible to
|
||||
merge this file?
|
||||
I hope so...
|
@ -0,0 +1 @@
|
||||
This file didn't change.
|
1
tests/difffile_fixtures/osctest/remote_simple/foo
Normal file
1
tests/difffile_fixtures/osctest/remote_simple/foo
Normal file
@ -0,0 +1 @@
|
||||
This is a simple test.
|
4
tests/difffile_fixtures/osctest/remote_simple/merge
Normal file
4
tests/difffile_fixtures/osctest/remote_simple/merge
Normal file
@ -0,0 +1,4 @@
|
||||
Is it
|
||||
possible to
|
||||
merge this file?
|
||||
I hope so...
|
1
tests/difffile_fixtures/osctest/remote_simple/nochange
Normal file
1
tests/difffile_fixtures/osctest/remote_simple/nochange
Normal file
@ -0,0 +1 @@
|
||||
This file didn't change.
|
1
tests/difffile_fixtures/osctest/remote_simple/toadd1
Normal file
1
tests/difffile_fixtures/osctest/remote_simple/toadd1
Normal file
@ -0,0 +1 @@
|
||||
toadd1
|
1
tests/difffile_fixtures/osctest/remote_simple/toadd2
Normal file
1
tests/difffile_fixtures/osctest/remote_simple/toadd2
Normal file
@ -0,0 +1 @@
|
||||
toadd2
|
@ -0,0 +1 @@
|
||||
http://localhost
|
@ -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
|
@ -0,0 +1 @@
|
||||
remote_simple_noadd
|
@ -0,0 +1 @@
|
||||
osctest
|
@ -0,0 +1 @@
|
||||
This is a simple test.
|
@ -0,0 +1,4 @@
|
||||
Is it
|
||||
possible to
|
||||
merge this file?
|
||||
I hope so...
|
@ -0,0 +1 @@
|
||||
This file didn't change.
|
1
tests/difffile_fixtures/osctest/remote_simple_noadd/foo
Normal file
1
tests/difffile_fixtures/osctest/remote_simple_noadd/foo
Normal file
@ -0,0 +1 @@
|
||||
This is a simple test.
|
@ -0,0 +1,4 @@
|
||||
Is it
|
||||
possible to
|
||||
merge this file?
|
||||
I hope so...
|
@ -0,0 +1 @@
|
||||
This file didn't change.
|
@ -0,0 +1 @@
|
||||
toadd2
|
1
tests/difffile_fixtures/osctest/simple/.osc/_apiurl
Normal file
1
tests/difffile_fixtures/osctest/simple/.osc/_apiurl
Normal file
@ -0,0 +1 @@
|
||||
http://localhost
|
9
tests/difffile_fixtures/osctest/simple/.osc/_files
Normal file
9
tests/difffile_fixtures/osctest/simple/.osc/_files
Normal file
@ -0,0 +1,9 @@
|
||||
<directory name="conflict" 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="eb9c2bf0eb63f3a7bc0ea37ef18aeba5" mtime="1282730880" name="somefile" size="13" />
|
||||
<entry md5="81be947db54c2e225dc8eacce64d8a4a" mtime="1282731457" name="replaced" size="17" />
|
||||
<entry md5="676513fde5797c3785164942c97dfec1" mtime="1282731738" name="missing" size="8" />
|
||||
<entry md5="ffffffffffffffffffffffffffffffff" mtime="1111111111" name="skipped" size="12" skipped="true" />
|
||||
</directory>
|
1
tests/difffile_fixtures/osctest/simple/.osc/_in_conflict
Normal file
1
tests/difffile_fixtures/osctest/simple/.osc/_in_conflict
Normal file
@ -0,0 +1 @@
|
||||
foo
|
@ -0,0 +1 @@
|
||||
1.0
|
1
tests/difffile_fixtures/osctest/simple/.osc/_package
Normal file
1
tests/difffile_fixtures/osctest/simple/.osc/_package
Normal file
@ -0,0 +1 @@
|
||||
simple
|
1
tests/difffile_fixtures/osctest/simple/.osc/_project
Normal file
1
tests/difffile_fixtures/osctest/simple/.osc/_project
Normal file
@ -0,0 +1 @@
|
||||
osctest
|
3
tests/difffile_fixtures/osctest/simple/.osc/_to_be_added
Normal file
3
tests/difffile_fixtures/osctest/simple/.osc/_to_be_added
Normal file
@ -0,0 +1,3 @@
|
||||
toadd1
|
||||
replaced
|
||||
addedmissing
|
@ -0,0 +1,2 @@
|
||||
somefile
|
||||
modified
|
1
tests/difffile_fixtures/osctest/simple/.osc/foo
Normal file
1
tests/difffile_fixtures/osctest/simple/.osc/foo
Normal file
@ -0,0 +1 @@
|
||||
This is a simple test.
|
4
tests/difffile_fixtures/osctest/simple/.osc/merge
Normal file
4
tests/difffile_fixtures/osctest/simple/.osc/merge
Normal file
@ -0,0 +1,4 @@
|
||||
Is it
|
||||
possible to
|
||||
merge this file?
|
||||
I hope so...
|
1
tests/difffile_fixtures/osctest/simple/.osc/missing
Normal file
1
tests/difffile_fixtures/osctest/simple/.osc/missing
Normal file
@ -0,0 +1 @@
|
||||
missing
|
1
tests/difffile_fixtures/osctest/simple/.osc/nochange
Normal file
1
tests/difffile_fixtures/osctest/simple/.osc/nochange
Normal file
@ -0,0 +1 @@
|
||||
This file didn't change.
|
1
tests/difffile_fixtures/osctest/simple/.osc/replaced
Normal file
1
tests/difffile_fixtures/osctest/simple/.osc/replaced
Normal file
@ -0,0 +1 @@
|
||||
yet another file
|
1
tests/difffile_fixtures/osctest/simple/.osc/somefile
Normal file
1
tests/difffile_fixtures/osctest/simple/.osc/somefile
Normal file
@ -0,0 +1 @@
|
||||
some content
|
5
tests/difffile_fixtures/osctest/simple/foo
Normal file
5
tests/difffile_fixtures/osctest/simple/foo
Normal file
@ -0,0 +1,5 @@
|
||||
<<<<<<< foo.mine
|
||||
This is no test.
|
||||
=======
|
||||
This is a simple test.
|
||||
>>>>>>> foo.r2
|
4
tests/difffile_fixtures/osctest/simple/merge
Normal file
4
tests/difffile_fixtures/osctest/simple/merge
Normal file
@ -0,0 +1,4 @@
|
||||
Is it
|
||||
possible to
|
||||
merge this file?
|
||||
I hope so...
|
2
tests/difffile_fixtures/osctest/simple/nochange
Normal file
2
tests/difffile_fixtures/osctest/simple/nochange
Normal file
@ -0,0 +1,2 @@
|
||||
This file didn't change but
|
||||
is modified.
|
1
tests/difffile_fixtures/osctest/simple/replaced
Normal file
1
tests/difffile_fixtures/osctest/simple/replaced
Normal file
@ -0,0 +1 @@
|
||||
foo replaced
|
1
tests/difffile_fixtures/osctest/simple/toadd1
Normal file
1
tests/difffile_fixtures/osctest/simple/toadd1
Normal file
@ -0,0 +1 @@
|
||||
toadd1
|
1
tests/difffile_fixtures/osctest/simple/toadd2
Normal file
1
tests/difffile_fixtures/osctest/simple/toadd2
Normal file
@ -0,0 +1 @@
|
||||
toadd2
|
@ -0,0 +1,5 @@
|
||||
<directory name="simple" rev="3" srcmd5="2df1eacfe03a3bec2112529e7f4dc39a" vrev="3">
|
||||
<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,6 @@
|
||||
<directory name="simple" rev="3" srcmd5="2df1eacfe03a3bec2112529e7f4dc39a" vrev="3">
|
||||
<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="136a96e1470ec7424bc8ae47612977db" mtime="1282914026" name="foobar" size="14" />
|
||||
</directory>
|
@ -0,0 +1,2 @@
|
||||
foobar
|
||||
barfoo
|
@ -0,0 +1,4 @@
|
||||
<directory name="simple" rev="3" srcmd5="2df1eacfe03a3bec2112529e7f4dc39a" vrev="3">
|
||||
<entry md5="0d62ceea6020d75154078a20d8c9f9ba" mtime="1282047302" name="foo" size="23" />
|
||||
<entry md5="7efa70f68983fad1cf487f69dedf93e9" mtime="1282047303" name="nochange" size="25" />
|
||||
</directory>
|
@ -0,0 +1,4 @@
|
||||
<directory name="simple" rev="3" srcmd5="2df1eacfe03a3bec2112529e7f4dc39a" vrev="3">
|
||||
<entry md5="17b9e9e1a032ed44e7a584dc6303ffa8" mtime="1282047303" name="merge" size="48" />
|
||||
<entry md5="7efa70f68983fad1cf487f69dedf93e9" mtime="1282047303" name="nochange" size="25" />
|
||||
</directory>
|
5
tests/difffile_fixtures/testDiffRemoteModified_files
Normal file
5
tests/difffile_fixtures/testDiffRemoteModified_files
Normal file
@ -0,0 +1,5 @@
|
||||
<directory name="simple" rev="3" srcmd5="2df1eacfe03a3bec2112529e7f4dc39a" vrev="3">
|
||||
<entry md5="0d62ceea6020d75154078a20d8c9f9ba" mtime="1282047302" name="foo" size="23" />
|
||||
<entry md5="daafe513479072c5a942928d1850a939" mtime="1282908295" name="merge" size="35" />
|
||||
<entry md5="7efa70f68983fad1cf487f69dedf93e9" mtime="1282047303" name="nochange" size="25" />
|
||||
</directory>
|
3
tests/difffile_fixtures/testDiffRemoteModified_merge
Normal file
3
tests/difffile_fixtures/testDiffRemoteModified_merge
Normal file
@ -0,0 +1,3 @@
|
||||
Is it
|
||||
possible to
|
||||
merge this file?
|
5
tests/difffile_fixtures/testDiffRemoteNoChange_files
Normal file
5
tests/difffile_fixtures/testDiffRemoteNoChange_files
Normal file
@ -0,0 +1,5 @@
|
||||
<directory name="simple" rev="3" srcmd5="2df1eacfe03a3bec2112529e7f4dc39a" vrev="3">
|
||||
<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,5 @@
|
||||
<directory name="simple" rev="3" srcmd5="2df1eacfe03a3bec2112529e7f4dc39a" vrev="3">
|
||||
<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 @@
|
||||
This file didn't change.
|
@ -3,10 +3,12 @@ import test_update
|
||||
import test_addfiles
|
||||
import test_deletefiles
|
||||
import test_revertfiles
|
||||
import test_difffiles
|
||||
|
||||
suite = unittest.TestSuite()
|
||||
suite.addTests(test_addfiles.suite())
|
||||
suite.addTests(test_deletefiles.suite())
|
||||
suite.addTests(test_revertfiles.suite())
|
||||
suite.addTests(test_update.suite())
|
||||
suite.addTests(test_difffiles.suite())
|
||||
unittest.TextTestRunner(verbosity=1).run(suite)
|
||||
|
249
tests/test_difffiles.py
Normal file
249
tests/test_difffiles.py
Normal file
@ -0,0 +1,249 @@
|
||||
import osc.core
|
||||
import osc.oscerr
|
||||
import os
|
||||
import sys
|
||||
from common import GET, OscTestCase
|
||||
|
||||
FIXTURES_DIR = os.path.join(os.getcwd(), 'difffile_fixtures')
|
||||
|
||||
def suite():
|
||||
import unittest
|
||||
return unittest.makeSuite(TestDiffFiles)
|
||||
|
||||
class TestDiffFiles(OscTestCase):
|
||||
diff_hdr = 'Index: %s\n==================================================================='
|
||||
def _get_fixtures_dir(self):
|
||||
return FIXTURES_DIR
|
||||
|
||||
def testDiffUnmodified(self):
|
||||
"""diff an unmodified file"""
|
||||
self._change_to_pkg('simple')
|
||||
p = osc.core.Package('.')
|
||||
p.todo = ['merge']
|
||||
self.__check_diff(p, '', None)
|
||||
|
||||
def testDiffAdded(self):
|
||||
"""diff an added file"""
|
||||
self._change_to_pkg('simple')
|
||||
p = osc.core.Package('.')
|
||||
p.todo = ['toadd1']
|
||||
exp = """%s
|
||||
--- toadd1\t(revision 0)
|
||||
+++ toadd1\t(revision 0)
|
||||
@@ -0,0 +1,1 @@
|
||||
+toadd1
|
||||
""" % (TestDiffFiles.diff_hdr % 'toadd1')
|
||||
self.__check_diff(p, exp, None)
|
||||
|
||||
def testDiffRemoved(self):
|
||||
"""diff a removed file"""
|
||||
self._change_to_pkg('simple')
|
||||
p = osc.core.Package('.')
|
||||
p.todo = ['somefile']
|
||||
exp = """%s
|
||||
--- somefile\t(revision 2)
|
||||
+++ somefile\t(working copy)
|
||||
@@ -1,1 +0,0 @@
|
||||
-some content
|
||||
""" % (TestDiffFiles.diff_hdr % 'somefile')
|
||||
self.__check_diff(p, exp, None)
|
||||
|
||||
def testDiffMissing(self):
|
||||
"""diff a missing file (missing files are ignored)"""
|
||||
self._change_to_pkg('simple')
|
||||
p = osc.core.Package('.')
|
||||
p.todo = ['missing']
|
||||
self.__check_diff(p, '', None)
|
||||
|
||||
def testDiffReplaced(self):
|
||||
"""diff a replaced file"""
|
||||
self._change_to_pkg('simple')
|
||||
p = osc.core.Package('.')
|
||||
p.todo = ['replaced']
|
||||
exp = """%s
|
||||
--- replaced\t(revision 2)
|
||||
+++ replaced\t(working copy)
|
||||
@@ -1,1 +1,1 @@
|
||||
-yet another file
|
||||
+foo replaced
|
||||
""" % (TestDiffFiles.diff_hdr % 'replaced')
|
||||
self.__check_diff(p, exp, None)
|
||||
|
||||
def testDiffSkipped(self):
|
||||
"""diff a skipped file (skipped files are ignored)"""
|
||||
self._change_to_pkg('simple')
|
||||
p = osc.core.Package('.')
|
||||
p.todo = ['skipped']
|
||||
self.__check_diff(p, '', None)
|
||||
|
||||
def testDiffConflict(self):
|
||||
"""diff a file which is in the conflict state"""
|
||||
self._change_to_pkg('simple')
|
||||
p = osc.core.Package('.')
|
||||
p.todo = ['foo']
|
||||
exp = """%s
|
||||
--- foo\t(revision 2)
|
||||
+++ foo\t(working copy)
|
||||
@@ -1,1 +1,5 @@
|
||||
+<<<<<<< foo.mine
|
||||
+This is no test.
|
||||
+=======
|
||||
This is a simple test.
|
||||
+>>>>>>> foo.r2
|
||||
""" % (TestDiffFiles.diff_hdr % 'foo')
|
||||
self.__check_diff(p, exp, None)
|
||||
|
||||
def testDiffModified(self):
|
||||
"""diff a modified file"""
|
||||
self._change_to_pkg('simple')
|
||||
p = osc.core.Package('.')
|
||||
p.todo = ['nochange']
|
||||
exp = """%s
|
||||
--- nochange\t(revision 2)
|
||||
+++ nochange\t(working copy)
|
||||
@@ -1,1 +1,2 @@
|
||||
-This file didn't change.
|
||||
+This file didn't change but
|
||||
+is modified.
|
||||
""" % (TestDiffFiles.diff_hdr % 'nochange')
|
||||
self.__check_diff(p, exp, None)
|
||||
|
||||
def testDiffUnversioned(self):
|
||||
"""diff an unversioned file"""
|
||||
self._change_to_pkg('simple')
|
||||
p = osc.core.Package('.')
|
||||
p.todo = ['toadd2']
|
||||
self.assertRaises(IOError, self.__check_diff, p, '', None)
|
||||
|
||||
def testDiffMultipleFiles(self):
|
||||
"""diff multiple files"""
|
||||
self._change_to_pkg('simple')
|
||||
p = osc.core.Package('.')
|
||||
p.todo = ['nochange', 'somefile']
|
||||
exp = """%s
|
||||
--- nochange\t(revision 2)
|
||||
+++ nochange\t(working copy)
|
||||
@@ -1,1 +1,2 @@
|
||||
-This file didn't change.
|
||||
+This file didn't change but
|
||||
+is modified.
|
||||
%s
|
||||
--- somefile\t(revision 2)
|
||||
+++ somefile\t(working copy)
|
||||
@@ -1,1 +0,0 @@
|
||||
-some content
|
||||
""" % (TestDiffFiles.diff_hdr % 'nochange', TestDiffFiles.diff_hdr % 'somefile')
|
||||
|
||||
# diff with revision
|
||||
@GET('http://localhost/source/osctest/remote_simple_noadd?rev=3', file='testDiffRemoteNoChange_files')
|
||||
def testDiffRemoteNoChange(self):
|
||||
"""diff against remote revision where no file changed"""
|
||||
self._change_to_pkg('remote_simple_noadd')
|
||||
p = osc.core.Package('.')
|
||||
self.__check_diff(p, '', 3)
|
||||
|
||||
@GET('http://localhost/source/osctest/remote_simple?rev=3', file='testDiffRemoteModified_files')
|
||||
@GET('http://localhost/source/osctest/remote_simple/merge?rev=3', file='testDiffRemoteModified_merge')
|
||||
def testDiffRemoteModified(self):
|
||||
"""diff against a remote revision with one modified file"""
|
||||
self._change_to_pkg('remote_simple')
|
||||
p = osc.core.Package('.')
|
||||
exp = """%s
|
||||
--- merge\t(revision 3)
|
||||
+++ merge\t(working copy)
|
||||
@@ -1,3 +1,4 @@
|
||||
Is it
|
||||
possible to
|
||||
merge this file?
|
||||
+I hope so...
|
||||
%s
|
||||
--- toadd1\t(revision 0)
|
||||
+++ toadd1\t(revision 0)
|
||||
@@ -0,0 +1,1 @@
|
||||
+toadd1
|
||||
""" % (TestDiffFiles.diff_hdr % 'merge', TestDiffFiles.diff_hdr % 'toadd1')
|
||||
self.__check_diff(p, exp, 3)
|
||||
|
||||
@GET('http://localhost/source/osctest/remote_simple?rev=3', file='testDiffRemoteDeletedLocalAdded_files')
|
||||
def testDiffRemoteNotExistingLocalAdded(self):
|
||||
"""
|
||||
a file which doesn't exist in a remote revision and
|
||||
has status A in the wc
|
||||
"""
|
||||
self._change_to_pkg('remote_simple')
|
||||
p = osc.core.Package('.')
|
||||
exp = """%s
|
||||
--- toadd1\t(revision 0)
|
||||
+++ toadd1\t(revision 0)
|
||||
@@ -0,0 +1,1 @@
|
||||
+toadd1
|
||||
""" % (TestDiffFiles.diff_hdr % 'toadd1')
|
||||
self.__check_diff(p, exp, 3)
|
||||
|
||||
@GET('http://localhost/source/osctest/remote_simple_noadd?rev=3', file='testDiffRemoteExistingLocalNotExisting_files')
|
||||
@GET('http://localhost/source/osctest/remote_simple_noadd/foobar?rev=3', file='testDiffRemoteExistingLocalNotExisting_foobar')
|
||||
def testDiffRemoteExistingLocalNotExisting(self):
|
||||
"""
|
||||
a file doesn't exist in the local wc but exists
|
||||
in the remote revision
|
||||
"""
|
||||
self._change_to_pkg('remote_simple_noadd')
|
||||
p = osc.core.Package('.')
|
||||
exp = """%s
|
||||
--- foobar\t(revision 3)
|
||||
+++ foobar\t(working copy)
|
||||
@@ -1,2 +0,0 @@
|
||||
-foobar
|
||||
-barfoo
|
||||
""" % (TestDiffFiles.diff_hdr % 'foobar')
|
||||
self.__check_diff(p, exp, 3)
|
||||
|
||||
@GET('http://localhost/source/osctest/remote_localmodified?rev=3', file='testDiffRemoteUnchangedLocalModified_files')
|
||||
@GET('http://localhost/source/osctest/remote_localmodified/nochange?rev=3', file='testDiffRemoteUnchangedLocalModified_nochange')
|
||||
def testDiffRemoteUnchangedLocalModified(self):
|
||||
"""remote revision didn't change, local file is modified"""
|
||||
self._change_to_pkg('remote_localmodified')
|
||||
p = osc.core.Package('.')
|
||||
exp = """%s
|
||||
--- nochange\t(revision 3)
|
||||
+++ nochange\t(working copy)
|
||||
@@ -1,1 +1,2 @@
|
||||
This file didn't change.
|
||||
+oh it does
|
||||
""" % (TestDiffFiles.diff_hdr % 'nochange')
|
||||
self.__check_diff(p, exp, 3)
|
||||
|
||||
@GET('http://localhost/source/osctest/remote_simple_noadd?rev=3', file='testDiffRemoteMissingLocalExisting_files')
|
||||
def testDiffRemoteMissingLocalExisting(self):
|
||||
"""
|
||||
remote revision misses a file which exists in the local wc (state ' ')"""
|
||||
self._change_to_pkg('remote_simple_noadd')
|
||||
p = osc.core.Package('.')
|
||||
exp = """%s
|
||||
--- foo\t(revision 0)
|
||||
+++ foo\t(working copy)
|
||||
@@ -0,0 +1,1 @@
|
||||
+This is a simple test.
|
||||
""" % (TestDiffFiles.diff_hdr % 'foo')
|
||||
self.__check_diff(p, exp, 3)
|
||||
|
||||
@GET('http://localhost/source/osctest/remote_localdelete?rev=3', file='testDiffRemoteMissingLocalDeleted_files')
|
||||
def testDiffRemoteMissingLocalDeleted(self):
|
||||
"""
|
||||
remote revision misses a file which is marked for
|
||||
deletion in the local wc
|
||||
"""
|
||||
# empty diff is expected (svn does the same)
|
||||
self._change_to_pkg('remote_localdelete')
|
||||
p = osc.core.Package('.')
|
||||
self.__check_diff(p, '', 3)
|
||||
|
||||
def __check_diff(self, p, exp, revision=None):
|
||||
s = ''
|
||||
for i in p.get_diff(revision):
|
||||
s += ''.join(i)
|
||||
self.assertEqual(s, exp)
|
||||
|
||||
if __name__ == '__main__':
|
||||
import unittest
|
||||
unittest.main()
|
Loading…
Reference in New Issue
Block a user