1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-14 08:16:15 +01:00
Commit Graph

155 Commits

Author SHA1 Message Date
lethliel
36ec0c48d4 Remove passx encode/decode functions from conf.py
They are no longer needed with the new CredentialsManagers
2019-08-29 15:06:48 +02:00
lethliel
2b47be6b1e switch to difflib.diff_bytes in python3 case.
The files are now opened as rb for diffing. In python2 nothing changes.
In python3 the returned diff is bytes now.

The following changes were made:
  * commandline.py: The returned diff is now bytes
  * get_diff now returs the diff as a bytes-like object
  * run_pager writes with sys.stdout.buffer.write if message
    is not a string
  * for the commit message the returned diff needs to be decoded
    now. Otherwise it will just producce garbage. For the commit
    message the diff on decoded bytes-objects is ok. (nothing harmfull
    can happen here)
  * fixed submit_action_diff
  * fixed request_interactive_review
2019-07-24 13:48:39 +02:00
Marco Strigl
d5108c7536
Merge pull request #464 from lethliel/python3_utils_helper
[python3] add helper functions for python3 support
2019-04-15 15:00:58 +02:00
lethliel
39ae30bcc2 change to open() with 'rb' to get bytes in python3
With this change you get bytes with python3 and string in python2

disable travis tests for python 3.x until the full python3 branch
is merged. Otherwise the tests will fail and master isn't python3
ready anyways
2018-11-13 15:56:05 +01:00
lethliel
4b29e1c543 add helper functions for python3 support
This functions are used in the whole code and are
mandatory for the python3 support to work. In python2
case nothing is touched.

* cmp_to_key:
  converts a cmp= into a key= function

* decode_list:
  decodes each element of a list. This is needed if
  we have a mixed list with strings and bytes.

* decode_it:
  Takes the input and checks if it is not a string.
  Then it uses chardet to get the encoding.
2018-11-08 09:55:07 +01:00
5e03ffcec9
Add --watch for osc prjresults --xml
Like: osc results --watch
2018-11-06 15:13:08 +01:00
a5e967efb3
Test osc results and prjresults 2018-11-05 23:54:11 +01:00
e1fd0b4ee9 add support for approved requests (requires OBS 2.10) 2018-10-18 13:26:39 +02:00
lethliel
69983249ef cleanup xpath. submit/* is ignored by the API since 2012 2018-08-07 11:53:49 +02:00
lethliel
f0325eb0b5 added code to get the sha256 hashes of files
This is needed for a new validation of the source server.

The source server will 'ask' for the sha256 sum of files which are new or
modified and osc calculates the sha256 sums for those files and sends them
back to the server.

The server checks the sha256 sums and if dies if something is wrong.
2017-11-27 16:18:19 +01:00
Marcus Huewe
6965dc5cd4 Adjust request testcases to the upcoming Request api change
There is no need to compute the request creator, because it is
stored in the request xml. Moreover, the old computation yields
a wrong result (see issue #286).
2017-04-12 12:55:16 +02:00
Marcus Huewe
502dbaa030 tests.common: req.data can also be a file-like object 2016-05-29 16:21:01 +02:00
Marcus Huewe
0de99cadbb - added comment for a change introduced in commit 4d3fcd9dc1 2015-08-13 14:13:08 +02:00
Oleg Girko
4d3fcd9dc1 Fix Python 3 support.
This change fixes errors when running test suite with Python 3.

Signed-off-by: Oleg Girko <ol@infoserver.lv>
2015-08-13 12:44:19 +01:00
a031dbd083 show review comments in an own line. Before they started in the same line, but reached on typical
screens anyway the second line if they had more than a few chars.
2015-08-13 08:07:34 +02:00
7b79298138 - fix test case for showing update link 2015-03-09 09:04:33 +01:00
3d07bd8460 - fix description rendering in history elements 2014-09-11 14:34:22 +02:00
Christian Berendt
d35983d5b8 Resolve PEP8 issue W291
* W291 trailing whitespace
2014-08-12 15:01:16 +02:00
f29a1b6e79 - follow in test suite the old/new setlinkrev behaviour 2014-05-16 11:58:36 +02:00
Marcus Huewe
570e3e5c85 - tests/test_setlinkrev: added two new testcases
Behave correctly if the _link already has a rev attribute.

Also added a fixture file that I forgot in
commit 6b579791a1.
2014-03-03 22:41:51 +01:00
Marcus Huewe
6b579791a1 - tests.test_setlinkrev: adjusted testcases for the new set_link_rev semantics (see #72) 2014-03-03 21:54:59 +01:00
Ludwig Nussel
f065dc4765 show source revision in submit requests 2014-02-27 16:46:49 +01:00
7b3b9ebc0f Fix fixtures for commit 2014-02-27 16:45:44 +01:00
Marcus Huewe
4ef62d0daf - tests.test_commit: added new testcase
Only update storefiles if the commit was successful (see bug #65)
2014-01-09 13:53:41 +01:00
Marcus Huewe
57d9b48dc0 - tests.suite: added TestConf testcase to suite 2014-01-08 15:43:57 +01:00
Michal Vyskocil
111fd87715 passx encode/decode functions
The string.encode('bz2') does not work in python3. Implement
passx_encode/passx_decode functions compatible with python 2.6, 2.7 and
3.3.

Add a simple unit test.
2014-01-08 15:43:57 +01:00
Marcus Huewe
f7eab473f0 - tests.test_prdiff: fixed testcases (got broken by commit bd3a6d2fc8) 2013-11-11 09:15:59 +01:00
Michal Vyskocil
b787ca2b39 python3 compatibility: make all unit test pass
There are many places can't be covered by 2to3, especially the
str/unicode -> str/bytes change done in python3. This is a big patch
incorporating all changes made in order to make python3 suite.py run
without any single failure.

It

 * adapt the introspect_handler_3 for case there are no __defaults__
 * adds the ET_ENCODING variable for ET.fromstring ("unicode" in py3,
  "utf-8" in py2)
 * (re)adds various builtins to both python versions
    - memoryview to python 2.6
    - bytes compatible with py3 to 2.6 and 2.7

and it changes few parts of tests/common.py in order to be compatible
with python3

 * new urlcompare method compares all components or url + parsed query
   string in a dictionary, so the ordering, neither quoting does not matter
 * bytes builtin has been added to 2.x and used in assertEqualMultiline
2013-04-16 10:51:42 +02:00
Michal Vyskocil
f0186dbde8 python3 compatibility: fix all tests 2013-04-16 10:51:42 +02:00
Marcus Huewe
d4b8fbbba4 - tests.test_prdiff: disabled the usage of keyrings when running the cli
Alternatively we could also disable the keyring usage in the config file.
2013-01-24 15:35:11 +01:00
Adam Spiers
57c8cffe66 - add prdiff subcommand and test suite 2013-01-18 22:38:21 +00:00
Adam Spiers
9b1c6f0204 - refactor assertEqualMultiline into common.py for reuse
This will be reused by the tests for the imminent prdiff subcommand.
2013-01-18 22:38:21 +00:00
Marcus Huewe
33f3ab4203 - sigh... make jenkins happy again (finally)
The jenkins build got broken by commit 178120c99e
(python 2.6's re.sub doesn't support a flags argument).
2013-01-18 18:27:50 +01:00
Marcus Huewe
178120c99e - make travis-ci happy again...
It got broken in commit 6a332bc1c6
2013-01-18 18:12:41 +01:00
Marcus Huewe
6a332bc1c6 - tests.test_difffiles: removed "count" argument from re.sub in __canonise_diff
Old python versions don't support "count". This should fix the jenkins build
again.
2013-01-18 17:11:42 +01:00
Marcus Huewe
203a4eeab5 - tests.test_difffiles: added TODO to __canonise_diff. 2013-01-18 16:37:08 +01:00
Adam Spiers
ef0f24c2f6 - avoid false negative failures due to trivial differences in diff hunk headers
When a hunk header refers to a single line in the "from"
  file and/or the "to" file, e.g.

    @@ -37,37 +41,43 @@
    @@ -37,39 +41,41 @@
    @@ -37,37 +41,41 @@

  some systems will avoid repeating the line number:

    @@ -37 +41,43 @@
    @@ -37,39 +41 @@
    @@ -37 +41 @@

  so we need to canonise the output to avoid false negative
  test failures.
2013-01-18 13:44:30 +00:00
Adam Spiers
479f5d5011 - improve output of assertEquals failures on multi-line strings 2013-01-18 13:44:30 +00:00
Marcus Huewe
46b9fd36e4 - tests.common: disable usage of keyring and gnome-keyring in the testsuite
Otherwise it'll lead to (unexpected) errors if python-keyring or gnome-keyring
are installed.
2013-01-18 14:27:28 +01:00
1000c26c6f - fix fixtures for last vrev change 2012-03-02 16:10:36 +01:00
Sascha Peilicke
ca9e38c3d9 Generate JUnit-compatible XML test result reports if 'xmlrunner' is available. 2011-09-08 11:43:45 +02:00
Sascha Peilicke
af86600880 Fix tests/test_request.py, requests seem to have a trainling newline now 2011-08-18 16:02:34 +02:00
dbe99c338f - follow changes during commit in test cases 2011-06-07 16:33:08 +02:00
Marcus Huewe
e247cf358c - adjusted testsuite for the latest setlinkrev changes 2011-03-21 16:53:48 +01:00
Marcus Huewe
e1080aa476 - common.py, __get_response: support "code" keyword argument to specify the http status code 2011-03-21 16:52:13 +01:00
Marcus Huewe
f0eb8946d3 - also test _link without "project" attribute 2011-02-22 17:53:58 +01:00
Marcus Huewe
40928d2460 - added testcases for "set_link_rev" 2011-02-22 17:53:58 +01:00
Marcus Huewe
74594eb9ec - adjusted testcase oscrc's for recent config changes 2011-02-11 12:44:48 +01:00
Marcus Huewe
73ffb036f8 - test_request: test get_actions method 2011-01-29 17:43:36 +01:00
Marcus Huewe
dda670f3de - test_request: adjusted testcase to the latest format changes 2011-01-24 09:34:37 +01:00
Marcus Huewe
6132f89268 - test_deletefiles.py: new testcases for skipped files 2011-01-17 14:59:46 +01:00
Marcus Huewe
e1b1f66bae - TestRequest: added testcase for action element with acceptinfo subelement 2011-01-12 22:20:47 +01:00
Marcus Huewe
8c26c74620 - added testcases for the rewritten Request class 2010-12-30 02:27:15 +01:00
Marcus Huewe
b99a903873 - def setUp: added "copytree" parameter to disable the copy of the "osctest" dir 2010-12-30 01:57:41 +01:00
Marcus Huewe
d77f8919fe - Project.init_project: return Project object
- adjusted testcases
2010-12-23 02:15:58 +01:00
Marcus Huewe
f8eae74898 - added new testcases in order to test the status methods for projects and packages 2010-12-22 23:12:24 +01:00
Marcus Huewe
062bb35c95 - removed unused imports 2010-12-19 20:32:06 +01:00
Marcus Huewe
70e43a87c2 - 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
2010-12-17 23:23:39 +01:00
Marcus Huewe
71bedd4bb1 - new testcases for repair_wc: check if the passed parameter is a valid apiurl 2010-12-09 20:32:07 +01:00
Marcus Huewe
fffd0c395a - added new testcases for #657838 ("osc 0.130: osc repairwc fails totally - working copy useless") 2010-12-07 20:29:59 +01:00
Marcus Huewe
1a0cea8a4d - fixed testsuite 2010-11-30 19:11:05 +01:00
Marcus Huewe
48eaacef18 - new testcase: repairwc: repair a project wc with no apiurl 2010-10-10 21:36:07 +02:00
Marcus Huewe
cda7ffc040 - testcases for "init_project" 2010-10-09 16:25:44 +02:00
Marcus Huewe
c3c75689ef - added testcases for repairwc in order to repair a wc if the "_apiurl" file is missing 2010-09-28 23:01:39 +02:00
Marcus Huewe
cc4805c059 - added testsuite for new "repairwc" command 2010-09-08 18:57:21 +02:00
Marcus Huewe
cb935861c8 - make wc consistent 2010-09-08 18:51:14 +02:00
Marcus Huewe
7075dd05a8 - commit missing fixtures... 2010-09-08 16:35:59 +02:00
Marcus Huewe
fdcfd5e315 - cleanup working copies... 2010-09-08 16:18:35 +02:00
Marcus Huewe
044c678455 - fixed test_difffiles testsuite for python2.7
python2.7's difflib slightly changed the format
2010-09-08 12:10:09 +02:00
Marcus Huewe
acbf2dabd5 - new testcase for a package without a revision 2010-09-06 18:11:12 +02:00
Marcus Huewe
5e72fa1284 - fixed "osc addremove": use delete_file(), initialize pac.todo correctly
- added new testcase
2010-09-06 15:28:23 +02:00
Marcus Huewe
0502e81b26 - added new testcase 2010-09-03 21:28:17 +02:00
Marcus Huewe
57a3832a8e - rewrote "def commit"
- the upload revision isn't used anymore instead we commit via
  cmd=commitfilelist
- extended and adjusted testcases
2010-09-03 17:46:01 +02:00
Marcus Huewe
5c8b258a6b - fixed read_sizelimit: added missing strip
- fix for commit 89c9cb67f4: self.size_limit should be an int
- added testcase for local _size_limit constraint
2010-09-03 16:09:56 +02:00
Marcus Huewe
89c9cb67f4 - renamed limit_size to size_limit (only internal variable changes)
- added new method "get_files_meta" to the Package class (which handles
  the the "skip file and service stuff")
2010-09-03 14:51:20 +02:00
Marcus Huewe
94eb143d8c - small fixes for do_status and get_diff
- get_diff:
  * more helpful error message if a file was added and the local
    file was removed again
  * unify self.filenamelist and self.to_be_added if self.todo is empty
  * extended testcases
- do_status: be able to run "osc st <nonexistentfile>"
2010-09-02 13:47:42 +02:00
Marcus Huewe
b718669685 - raise OscIOError instead of IOError (adjusted testcases) 2010-09-02 10:23:37 +02:00
Marcus Huewe
b6925f7b34 - arghs... finally all files should be present 2010-08-31 17:46:07 +02:00
Marcus Huewe
9fa5d7ea39 - added missing fixtures... 2010-08-31 17:44:05 +02:00
Marcus Huewe
7802dfa9ad - fixed patch header 2010-08-31 17:30:31 +02:00
Marcus Huewe
3ac330f7cd - fixed _meta_mode + added testcase 2010-08-31 16:54:44 +02:00
Marcus Huewe
947971b2a2 - workaround for git (because it doesn't support empty dirs) 2010-08-31 16:25:24 +02:00
Marcus Huewe
1da96d7df7 - propagate retval to the caller 2010-08-31 13:47:27 +02:00
Marcus Huewe
9c5c329a04 - get_diff: don't diff binary files 2010-08-31 13:30:37 +02:00
Marcus Huewe
9c2f1d85ca - 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
2010-08-31 13:30:37 +02:00
Marcus Huewe
3cf8a5bf88 - fixed commit (Package class)
- use "self.rev" when calling update_local_filesmeta (otherwise we might get a newer revision)
- write addlist after commit
2010-08-31 13:30:37 +02:00
Marcus Huewe
c4ceb7f700 - adjusted store_write_string calls so that the storefile ends with a newline
- adjusted testcase fixtures for this change
2010-08-31 13:30:37 +02:00
Marcus Huewe
2ffd46a9c2 - get rid of the init_package_dir mess
moved code into the staticmethod "init_package" of the Package class.
Cleaned up "checkout_package"
2010-08-31 13:30:37 +02:00
Marcus Huewe
19c63111b6 - added testcases for the new "get_diff" method 2010-08-31 13:30:36 +02:00
Marcus Huewe
d90228a7e3 - support a revert of a missing file which was added to the wc 2010-08-31 13:30:36 +02:00
Marcus Huewe
1d7c674d80 - adjusted testcase for the init_basicauth change in master 2010-08-31 13:30:36 +02:00
Marcus Huewe
9c0076d726 - added testcases for "def revert" 2010-08-31 13:30:36 +02:00
Marcus Huewe
e21e61f20e - minor fixes 2010-08-31 13:30:36 +02:00
Marcus Huewe
62dc807378 - moved common methods into the OscTestCase class 2010-08-31 13:30:36 +02:00
Marcus Huewe
71e0b3ee34 - GET decorator: use name of the original method for the wrapper method 2010-08-31 13:30:36 +02:00
Marcus Huewe
5b6aa0a4fc - added testsuite module which aggregates all testcases 2010-08-31 13:30:36 +02:00
Marcus Huewe
88a961cae4 - rewrote addfile() and delete_file() methods from the Package class (for the details see below)
- addfile():
  * contains the complete logic for adding a file (=> simplified addFiles(...))
  * semantic fixes
- delete_file():
  * semantic fixes
- different handling of newly added/replaced files:
  * added/replaced files are tracked in the .osc/_to_be_added file
- introduced new file state 'R': 'R' == "replaced"
  * usecase: osc rm <file>; osc add <file> => new state is 'R'
  * conceptually 'R' is equal to 'A'
- adapted revert() to support the new state (+ some other minor fixes)
- added testcases for addfile() and delete_file()
2010-08-31 13:30:36 +02:00
Marcus Huewe
e6b451596c - moved __change_to_pkg into common module (new name _change_to_pkg)
removed unused method "__expected_requests" from TestUpdate class
2010-08-31 13:30:36 +02:00
Marcus Huewe
f4adf69ef9 - refactored testcase code: moved common stuff into a common module 2010-08-31 13:30:36 +02:00
Marcus Huewe
a6efd9e970 - adjust testcase for commit 9205d4d902cd3d45747c30405acd92bd5f98d210 2010-08-31 13:30:36 +02:00