#187 Fixing unittests so they pass
Merged 7 years ago by skrzepto. Opened 7 years ago by skrzepto.
skrzepto/fedora-hubs unittest-fix  into  develop

file modified
+1
@@ -315,6 +315,7 @@ 

      def __json__(self, session):

          module = hubs.widgets.registry[self.plugin]

          data = module.data(session, self, **self.config)

+         data.pop('widget', None)

          return {

              'id': self.idx,

              # TODO -- use flask.url_for to get the url for this widget

@@ -13,6 +13,7 @@ 

          data = json.loads(response.data)

          del data['data']['widget_url']

          self.assertDictEqual(data['data'], {

-             u'source_url': u'/source/about/',

+             u'edit_url': u'/ralph/51/edit',

+             u'source_url': u'/source/about',

              u'text': u'Testing.',

          })

@@ -13,9 +13,10 @@ 

          data = json.loads(response.data)

          del data['data']['widget_url']

          self.assertDictEqual(data['data'], {

+             u'edit_url': u'/ralph/33/edit',

              u'fedmsgs': 83854,

              u'fedmsgs_text': u'83,854',

-             u'source_url': u'/source/fedmsgstats/',

+             u'source_url': u'/source/fedmsgstats',

              u'subscribers': [],

              u'subscribed_to': [],

              u'subscribers_text': u'0',

Currently the unittests are failing


Ran 8 tests in 3.482s

FAILED (failures=4)


The widget key in the data variable was causing errors when converting into json. I popped it off and made some minor string adjustments to pass the tests

Someone mentioned to use del instead of pop. I'm going to stick with pop since it doesn't complain if the key doesn't exist and continues on while del you need to check if the key exists first.

Btw, could you rebase before you merge?

rebased

7 years ago

Btw, could you rebase before you merge?

got it rebased :)

Go ahead to merge then :)

Pull-Request has been merged by skrzepto

7 years ago