1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-09 22:36:14 +01:00

- added testcases for #658664 ("osc: a package internal error occured")

- a file was marked as 'A' but the file didn't exist in the wc:
  - if it's part of the commit abort
  - otherwise ignore it
This commit is contained in:
Marcus Huewe 2010-12-17 23:23:39 +01:00
parent 306507748c
commit 70e43a87c2
12 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1 @@
http://localhost

View File

@ -0,0 +1,3 @@
<directory name="added_missing" rev="1" srcmd5="2df1eacfe03a3bec2112529e7f4dc39a" vrev="1">
<entry md5="0d62ceea6020d75154078a20d8c9f9ba" mtime="1282047302" name="foo" size="23" skipped="True" />
</directory>

View File

@ -0,0 +1 @@
1.0

View File

@ -0,0 +1 @@
added_missing

View File

@ -0,0 +1 @@
osctest

View File

@ -0,0 +1,2 @@
add
bar

View File

@ -0,0 +1 @@
foobar

View File

@ -0,0 +1,4 @@
<directory name="added_missing" rev="2" srcmd5="2df1eacfe03a3bec2112529e7f4dc39a" vrev="2">
<entry md5="14758f1afd44c09b7992073ccf00b43d" mtime="1292622742" name="bar" size="7" />
<entry md5="0d62ceea6020d75154078a20d8c9f9ba" mtime="1282130148" name="foo" size="23" />
</directory>

View File

@ -0,0 +1,3 @@
<directory name="added_missing" rev="1" srcmd5="2df1eacfe03a3bec2112529e7f4dc39a" vrev="1">
<entry md5="0d62ceea6020d75154078a20d8c9f9ba" mtime="1282130148" name="foo" size="23" />
</directory>

View File

@ -0,0 +1 @@
<directory><entry md5="14758f1afd44c09b7992073ccf00b43d" name="bar" /><entry md5="0d62ceea6020d75154078a20d8c9f9ba" name="foo" /></directory>

View File

@ -0,0 +1,3 @@
<directory error="missing" name="added_missing">
<entry md5="14758f1afd44c09b7992073ccf00b43d" name="bar" />
</directory>

View File

@ -233,6 +233,34 @@ class TestCommit(OscTestCase):
self._check_digests('testExpand_expandedfilesremote')
self._check_status(p, 'simple', ' ')
@GET('http://localhost/source/osctest/added_missing?rev=latest', file='testAddedMissing_filesremote')
def test_added_missing(self):
"""commit an added file which is missing"""
self._change_to_pkg('added_missing')
p = osc.core.Package('.')
ret = p.commit()
self.assertTrue(ret == 1)
exp = 'file \'add\' is marked as \'A\' but does not exist\n'
self.assertEqual(sys.stdout.getvalue(), exp)
self._check_status(p, 'add', '!')
@GET('http://localhost/source/osctest/added_missing?rev=latest', file='testAddedMissing_filesremote')
@POST('http://localhost/source/osctest/added_missing?comment=&cmd=commitfilelist&user=Admin',
file='testAddedMissing_missingfilelist', expfile='testAddedMissing_lfilelist')
@PUT('http://localhost/source/osctest/added_missing/bar?rev=repository', exp='foobar\n', text=rev_dummy)
@POST('http://localhost/source/osctest/added_missing?comment=&cmd=commitfilelist&user=Admin',
file='testAddedMissing_cfilesremote', expfile='testAddedMissing_lfilelist')
def test_added_missing2(self):
"""commit an added file, another added file missing (but it's not part of the commit)"""
self._change_to_pkg('added_missing')
p = osc.core.Package('.')
p.todo = ['bar']
p.commit()
exp = 'Sending bar\nTransmitting file data .\nCommitted revision 2.\n'
self.assertEqual(sys.stdout.getvalue(), exp)
self._check_status(p, 'add', '!')
self._check_status(p, 'bar', ' ')
if __name__ == '__main__':
import unittest
unittest.main()