def fetch_deployed_tag(env, username, password, path_name):
    """
    Fetches the currently deployed tag in the given environment

    Args:
        env (str): The environment to fetch the current tag name in (e.g. test or prod)
        username (str): The Acquia username necessary to run the command.
        password (str): The Acquia password necessary to run the command.
        path_name (str): The path to write the tag name to.
    """
    drupal.fetch_deployed_tag(env, username, password, path_name)
Example #2
0
def fetch_deployed_tag(env, username, password, path_name):
    """
    Fetches the currently deployed tag in the given environment

    Args:
        env (str): The environment to fetch the current tag name in (e.g. test or prod)
        username (str): The Acquia username necessary to run the command.
        password (str): The Acquia password necessary to run the command.
        path_name (str): The path to write the tag name to.
    """
    drupal.fetch_deployed_tag(env, username, password, path_name)
Example #3
0
def fetch_deployed_tag(app_id, env, client_id, secret, path_name):
    """
    Fetches the currently deployed tag in the given environment

    Args:
        app_id (str): The application id for drupal instance.
        env (str): The environment to fetch the current tag name in (e.g. test or prod)
        client_id (str): The Acquia api client id necessary to run the command.
        secret (str): The Acquia api secret key to run the command.
        path_name (str): The path to write the tag name to.
    """
    drupal.fetch_deployed_tag(app_id, env, client_id, secret, path_name)
Example #4
0
 def test_fetch_deployed_tag_failure(self, mock):
     """
     Tests fetch_deployed_tag raises BackendError when status != 200
     """
     mock.get(drupal.FETCH_TAG_URL.format(env=ACQUIA_ENV),
              json={},
              status_code=403)
     with self.assertRaises(BackendError):
         drupal.fetch_deployed_tag(env=ACQUIA_ENV,
                                   username=TEST_USERNAME,
                                   password=TEST_PASSWORD,
                                   path_name=PATH_NAME)
Example #5
0
 def test_fetch_deployed_tag_failure(self):
     """
     Tests fetch_deployed_tag raises BackendError when status != 200
     """
     httpretty.register_uri(
         httpretty.GET,
         drupal.FETCH_TAG_URL.format(env=ACQUIA_ENV),
         body="{}",
         content_type="application/json",
         status=403,
     )
     with self.assertRaises(BackendError):
         drupal.fetch_deployed_tag(
             env=ACQUIA_ENV, username=TEST_USERNAME, password=TEST_PASSWORD, path_name=PATH_NAME
         )
Example #6
0
    def test_fetch_deployed_tag_failure(self, mock_env_id, mock_token,
                                        mock_get_request):
        """
        Tests fetch_deployed_tag raises BackendError when status != 200
        """
        mock_env_id.return_value = ACQUIA_ENV_ID
        mock_token.return_value = TEST_TOKEN
        mock_get_request.return_value = Mock()
        mock_get_request.return_value.status_code = 403

        with self.assertRaises(BackendError):
            drupal.fetch_deployed_tag(app_id=ACQUIA_APP_ID,
                                      env=ACQUIA_ENV,
                                      client_id=TEST_CLIENT_ID,
                                      secret=TEST_SECRET,
                                      path_name=PATH_NAME)
Example #7
0
    def test_fetch_deployed_tag_success(self, mock_env_id, mock_token,
                                        mock_get_request):
        """
        Tests fetch_deployed_tag returns the expected tag name.
        """
        mock_env_id.return_value = ACQUIA_ENV_ID
        mock_token.return_value = TEST_TOKEN
        mock_get_request.return_value = Mock()
        mock_get_request.return_value.status_code = 200

        mock_get_request.return_value.json.return_value = {
            'vcs': {
                'type': 'git',
                'path': TEST_TAG,
                'url': '[email protected]:test.git'
            }
        }
        os.makedirs(DIR_NAME)
        expected = TEST_TAG
        actual = drupal.fetch_deployed_tag(app_id=ACQUIA_APP_ID,
                                           env=ACQUIA_ENV,
                                           client_id=TEST_CLIENT_ID,
                                           secret=TEST_SECRET,
                                           path_name=PATH_NAME)
        shutil.rmtree(DIR_NAME)
        self.assertEqual(actual, expected)
Example #8
0
 def test_fetch_deployed_tag_success(self, mock):
     """
     Tests fetch_deployed_tag returns the expected tag name.
     """
     mock.get(drupal.FETCH_TAG_URL.format(env=ACQUIA_ENV),
              json=FETCH_TAG_RESPONSE)
     os.makedirs(DIR_NAME)
     expected = TEST_TAG
     actual = drupal.fetch_deployed_tag(env=ACQUIA_ENV,
                                        username=TEST_USERNAME,
                                        password=TEST_PASSWORD,
                                        path_name=PATH_NAME)
     shutil.rmtree(DIR_NAME)
     self.assertEqual(actual, expected)
Example #9
0
 def test_fetch_deployed_tag_success(self):
     """
     Tests fetch_deployed_tag returns the expected tag name.
     """
     httpretty.register_uri(
         httpretty.GET,
         drupal.FETCH_TAG_URL.format(env=ACQUIA_ENV),
         body=FETCH_TAG_RESPONSE,
         content_type="application/json",
     )
     os.makedirs(DIR_NAME)
     expected = TEST_TAG
     actual = drupal.fetch_deployed_tag(
         env=ACQUIA_ENV, username=TEST_USERNAME, password=TEST_PASSWORD, path_name=PATH_NAME
     )
     shutil.rmtree(DIR_NAME)
     self.assertEqual(actual, expected)