~johnsca/charm-helpers/hook-context

« back to all changes in this revision

Viewing changes to tests/contrib/openstack/test_openstack_utils.py

  • Committer: Liam Young
  • Date: 2014-10-20 09:39:31 UTC
  • mfrom: (202.3.11 charm-helpers-0mq)
  • Revision ID: liam.young@canonical.com-20141020093931-m8eiogi1u36zxsuv
[gnuoy,r=jamespage] Add 0mq support to charmhelpers/contrib/openstack

Show diffs side-by-side

added added

removed removed

Lines of Context:
677
677
            hn = openstack.get_hostname('4.2.2.1')
678
678
        self.assertEquals(hn, None)
679
679
 
 
680
    @patch('os.path.isfile')
 
681
    @patch('__builtin__.open')
 
682
    def test_get_matchmaker_map(self, _open, _isfile):
 
683
        _isfile.return_value = True
 
684
        mm_data = """
 
685
        {
 
686
           "cinder-scheduler": [
 
687
             "juju-t-machine-4"
 
688
            ]
 
689
        }
 
690
        """
 
691
        fh = _open.return_value.__enter__.return_value
 
692
        fh.read.return_value = mm_data
 
693
        self.assertEqual(
 
694
            openstack.get_matchmaker_map(),
 
695
            {'cinder-scheduler': ['juju-t-machine-4']}
 
696
        )
 
697
 
 
698
    @patch('os.path.isfile')
 
699
    @patch('__builtin__.open')
 
700
    def test_get_matchmaker_map_nofile(self, _open, _isfile):
 
701
        _isfile.return_value = False
 
702
        self.assertEqual(
 
703
            openstack.get_matchmaker_map(),
 
704
            {}
 
705
        )
 
706
 
680
707
if __name__ == '__main__':
681
708
    unittest.main()