~ubuntu-branches/ubuntu/trusty/swift/trusty-updates

« back to all changes in this revision

Viewing changes to test/unit/common/ring/test_builder.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, James Page, Chuck Short
  • Date: 2013-08-13 10:37:13 UTC
  • mfrom: (1.2.21)
  • Revision ID: package-import@ubuntu.com-20130813103713-1ctbx4zifyljs2aq
Tags: 1.9.1-0ubuntu1
[ James Page ]
* d/control: Update VCS fields for new branch locations.

[ Chuck Short ]
* New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
731
731
    @mock.patch('__builtin__.open', autospec=True)
732
732
    @mock.patch('swift.common.ring.builder.pickle.dump', autospec=True)
733
733
    def test_save(self, mock_pickle_dump, mock_open):
734
 
        mock_open.return_value = mock_fh = mock.Mock()
 
734
        mock_open.return_value = mock_fh = mock.MagicMock()
735
735
        rb = ring.RingBuilder(8, 3, 1)
736
736
        devs = [{'id': 0, 'region': 0, 'zone': 0, 'weight': 1,
737
737
                 'ip': '127.0.0.0', 'port': 10000, 'device': 'sda1',
749
749
        rb.rebalance()
750
750
        rb.save('some.builder')
751
751
        mock_open.assert_called_once_with('some.builder', 'wb')
752
 
        mock_pickle_dump.assert_called_once_with(rb.to_dict(), mock_fh,
 
752
        mock_pickle_dump.assert_called_once_with(rb.to_dict(), mock_fh.__enter__(),
753
753
                                                 protocol=2)
754
754
 
755
755
    def test_search_devs(self):