def test_blueprint_resource(self):
        test_script_path = 'my_script.py'

        def mock_download_resource(script_path):
            self.assertEqual(script_path, test_script_path)
            return script_path
        result = tasks.download_resource(mock_download_resource,
                                         test_script_path)
        self.assertEqual(result, test_script_path)
Exemple #2
0
    def test_blueprint_resource(self):
        test_script_path = 'my_script.py'

        def mock_download_resource(script_path, target_path):
            self.assertEqual(script_path, test_script_path)
            return target_path
        result = tasks.download_resource(mock_download_resource,
                                         test_script_path)
        self.assertTrue(result.endswith(test_script_path))
Exemple #3
0
    def test_blueprint_resource(self):
        test_script_path = 'my_script.py'

        def mock_download_resource(script_path):
            self.assertEqual(script_path, test_script_path)
            return script_path

        result = tasks.download_resource(mock_download_resource,
                                         test_script_path)
        self.assertEqual(result, test_script_path)
Exemple #4
0
 def _test_url(self, url):
     script_path = url
     original_requests_get = requests.get
     try:
         requests.get = self._mock_requests_get
         result = tasks.download_resource(None, script_path)
         with open(result) as f:
             self.assertEqual(script_path, f.read())
         self.assertTrue(result.endswith('-some_script.py'))
     finally:
         requests.get = original_requests_get
 def _test_url(self, url):
     script_path = url
     original_requests_get = requests.get
     try:
         requests.get = self._mock_requests_get
         result = tasks.download_resource(None, script_path)
         with open(result) as f:
             self.assertEqual(script_path, f.read())
         self.assertTrue(result.endswith('-some_script.py'))
     finally:
         requests.get = original_requests_get