#73 Use Munch instead of py2-only Bunch
Merged 5 years ago by frantisekz. Opened 5 years ago by frantisekz.
fedora-qa/ frantisekz/blockerbugs munch_instead_of_bunch  into  develop

file modified
+1 -1
@@ -35,7 +35,7 @@ 

  BuildRequires:  python-devel

  BuildRequires:  python-setuptools

  BuildRequires:  pytest

- BuildRequires:  python-bunch

+ BuildRequires:  python-munch

  BuildRequires:  python-flask

  BuildRequires:  python-flask-sqlalchemy

  BuildRequires:  python-fedora-flask

file modified
+2 -2
@@ -20,13 +20,13 @@ 

  # Authors:

  #   Martin Krizek <mkrizek@redhat.com>

  

- import bunch

+ import munch

  from flask import g, request, redirect

  

  

  class FakeFas(object):

      fake_user_groups = ['qa-admin']

-     fake_user = bunch.Bunch(username='developer',

+     fake_user = munch.Munch(username='developer',

                              groups=fake_user_groups)

  

      def __init__(self, app):

file modified
+1 -1
@@ -5,7 +5,7 @@ 

  SQLAlchemy>=0.9.7

  WTForms>=2.0

  Werkzeug==0.9.1

- bunch==1.0.1

+ munch>=1.0.1

  mock>=0.8.0

  py>=1.4.9

  pytest>=2.3.5

file modified
+1 -1
@@ -55,7 +55,7 @@ 

            'Flask>=0.9',

            'Flask-SQLAlchemy>=0.16',

            'SQLAlchemy>= 0.7',

-           'bunch>=1.0.1',

+           'munch>=1.0.1',

            'python-bugzilla>=0.8',

            'Flask-SQLAlchemy>=0.16',

            'WTForms>1.0',

@@ -1,10 +1,10 @@ 

- from bunch import Bunch

+ from munch import Munch

  from copy import deepcopy

  from blockerbugs.util.bug_sync import BugSync

  from mock import MagicMock

  import datetime

  

- basicbug = Bunch({'bug_id': 123456,

+ basicbug = Munch({'bug_id': 123456,

                    'weburl': 'https://bugzilla.redhat.com/show_bug.cgi?id=123456',

                    'component': 'randomcomponent',

                    'status': 'NEW',

@@ -1,11 +1,11 @@ 

- from bunch import Bunch

+ from munch import Munch

  from copy import deepcopy

  from blockerbugs.util.update_sync import UpdateSync

  from mock import MagicMock

  from datetime import datetime

  

  

- basicupdate = Bunch(

+ basicupdate = Munch(

      approved=None,

      close_bugs=True,

      critpath=False,
@@ -22,10 +22,10 @@ 

      unstable_karma=-3,

      updateid=u'FEDORA-2012-13902',

      url=u'https://bodhi.stg.fedoraproject.org/FEDORA-2012-13902',

-     bugs=[Bunch(bug_id=856836, parent=False, security=False,

+     bugs=[Munch(bug_id=856836, parent=False, security=False,

                  title=u'/etc/fstab is not written correctly after live install (F18 Alpha RC2+)')],

-     builds=[Bunch(nvr=u'anaconda-18.6.8-1.fc18',

-                   package=Bunch(

+     builds=[Munch(nvr=u'anaconda-18.6.8-1.fc18',

+                   package=Munch(

                        committers=[u'anaconda-maint', u'dlehman', u'jkeating',

                                    u'bcl', u'clumens', u'rvykydal', u'akozumpl',

                                    u'pjones',
@@ -34,44 +34,44 @@ 

                        name=u'anaconda',

                        suggest_reboot=False))],

      comments=[

-         Bunch(anonymous=False, author=u'bodhi', group=None,

+         Munch(anonymous=False, author=u'bodhi', group=None,

                karma=0,

                text=u'This update has been submitted for testing by bcl. ',

                timestamp=u'2012-09-12 23:43:24',

                update_title=u'anaconda-18.6.8-1.fc18'),

-         Bunch(anonymous=False, author=u'autoqa', group=None,

+         Munch(anonymous=False, author=u'autoqa', group=None,

                karma=0,

                text=u'AutoQA: depcheck test PASSED on x86_64. Result log:\nhttp://autoqa.fedoraproject.org/report/em84 (results are informative only)',

                timestamp=u'2012-09-13 00:14:41',

                update_title=u'anaconda-18.6.8-1.fc18'),

-         Bunch(anonymous=False, author=u'autoqa', group=None,

+         Munch(anonymous=False, author=u'autoqa', group=None,

                karma=0,

                text=u'AutoQA: depcheck test PASSED on i386. Result log:\nhttp://autoqa.fedoraproject.org/report/emcl (results are informative only)',

                timestamp=u'2012-09-13 00:30:53',

                update_title=u'anaconda-18.6.8-1.fc18'),

-         Bunch(anonymous=False, author=u'jkeating',

+         Munch(anonymous=False, author=u'jkeating',

                group=u'proventesters', karma=1,

                text=u'While I did not test the above bug, I have tested anaconda in a number of other\nscenarios and it performs as expected.',

                timestamp=u'2012-09-13 06:27:03',

                update_title=u'anaconda-18.6.8-1.fc18'),

-         Bunch(anonymous=False, author=u'bodhi', group=None,

+         Munch(anonymous=False, author=u'bodhi', group=None,

                karma=0,

                text=u'This update is currently being pushed to the Fedora 18 testing updates repository.',

                timestamp=u'2012-09-13 15:58:32',

                update_title=u'anaconda-18.6.8-1.fc18'),

-         Bunch(anonymous=False, author=u'bodhi', group=None,

+         Munch(anonymous=False, author=u'bodhi', group=None,

                karma=0,

                text=u'This update has been pushed to testing',

                timestamp=u'2012-09-13 16:44:30',

                update_title=u'anaconda-18.6.8-1.fc18')],

-     nagged=Bunch(

+     nagged=Munch(

          test_cases=[

              u'QA:Testcase Anaconda autopart install',

              u'QA:Testcase Anaconda User Interface Graphical',

              u'QA:Testcase Boot Methods Pxeboot',

              u'QA:Testcase install repository Live Image',

          ]),

-     release=Bunch(dist_tag=u'f18', id_prefix=u'FEDORA',

+     release=Munch(dist_tag=u'f18', id_prefix=u'FEDORA',

                    locked=True,

                    long_name=u'Fedora 18', name=u'F18')

  )
@@ -179,7 +179,7 @@ 

          assert updateinfo['date_pushed_stable'] == None

  

      def test_extract_bug_single(self):

-         ref_bugs = [Bunch(bug_id=123456, parent=False, security=False,

+         ref_bugs = [Munch(bug_id=123456, parent=False, security=False,

              title=u'First wonderful test bug')

           ]

          self.testupdate.bugs = ref_bugs
@@ -191,11 +191,11 @@ 

  

      def test_extract_bug_multiple(self):

          ref_bugs = [

-             Bunch(bug_id=123456, parent=False, security=False,

+             Munch(bug_id=123456, parent=False, security=False,

                    title=u'First wonderful test bug'),

-             Bunch(bug_id=234567, parent=False, security=False,

+             Munch(bug_id=234567, parent=False, security=False,

                    title=u'Second wonderful test bug'),

-             Bunch(bug_id=345678, parent=False, security=False,

+             Munch(bug_id=345678, parent=False, security=False,

                    title=u'Third wonderful test bug'),

          ]

          self.testupdate.bugs = ref_bugs

file modified
+4 -4
@@ -1,5 +1,5 @@ 

  import copy

- from bunch import Bunch

+ from munch import Munch

  import datetime

  

  from blockerbugs.models.milestone import Milestone
@@ -8,7 +8,7 @@ 

  from blockerbugs import db

  from blockerbugs.util.bug_sync import BugSync

  

- templatebug = Bunch({

+ templatebug = Munch({

      'bug_id': 123456,

      'weburl': 'https://bugzilla.redhat.com/show_bug.cgi?id=123456',

      'component': 'randomcomponent',
@@ -223,7 +223,7 @@ 

  

          assert len(test_syncbugs) == 2

  

-         # this isn't done yet, need to monkey with the db schema and want to 

+         # this isn't done yet, need to monkey with the db schema and want to

          # commit current work first

          test_syncbug = Bug.query.filter_by(bugid=self.basicbug.bug_id,

                                             milestone=newer_milestone).first()
@@ -232,7 +232,7 @@ 

          assert test_syncbug.proposed_blocker

          assert not test_syncbug.accepted_blocker

  

-     # when a accepted blocker is closed, it should be left alone except for 

+     # when a accepted blocker is closed, it should be left alone except for

      # marking the active feild false

      def should_closed_accepted_inactive(self):

          tracker_type = 'Blocker'

@@ -2,7 +2,7 @@ 

  from datetime import datetime

  from copy import copy

  

- from bunch import Bunch

+ from munch import Munch

  from mock import patch, Mock

  from fedora.client import ServerError

  
@@ -15,7 +15,7 @@ 

  

  

  # only required part of a Bodhi response

- base_update = Bunch(

+ base_update = Munch(

      title=u'anaconda-18.6.8-1.fc18',

      date_pushed=u'2012-09-13 16:40:28',

      date_submitted=u'2012-09-12 23:43:04',
@@ -24,11 +24,11 @@ 

      stable_karma=3,

      status=u'pending',

      bugs=[

-         Bunch(bug_id=2000, parent=False, security=False,

+         Munch(bug_id=2000, parent=False, security=False,

                title=u'bodhi bug 2000 title'),

-         Bunch(bug_id=2001, parent=False, security=False,

+         Munch(bug_id=2001, parent=False, security=False,

                title=u'bodhi bug 2001 title')],

-     release=Bunch(dist_tag=u'f99', id_prefix=u'FEDORA', locked=True,

+     release=Munch(dist_tag=u'f99', id_prefix=u'FEDORA', locked=True,

                    long_name=u'Fedora 99', name=u'F99'),

      updateid='FEDORA-2012-13902',

      url=u'https://bodhi.stg.fedoraproject.org/FEDORA-2012-13902',
@@ -39,14 +39,14 @@ 

  update1_for_bug_3000 = copy(base_update)

  update1_for_bug_3000.update({

      'title': u'libreport-2.1.3-2.fc19',

-     'bugs': [Bunch(bug_id=3000, parent=False, security=False,

+     'bugs': [Munch(bug_id=3000, parent=False, security=False,

                     title=u"anaconda can't report traceback to bugzilla")],

  })

  

  update2_for_bug_3000 = copy(base_update)

  update2_for_bug_3000.update({

      'title': u'jboss-servlet-2.5-api-1.0.1-3.fc19,resteasy-2.3.2-12.fc19',

-     'bugs': [Bunch(bug_id=3000, parent=False, security=False,

+     'bugs': [Munch(bug_id=3000, parent=False, security=False,

                     title=u"anaconda can't report traceback to bugzilla")],

  })

  
@@ -67,7 +67,7 @@ 

  

      def query(self, release=None, bugs=None, **kwargs):

          updates = list(chain(*(self.updates[(release, bug)] for bug in bugs)))

-         return Bunch(updates=updates,

+         return Munch(updates=updates,

                       page=1,

                       pages=1,

                       rows_per_page=20,
@@ -75,7 +75,7 @@ 

  

  class FakeErrorBodhiInterface(object):

      def query(self, **kwargs):

-         return Bunch(errors=[Bunch(location=u"querystring",

+         return Munch(errors=[Munch(location=u"querystring",

                                      name=u"release",

                                      description=u"Unknown release u'f99'")],

                       status=u"error")