#1 test suite is failing
Closed: Fixed by jskladan. Opened by kparal.

It seems this hasn't been updated when going to #resultsdb 2.0 API.

sh -c "TEST='true' . test_env/bin/activate; py.test --cov resultsdb_api testing/; deactivate"
============================= test session starts ==============================
platform linux2 -- Python 2.7.13, pytest-2.9.2, py-1.4.32, pluggy-0.3.1
rootdir: /builddir/build/BUILD/resultsdb_api-2.0.0, inifile: pytest.ini
plugins: cov-2.3.0
collected 16 items
testing/test_api.py FF.FFF.F.F.FFF..
---------- coverage: platform linux2, python 2.7.13-final-0 ----------
Name               Stmts   Miss  Cover
--------------------------------------
resultsdb_api.py     132     49    63%
=================================== FAILURES ===================================
_______________________ TestAPI.test_update_job_invalid ________________________
self = <testing.test_api.TestAPI instance at 0x7f2b249031b8>
    def test_update_job_invalid(self):
        with pytest.raises(TypeError):
>           self.helper.update_job()
E           AttributeError: 'ResultsDBapi' object has no attribute 'update_job'
testing/test_api.py:127: AttributeError
_________________________ TestAPI.test_get_job_invalid _________________________
self = <testing.test_api.TestAPI instance at 0x7f2b249e51b8>
    def test_get_job_invalid(self):
        with pytest.raises(TypeError):
>           self.helper.get_job()
E           AttributeError: 'ResultsDBapi' object has no attribute 'get_job'
testing/test_api.py:141: AttributeError
___________________________ TestAPI.test_create_job ____________________________
args = (<testing.test_api.TestAPI instance at 0x7f2b248dfd40>,), kwargs = {}
    @wraps(fn)
    def new_fn(*args, **kwargs):
        self.patch_object()
        try:
>           return fn(*args, **kwargs)
/usr/lib/python2.7/site-packages/dingus.py:75: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <testing.test_api.TestAPI instance at 0x7f2b248dfd40>
    @patch('requests.post')
    def test_create_job(self):
>       self.helper.create_job(self.ref_url)
E       AttributeError: 'ResultsDBapi' object has no attribute 'create_job'
testing/test_api.py:97: AttributeError
_____________________________ TestAPI.test_get_job _____________________________
args = (<testing.test_api.TestAPI instance at 0x7f2b2496ef38>,), kwargs = {}
    @wraps(fn)
    def new_fn(*args, **kwargs):
        self.patch_object()
        try:
>           return fn(*args, **kwargs)
/usr/lib/python2.7/site-packages/dingus.py:75: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <testing.test_api.TestAPI instance at 0x7f2b2496ef38>
    @patch('requests.get')
    def test_get_job(self):
>       self.helper.get_job(self.ref_job_id)
E       AttributeError: 'ResultsDBapi' object has no attribute 'get_job'
testing/test_api.py:131: AttributeError
__________________________ TestAPI.test_create_result __________________________
args = (<testing.test_api.TestAPI instance at 0x7f2b24839ea8>,), kwargs = {}
    @wraps(fn)
    def new_fn(*args, **kwargs):
        self.patch_object()
        try:
>           return fn(*args, **kwargs)
/usr/lib/python2.7/site-packages/dingus.py:75: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <testing.test_api.TestAPI instance at 0x7f2b24839ea8>
    @patch('requests.post')
    def test_create_result(self):
        self.helper.create_result(self.ref_job_id, self.ref_testcase_name, self.ref_outcome)
        post_calls = requests.post.calls()
        rdb_url = post_calls[0][1][0]
        headers = post_calls[0][2]['headers']
        data = json.loads(post_calls[0][2]['data'])
        assert rdb_url == "%s/results" % self.rdb_url
        assert headers['Content-type'] == self.ref_content_type
        assert headers['Accept'] == self.ref_accept
>       assert data['job_id'] == self.ref_job_id
E       KeyError: 'job_id'
testing/test_api.py:178: KeyError
_________________________ TestAPI.test_update_testcase _________________________
args = (<testing.test_api.TestAPI instance at 0x7f2b24889bd8>,), kwargs = {}
    @wraps(fn)
    def new_fn(*args, **kwargs):
        self.patch_object()
        try:
>           return fn(*args, **kwargs)
/usr/lib/python2.7/site-packages/dingus.py:75: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
testing/test_api.py:62: in test_update_testcase
    self.helper.update_testcase(self.ref_testcase_name, self.ref_testcase_url)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <resultsdb_api.ResultsDBapi object at 0x7f2b24929290>, name = 'testcase'
url = 'http://fedoraqa.fedoraproject.org/testcase'
    def update_testcase(self, name, url=_KEEP):
        data = {}
>       if ref_url is not _KEEP:
E       NameError: global name 'ref_url' is not defined
resultsdb_api.py:186: NameError
_________________________ TestAPI.test_get_jobs_params _________________________
args = (<testing.test_api.TestAPI instance at 0x7f2b248df7a0>,), kwargs = {}
    @wraps(fn)
    def new_fn(*args, **kwargs):
        self.patch_object()
        try:
>           return fn(*args, **kwargs)
/usr/lib/python2.7/site-packages/dingus.py:75: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <testing.test_api.TestAPI instance at 0x7f2b248df7a0>
    @patch('requests.get')
    def test_get_jobs_params(self):
>       self.helper.get_jobs(status=self.ref_status)
E       AttributeError: 'ResultsDBapi' object has no attribute 'get_jobs'
testing/test_api.py:155: AttributeError
___________________________ TestAPI.test_update_job ____________________________
args = (<testing.test_api.TestAPI instance at 0x7f2b248ad7e8>,), kwargs = {}
    @wraps(fn)
    def new_fn(*args, **kwargs):
        self.patch_object()
        try:
>           return fn(*args, **kwargs)
/usr/lib/python2.7/site-packages/dingus.py:75: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <testing.test_api.TestAPI instance at 0x7f2b248ad7e8>
    @patch('requests.put')
    def test_update_job(self):
>       self.helper.update_job(id=self.ref_job_id, status=self.ref_status)
E       AttributeError: 'ResultsDBapi' object has no attribute 'update_job'
testing/test_api.py:112: AttributeError
_________________________ TestAPI.test_create_testcase _________________________
args = (<testing.test_api.TestAPI instance at 0x7f2b247ffc68>,), kwargs = {}
    @wraps(fn)
    def new_fn(*args, **kwargs):
        self.patch_object()
        try:
>           return fn(*args, **kwargs)
/usr/lib/python2.7/site-packages/dingus.py:75: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <testing.test_api.TestAPI instance at 0x7f2b247ffc68>
    @patch('requests.post')
    def test_create_testcase(self):
        self.helper.create_testcase(self.ref_testcase_name, self.ref_testcase_url)
        post_calls = requests.post.calls()
        rdb_url = post_calls[0][1][0]
        headers = post_calls[0][2]['headers']
        data = json.loads(post_calls[0][2]['data'])
        assert rdb_url == "%s/testcases" % self.rdb_url
        assert headers['Content-type'] == self.ref_content_type
        assert headers['Accept'] == self.ref_accept
>       assert data['url'] == self.ref_testcase_url
E       KeyError: 'url'
testing/test_api.py:57: KeyError
____________________________ TestAPI.test_get_jobs _____________________________
args = (<testing.test_api.TestAPI instance at 0x7f2b248393b0>,), kwargs = {}
    @wraps(fn)
    def new_fn(*args, **kwargs):
        self.patch_object()
        try:
>           return fn(*args, **kwargs)
/usr/lib/python2.7/site-packages/dingus.py:75: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <testing.test_api.TestAPI instance at 0x7f2b248393b0>
    @patch('requests.get')
    def test_get_jobs(self):
>       self.helper.get_jobs()
E       AttributeError: 'ResultsDBapi' object has no attribute 'get_jobs'
testing/test_api.py:145: AttributeError
===================== 10 failed, 6 passed in 0.32 seconds ======================

This ticket had assigned some Differential requests:
D1113

Once this is fixed, please also enable automatic test suite execution in Phab, so that we don't encounter this again in the future. See D1113 to learn how.

https://pagure.io/taskotron/resultsdb_api/pull-request/12 fixes this. Phab is no longer a thing, but we could potentially set up Zuul-based CI now. I'll file an issue for that.

Commit b8278639 fixes this issue

Metadata
Related Pull Requests