Esempio n. 1
0
 def test_get_relation_local_charm(self, mock_open, mexists):
     mock_open.return_value.__enter__ = lambda s: s
     mock_open.return_value.__exit__ = Mock()
     mock_open.return_value.read.return_value = RAW_METADATA_YAML
     mexists.return_value = True
     self.assertEqual(('provides', 'aniname'),
                      get_relation('/path/to/charm', 'plation'))
Esempio n. 2
0
 def test_get_relation_remote(self, mcharm):
     cdata = {'charm': {'relations': {'requires': {'relname': {'interface':
                                                               'iname'}}}}}
     mcharm.return_value = Charm.from_charmdata(cdata)
     self.assertEqual(('requires', 'iname'), get_relation('c', 'relname'))
Esempio n. 3
0
 def test_no_match(self, mock_open, mexists):
     mock_open.return_value.__enter__ = lambda s: s
     mock_open.return_value.__exit__ = Mock()
     mock_open.return_value.read.return_value = RAW_METADATA_YAML
     mexists.return_value = True
     self.assertEqual((None, None), get_relation('/path/charm', 'noop'))