コード例 #1
0
 def test_is_deleted(self, mock__manager):
     mock__manager.return_value.get.return_value = []
     fres = resources.FuelEnvironment()
     fres.id = mock.Mock()
     self.assertTrue(fres.is_deleted())
     mock__manager.return_value.get.return_value = ["env"]
     self.assertFalse(fres.is_deleted())
コード例 #2
0
 def test_is_deleted(self, mock__manager):
     mock__manager.return_value.get.return_value = None
     fres = resources.FuelEnvironment()
     fres.id = mock.Mock()
     self.assertTrue(fres.is_deleted())
     mock__manager.return_value.get.return_value = "env"
     self.assertFalse(fres.is_deleted())
     mock__manager.return_value.get.assert_called_with(fres.id.return_value)
コード例 #3
0
    def test_list(self, mock_name_matches_object, mock__manager):
        envs = [{"name": "rally_one"}, {"name": "rally_two"},
                {"name": "three"}]
        mock__manager.return_value.list.return_value = envs
        mock_name_matches_object.side_effect = (
            lambda n, o: n.startswith("rally_"))

        fres = resources.FuelEnvironment()
        self.assertEqual(envs[:-1], fres.list())
コード例 #4
0
ファイル: test_resources.py プロジェクト: Pigueiras/rally
 def test_list(self, mock__manager):
     envs = [{
         "name": "rally_one"
     }, {
         "name": "rally_two"
     }, {
         "name": "three"
     }]
     mock__manager.return_value.list.return_value = envs
     fres = resources.FuelEnvironment()
     self.assertEqual(envs[:-1], fres.list())
コード例 #5
0
 def test_id(self):
     fres = resources.FuelEnvironment()
     fres.raw_resource = {"id": 42, "name": "chavez"}
     self.assertEqual(42, fres.id())