コード例 #1
0
 def test_downloading_users_information(self, mock_open):
     """
     Test downloading xml file from http location to file.
     """
     mock_open.return_value = open(XML_URL)
     data = utils.download_users_information()
     self.assertTrue(data)
コード例 #2
0
 def test_downloading_users_information_key_error(self):
     """
     Test catching io exception during downloading xml file.
     """
     main.app.config.pop('XML_URL')
     self.assertFalse(utils.download_users_information())
コード例 #3
0
 def test_downloading_users_information_catch_error(self, mock_requests):
     """
     Test catching io exception during downloading xml file.
     """
     mock_requests.return_value = ''
     self.assertFalse(utils.download_users_information())