def test_bad_request_doesnt_stop_ds_from_working(self):
        from ..helpers import SkipTest
        raise SkipTest("Test fails without network")

        self._set_password_server_response('bad_request')
        ds = DataSourceCloudStack({}, None, helpers.Paths({}))
        self.assertTrue(ds.get_data())
Esempio n. 2
0
 def test_valid_response_means_password_marked_as_saved(self):
     password = '******'
     subp = self._set_password_server_response(password)
     ds = DataSourceCloudStack({}, None, helpers.Paths({}))
     ds.get_data()
     self.assertRequestTypesSent(subp,
                                 ['send_my_password', 'saved_password'])
Esempio n. 3
0
 def test_password_sets_password(self):
     password = '******'
     self._set_password_server_response(password)
     ds = DataSourceCloudStack(
         {}, None, helpers.Paths({'run_dir': self.tmp}))
     ds.get_data()
     self.assertEqual(password, ds.get_config_obj()['password'])
 def test_valid_response_means_password_marked_as_saved(self):
     password = '******'
     http_client = self._set_password_server_response(password)
     ds = DataSourceCloudStack({}, None, helpers.Paths({}))
     ds.get_data()
     self.assertRequestTypesSent(http_client,
                                 ['send_my_password', 'saved_password'])
Esempio n. 5
0
 def test_password_sets_password(self):
     password = '******'
     self._set_password_server_response(password)
     ds = DataSourceCloudStack({}, None,
                               helpers.Paths({'run_dir': self.tmp}))
     ds.get_data()
     self.assertEqual(password, ds.get_config_obj()['password'])
Esempio n. 6
0
 def _check_password_not_saved_for(self, response_string):
     subp = self._set_password_server_response(response_string)
     ds = DataSourceCloudStack({}, None,
                               helpers.Paths({'run_dir': self.tmp}))
     with mock.patch(DS_PATH + '.wait_for_metadata_service') as m_wait:
         m_wait.return_value = True
         ds.get_data()
     self.assertRequestTypesSent(subp, ['send_my_password'])
Esempio n. 7
0
 def test_password_sets_password(self, m_wait):
     m_wait.return_value = True
     password = "******"
     self._set_password_server_response(password)
     ds = DataSourceCloudStack({}, None,
                               helpers.Paths({"run_dir": self.tmp}))
     ds.get_data()
     self.assertEqual(password, ds.get_config_obj()["password"])
    def test_saved_password_doesnt_create_config(self):
        from ..helpers import SkipTest
        raise SkipTest("Test fails without network")

        self._set_password_server_response('saved_password')
        ds = DataSourceCloudStack({}, None, helpers.Paths({}))
        ds.get_data()
        self.assertEqual({}, ds.get_config_obj())
    def _check_password_not_saved_for(self, response_string):
        from ..helpers import SkipTest
        raise SkipTest("Test fails without network")

        subp = self._set_password_server_response(response_string)
        ds = DataSourceCloudStack({}, None, helpers.Paths({}))
        ds.get_data()
        self.assertRequestTypesSent(subp, ['send_my_password'])
Esempio n. 10
0
 def test_valid_response_means_password_marked_as_saved(self, m_wait):
     m_wait.return_value = True
     password = '******'
     subp = self._set_password_server_response(password)
     ds = DataSourceCloudStack({}, None,
                               helpers.Paths({'run_dir': self.tmp}))
     ds.get_data()
     self.assertRequestTypesSent(subp,
                                 ['send_my_password', 'saved_password'])
Esempio n. 11
0
    def test_password_sets_password(self):
        from ..helpers import SkipTest
        raise SkipTest("Test fails without network")

        password = '******'
        self._set_password_server_response(password)
        ds = DataSourceCloudStack({}, None, helpers.Paths({}))
        ds.get_data()
        self.assertEqual(password, ds.get_config_obj()['password'])
Esempio n. 12
0
    def test_valid_response_means_password_marked_as_saved(self):
        from ..helpers import SkipTest
        raise SkipTest("Test fails without network")

        password = '******'
        subp = self._set_password_server_response(password)
        ds = DataSourceCloudStack({}, None, helpers.Paths({}))
        ds.get_data()
        self.assertRequestTypesSent(subp,
                                    ['send_my_password', 'saved_password'])
Esempio n. 13
0
 def test_bad_request_doesnt_stop_ds_from_working(self, m_wait):
     m_wait.return_value = True
     self._set_password_server_response('bad_request')
     ds = DataSourceCloudStack({}, None,
                               helpers.Paths({'run_dir': self.tmp}))
     self.assertTrue(ds.get_data())
Esempio n. 14
0
 def test_saved_password_doesnt_create_config(self):
     self._set_password_server_response('saved_password')
     ds = DataSourceCloudStack({}, None,
                               helpers.Paths({'run_dir': self.tmp}))
     ds.get_data()
     self.assertEqual({}, ds.get_config_obj())
Esempio n. 15
0
 def _check_password_not_saved_for(self, response_string):
     http_client = self._set_password_server_response(response_string)
     ds = DataSourceCloudStack({}, None, helpers.Paths({}))
     ds.get_data()
     self.assertRequestTypesSent(http_client, ['send_my_password'])
Esempio n. 16
0
 def test_bad_request_doesnt_stop_ds_from_working(self):
     self._set_password_server_response('bad_request')
     ds = DataSourceCloudStack({}, None, helpers.Paths({}))
     self.assertTrue(ds.get_data())
Esempio n. 17
0
 def test_bad_request_doesnt_stop_ds_from_working(self):
     self._set_password_server_response('bad_request')
     ds = DataSourceCloudStack({}, None, helpers.Paths({}))
     self.assertTrue(ds.get_data())
Esempio n. 18
0
 def test_saved_password_doesnt_create_config(self):
     self._set_password_server_response('saved_password')
     ds = DataSourceCloudStack({}, None, helpers.Paths({}))
     ds.get_data()
     self.assertEqual({}, ds.get_config_obj())
Esempio n. 19
0
 def test_empty_password_doesnt_create_config(self):
     self._set_password_server_response('')
     ds = DataSourceCloudStack({}, None, helpers.Paths({}))
     ds.get_data()
     self.assertEqual({}, ds.get_config_obj())
Esempio n. 20
0
 def _check_password_not_saved_for(self, response_string):
     subp = self._set_password_server_response(response_string)
     ds = DataSourceCloudStack({}, None, helpers.Paths({}))
     ds.get_data()
     self.assertRequestTypesSent(subp, ['send_my_password'])
Esempio n. 21
0
 def _check_password_not_saved_for(self, response_string):
     subp = self._set_password_server_response(response_string)
     ds = DataSourceCloudStack(
         {}, None, helpers.Paths({'run_dir': self.tmp}))
     ds.get_data()
     self.assertRequestTypesSent(subp, ['send_my_password'])
Esempio n. 22
0
 def test_empty_password_doesnt_create_config(self):
     self._set_password_server_response('')
     ds = DataSourceCloudStack(
         {}, None, helpers.Paths({'run_dir': self.tmp}))
     ds.get_data()
     self.assertEqual({}, ds.get_config_obj())