<commit_before>$: << 'cf_spec'
require 'spec_helper'

describe 'CF Python Buildpack' do
  subject(:app) { Machete.deploy_app(app_name) }
  let(:browser) { Machete::Browser.new(app) }

  context 'with cached buildpack dependencies' do
    context 'in an offline environment', if: Machete::BuildpackMode.offline? do
      context 'app has dependencies' do
        let(:app_name) { 'flask_web_app' }

        specify do
          expect(app).to be_running

          browser.visit_path('/')
          expect(browser).to have_body('Hello, World!')

          expect(app.host).not_to have_internet_traffic
        end
      end

      context 'Warning when pip has mercurial dependencies' do
        let(:log_file) { File.open('log/integration.log', 'r') }
        let(:app_name) { 'mercurial_requirements' }

        before do
          log_file.readlines
        end

        specify do
          expect(app).not_to be_running(0)
          statement_appearances = log_file.readlines.join.scan 'Cloud Foundry does not support Pip Mercurial dependencies while in offline-mode. Vendor your dependencies if they do not work.'
          expect(statement_appearances.count).to be 1
          expect(app.host).to have_internet_traffic
        end
      end
    end
  end

  context 'without cached buildpack dependencies' do
    context 'in an online environment', if: Machete::BuildpackMode.online? do

      context 'app has dependencies' do
        let(:app_name) { 'flask_web_app' }

        specify do
          expect(app).to be_running

          browser.visit_path('/')
          expect(browser).to have_body('Hello, World!')
        end
      end

      context 'app has no dependencies' do
        let(:app_name) { 'flask_web_app_not_vendored' }

        specify do
          expect(app).to be_running

          browser.visit_path('/')
          expect(browser).to have_body('Hello, World!')
        end
      end
    end
  end
end
<commit_msg>Remove unnecessary Mercurial internet traffic check<commit_after>$: << 'cf_spec'
require 'spec_helper'

describe 'CF Python Buildpack' do
  subject(:app) { Machete.deploy_app(app_name) }
  let(:browser) { Machete::Browser.new(app) }

  context 'with cached buildpack dependencies' do
    context 'in an offline environment', if: Machete::BuildpackMode.offline? do
      context 'app has dependencies' do
        let(:app_name) { 'flask_web_app' }

        specify do
          expect(app).to be_running

          browser.visit_path('/')
          expect(browser).to have_body('Hello, World!')

          expect(app.host).not_to have_internet_traffic
        end
      end

      context 'Warning when pip has mercurial dependencies' do
        let(:log_file) { File.open('log/integration.log', 'r') }
        let(:app_name) { 'mercurial_requirements' }

        before do
          log_file.readlines
        end

        specify do
          expect(app).not_to be_running(0)
          statement_appearances = log_file.readlines.join.scan 'Cloud Foundry does not support Pip Mercurial dependencies while in offline-mode. Vendor your dependencies if they do not work.'
          expect(statement_appearances.count).to be 1
        end
      end
    end
  end

  context 'without cached buildpack dependencies' do
    context 'in an online environment', if: Machete::BuildpackMode.online? do

      context 'app has dependencies' do
        let(:app_name) { 'flask_web_app' }

        specify do
          expect(app).to be_running

          browser.visit_path('/')
          expect(browser).to have_body('Hello, World!')
        end
      end

      context 'app has no dependencies' do
        let(:app_name) { 'flask_web_app_not_vendored' }

        specify do
          expect(app).to be_running

          browser.visit_path('/')
          expect(browser).to have_body('Hello, World!')
        end
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.0933952528379773, 'fraction_numerical': 0.0010319917440660474, 'mean_word_length': 2.492792792792793, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3862749', 'n_tokens_mistral': 1164, 'n_tokens_neox': 1131, 'n_words': 301}