#99 fix fedmsg tests to include 'scenario' in fake result
Merged 6 years ago by jskladan. Opened 6 years ago by dcallagh.
taskotron/ dcallagh/resultsdb fix-pr93-tests  into  develop

@@ -38,7 +38,7 @@ 

  

  class MyResult(object):

  

-     def __init__(self, id, testcase_name, outcome, item, item_type, arch):

+     def __init__(self, id, testcase_name, outcome, item, item_type, arch, scenario):

          self.id = id

          self.testcase_name = testcase_name

          self.outcome = outcome
@@ -46,6 +46,7 @@ 

              MyResultData('item', item),

              MyResultData('type', item_type),

              MyResultData('arch', arch),

+             MyResultData('scenario', scenario),

          ]

  

  
@@ -98,7 +99,8 @@ 

          }

          self.ref_result_ref_url = 'http://example.com/testing.result'

          self.ref_result_obj = MyResult(

-             0, self.ref_testcase_name, self.ref_result_outcome, self.ref_result_item, self.ref_result_type, self.ref_result_arch)

+             0, self.ref_testcase_name, self.ref_result_outcome, self.ref_result_item,

+             self.ref_result_type, self.ref_result_arch, self.ref_result_scenario)

  

      def teardown_method(self, method):

          # Reset this for each test.

Fixes a test failure introduced in PR#93:

____________________________________ TestFuncCreateFedmsg.test_get_prev_result_different_scenario _____________________________________

self = <testing.functest_create_fedmsg.TestFuncCreateFedmsg instance at 0x7fa56fd487a0>

    def test_get_prev_result_different_scenario(self):
        data = copy.deepcopy(self.ref_result_data)
        data['scenario'] = data['scenario'] + '.fake'
        self.helper_create_result(data=data)

        prev_result = apiv2.get_prev_result(self.ref_result_obj)
>       assert prev_result is None
E       assert <resultsdb.models.results.Result object at 0x7fa570038150> is None

testing/functest_create_fedmsg.py:217: AssertionError

Btw how would you feel about a PR to refactor these fedmsg tests to use more "real" objects instead of the fake ones?

I have also been wondering about the best way to cover the Stomp messaging plugin... In another project in the past, I have had some success with writing functional tests which send actual messages to a real qpidd process. I personally like that style of testing because it proves that all the pieces really work, with no fake stuff in the test code...

@dcallagh what do you mean by "more real" objects?

I would not mind at all. At the moment, I'd still probably prefer for it to be "two staged" so we can keep the mock-messaging-based-testing, and add the "real deal" on top of that. And when/if the stomp ends up not being needed, we could get rid of it.

@ralph what do you think?

Also, I'll spin up a ticket for the conversation to take place, and link it.

Commit d496020 fixes this pull-request

Pull-Request has been merged by jskladan

6 years ago

Pull-Request has been merged by jskladan

6 years ago
Metadata