The tests are failing:
.E...............E
======================================================================
ERROR: test_development_env (test_exception.ExceptionTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/alinefm/kimchi/tests/test_exception.py", line 89, in
test_development_env
setup_server()
File "/home/alinefm/kimchi/tests/test_exception.py", line 43, in
setup_server
model = kimchi.mockmodel.MockModel('/tmp/obj-store-test')
File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 62, in __init__
self.reset()
File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 82, in reset
self.host_repositories = MockRepositories()
File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 1083, in
__init__
"repo_name": "kimchi_repo_1392167832"}}
TypeError: unhashable type: 'dict'
======================================================================
ERROR: test_development_env (test_exception.ExceptionTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/alinefm/kimchi/tests/test_exception.py", line 52, in tearDown
test_server.stop()
AttributeError: 'NoneType' object has no attribute 'stop'
======================================================================
ERROR: test_production_env (test_exception.ExceptionTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/alinefm/kimchi/tests/test_exception.py", line 59, in
test_production_env
setup_server('production')
File "/home/alinefm/kimchi/tests/test_exception.py", line 43, in
setup_server
model = kimchi.mockmodel.MockModel('/tmp/obj-store-test')
File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 62, in __init__
self.reset()
File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 82, in reset
self.host_repositories = MockRepositories()
File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 1083, in
__init__
"repo_name": "kimchi_repo_1392167832"}}
TypeError: unhashable type: 'dict'
======================================================================
ERROR: test_production_env (test_exception.ExceptionTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/alinefm/kimchi/tests/test_exception.py", line 52, in tearDown
test_server.stop()
AttributeError: 'NoneType' object has no attribute 'stop'
======================================================================
ERROR: test_collection (test_mockmodel.MockModelTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/alinefm/kimchi/tests/test_mockmodel.py", line 45, in setUp
model = kimchi.mockmodel.MockModel('/tmp/obj-store-test')
File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 62, in __init__
self.reset()
File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 82, in reset
self.host_repositories = MockRepositories()
File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 1083, in
__init__
"repo_name": "kimchi_repo_1392167832"}}
TypeError: unhashable type: 'dict'
======================================================================
ERROR: test_packages_update (test_mockmodel.MockModelTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/alinefm/kimchi/tests/test_mockmodel.py", line 45, in setUp
model = kimchi.mockmodel.MockModel('/tmp/obj-store-test')
File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 62, in __init__
self.reset()
File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 82, in reset
self.host_repositories = MockRepositories()
File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 1083, in
__init__
"repo_name": "kimchi_repo_1392167832"}}
TypeError: unhashable type: 'dict'
======================================================================
ERROR: test_resource (test_mockmodel.MockModelTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/alinefm/kimchi/tests/test_mockmodel.py", line 45, in setUp
model = kimchi.mockmodel.MockModel('/tmp/obj-store-test')
File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 62, in __init__
self.reset()
File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 82, in reset
self.host_repositories = MockRepositories()
File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 1083, in
__init__
"repo_name": "kimchi_repo_1392167832"}}
TypeError: unhashable type: 'dict'
======================================================================
ERROR: test_screenshot_refresh (test_mockmodel.MockModelTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/alinefm/kimchi/tests/test_mockmodel.py", line 45, in setUp
model = kimchi.mockmodel.MockModel('/tmp/obj-store-test')
File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 62, in __init__
self.reset()
File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 82, in reset
self.host_repositories = MockRepositories()
File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 1083, in
__init__
"repo_name": "kimchi_repo_1392167832"}}
TypeError: unhashable type: 'dict'
======================================================================
ERROR: test_vm_info (test_mockmodel.MockModelTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/alinefm/kimchi/tests/test_mockmodel.py", line 45, in setUp
model = kimchi.mockmodel.MockModel('/tmp/obj-store-test')
File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 62, in __init__
self.reset()
File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 82, in reset
self.host_repositories = MockRepositories()
File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 1083, in
__init__
"repo_name": "kimchi_repo_1392167832"}}
TypeError: unhashable type: 'dict'
======================================================================
ERROR: test_vm_list_sorted (test_mockmodel.MockModelTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/alinefm/kimchi/tests/test_mockmodel.py", line 45, in setUp
model = kimchi.mockmodel.MockModel('/tmp/obj-store-test')
File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 62, in __init__
self.reset()
File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 82, in reset
self.host_repositories = MockRepositories()
File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 1083, in
__init__
"repo_name": "kimchi_repo_1392167832"}}
TypeError: unhashable type: 'dict'
======================================================================
ERROR: setUpModule (test_rest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/alinefm/kimchi/tests/test_rest.py", line 55, in setUpModule
model = kimchi.mockmodel.MockModel('/tmp/obj-store-test')
File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 62, in __init__
self.reset()
File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 82, in reset
self.host_repositories = MockRepositories()
File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 1083, in
__init__
"repo_name": "kimchi_repo_1392167832"}}
TypeError: unhashable type: 'dict'
======================================================================
ERROR: test_repository_create (test_model.ModelTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/alinefm/kimchi/tests/test_model.py", line 888, in
test_repository_create
inst.repositories_create(repo)
File "/home/alinefm/kimchi/src/kimchi/model/host.py", line 329, in create
raise InvalidOperation("KCHREPOS0006E", {'repo_id': repo_id})
InvalidOperation: KCHREPOS0006E: Repository fedora-fake already exists.
======================================================================
ERROR: test_repository_disable_enable (test_model.ModelTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/alinefm/kimchi/tests/test_model.py", line 955, in
test_repository_disable_enable
inst.repositories_create(repo)
File "/home/alinefm/kimchi/src/kimchi/model/host.py", line 329, in create
raise InvalidOperation("KCHREPOS0006E", {'repo_id': repo_id})
InvalidOperation: KCHREPOS0006E: Repository fedora-fake already exists.
======================================================================
ERROR: test_repository_update (test_model.ModelTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/alinefm/kimchi/tests/test_model.py", line 925, in
test_repository_update
inst.repositories_create(repo)
File "/home/alinefm/kimchi/src/kimchi/model/host.py", line 329, in create
raise InvalidOperation("KCHREPOS0006E", {'repo_id': repo_id})
InvalidOperation: KCHREPOS0006E: Repository fedora-fake already exists.
======================================================================
ERROR: test_server_start (test_server.ServerTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/alinefm/kimchi/tests/test_server.py", line 40, in
test_server_start
model = kimchi.mockmodel.MockModel('/tmp/obj-store-test')
File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 62, in __init__
self.reset()
File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 82, in reset
self.host_repositories = MockRepositories()
File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 1083, in
__init__
"repo_name": "kimchi_repo_1392167832"}}
TypeError: unhashable type: 'dict'
======================================================================
ERROR: setUpModule (test_plugin)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/alinefm/kimchi/tests/test_plugin.py", line 45, in setUpModule
model = kimchi.mockmodel.MockModel('/tmp/obj-store-test')
File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 62, in __init__
self.reset()
File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 82, in reset
self.host_repositories = MockRepositories()
File "/home/alinefm/kimchi/src/kimchi/mockmodel.py", line 1083, in
__init__
"repo_name": "kimchi_repo_1392167832"}}
TypeError: unhashable type: 'dict'
----------------------------------------------------------------------
Ran 65 tests in 138.520s
FAILED (errors=16)
make[3]: *** [check-local] Error 1
make[3]: Leaving directory `/home/alinefm/kimchi/tests'
make[2]: *** [check-am] Error 2
make[2]: Leaving directory `/home/alinefm/kimchi/tests'
make[1]: *** [check] Error 2
make[1]: Leaving directory `/home/alinefm/kimchi/tests'
make: *** [check-recursive] Error 1
src/kimchi/mockmodel.py:844: trailing whitespace.
+ except:
On 02/17/2014 03:04 PM, Paulo Vital wrote:
V3 -> V4:
* PEP8 compatibility
* Fixed bugs regarding exception error system code in mockmodel.py, model/host.py and
repository.py
* Removed the "enabled" parameter from update_params' list.
V2 -> V3:
* PEP8 compatibility
* Improved mockmodel.py and model/host.py
* Updated API.json and backend files to use new exception error system code
V1 -> V2:
* Removed the enable/disable from docs/API.md and src/kimchi/API.json
* fixed wrong URI on test_rest.py
* PEP8 compatibility
* Updated repositories.py to make consistent with docs/API.md
* Raised correct exceptions
* Changed model/host.py and mockmodel.py to generate repo_id if not provided
* Changed mockmodel.py to declare MockRepositories class
V1:
This patch set provides support to host's repositories management operations.
At this point, an agnostic class is providing support to backend and
REST API operations. In addition, YUM (for RHEL, Fedora, SLES and OpenSuse)
and APT (for Debian and Ubuntu) specific classes are provided to support the
operation os each software update system.
To test the backend execute the following commands:
$ cd tests
$ sudo ./run_tests.sh test_model.ModelTests.test_repository_create
$ sudo ./run_tests.sh test_model.ModelTests.test_repository_update
$ sudo ./run_tests.sh test_model.ModelTests.test_repository_disable_enable
To test the REST API, execute the following commands (all them are agnostic of the
host's distro):
1) Get list of all repositories enabled in the host:
$ curl -u <USER> -H 'Content-type: application/json' -H 'Accept:
application/json'
http://localhost:8000/host/repositories/ -X GET
2) Create a new repository:
$ curl -u <USER> -H 'Content-type: application/json' -H 'Accept:
application/json'
http://localhost:8000/host/repositories/ -X POST -d'
{
"repo_id": "fedora-fake",
"baseurl": "http://www.fedora.org",
"gpgkey": "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-fake-19"
}
'
3) Get information from a specific repository:
$ curl -u <USER> -H 'Content-type: application/json' -H 'Accept:
application/json'
http://localhost:8000/host/repositories/fedora-fake
4) Update a specific repository:
$ curl -u <USER> -H 'Content-type: application/json' -H 'Accept:
application/json'
http://localhost:8000/host/repositories/fedora-fake -X PUT -d'
{
"repo_id":"fedora-fake",
"repo_name":"Fedora 19 FAKEs",
"baseurl": "http://www.fedora.org/downloads"
}
'
5) Disable a specific repository:
$ curl -u <USER> -H 'Content-type: application/json' -H 'Accept:
application/json'
http://localhost:8000/host/repositories/fedora-fake/disable -X POST
-d ''
6) Enable a specific repository:
$ curl -u <USER> -H 'Content-type: application/json' -H 'Accept:
application/json'
http://localhost:8000/host/repositories/fedora-fake/enable -X POST
-d ''
7) Delete a specific repository:
$ curl -u <USER> -H 'Content-type: application/json' -H 'Accept:
application/json'
http://localhost:8000/host/repositories/fedora-fake -X DELETE
Paulo Vital (6):
Host's repositories management: Update API.md
Host's repositories management: Update REST API
Host's repositories management: Update backend.
Host's repositories management: Update Makefile
Host's repositories management: Update test-cases.
Host's repositories management: Update error exception messages.
Makefile.am | 1 +
docs/API.md | 77 ++++++
src/kimchi/API.json | 76 ++++++
src/kimchi/Makefile.am | 1 +
src/kimchi/control/host.py | 21 ++
src/kimchi/i18n.py | 19 ++
src/kimchi/mockmodel.py | 133 ++++++++++
src/kimchi/model/host.py | 54 ++++-
src/kimchi/repositories.py | 586 +++++++++++++++++++++++++++++++++++++++++++++
tests/test_model.py | 100 ++++++++
tests/test_rest.py | 33 +++
11 files changed, 1100 insertions(+), 1 deletion(-)
create mode 100644 src/kimchi/repositories.py