<commit_before>(ns circle.backend.test-git
  (:use midje.sweet)
  (:use circle.backend.git)
  (:require [circle.model.project :as project])
  (:require [circle.backend.build.test-utils :as test])
  (:require [circle.backend.github-url :as github])
  (:require fs))

(test/test-ns-setup)

(fact "clone works"
  (let [test-url (-> test/test-project :vcs_url)
        test-git-url (github/->ssh test-url)
        test-repo-path (default-repo-path test-url)
        ssh-key (project/ssh-key-for-url test-url)]
    (fs/deltree test-repo-path)
    (repo-exists? test-repo-path) => false
    (clone test-git-url :ssh-key ssh-key :path test-repo-path)
    (repo-exists? test-repo-path) => true
    (fs/exists? (fs/join test-repo-path "README.md")) => true))

(def known-commit "4ae57e3c6b6425465b7dd1d7ca2bb512777a927b")

(fact "commit-details works"
  (commit-details "." known-commit) =>
  {:subject "Create a guest user when adding repos, allow the guest user to set username & password at the end of the wizard"
   :committer_date "1323636643"
   :author_name "<NAME>"
   :parents ["1d3e617ac3abd287d63393d1ee03f13e4801b7c4"]
   :author_email "<EMAIL>"
   :author_date "1323636643"
   :committer_name "<NAME>"
   :body ""
   :branch "remotes/origin/pairing"
   :committer_email "<EMAIL>"})

(fact "committer-email works"
  (committer-email "." known-commit) => "<EMAIL>")<commit_msg>Update the test after deleting that branch<commit_after>(ns circle.backend.test-git
  (:use midje.sweet)
  (:use circle.backend.git)
  (:require [circle.model.project :as project])
  (:require [circle.backend.build.test-utils :as test])
  (:require [circle.backend.github-url :as github])
  (:require fs))

(test/test-ns-setup)

(fact "clone works"
  (let [test-url (-> test/test-project :vcs_url)
        test-git-url (github/->ssh test-url)
        test-repo-path (default-repo-path test-url)
        ssh-key (project/ssh-key-for-url test-url)]
    (fs/deltree test-repo-path)
    (repo-exists? test-repo-path) => false
    (clone test-git-url :ssh-key ssh-key :path test-repo-path)
    (repo-exists? test-repo-path) => true
    (fs/exists? (fs/join test-repo-path "README.md")) => true))

(def known-commit "4ae57e3c6b6425465b7dd1d7ca2bb512777a927b")

(fact "commit-details works"
  (commit-details "." known-commit) =>
  {:subject "Create a guest user when adding repos, allow the guest user to set username & password at the end of the wizard"
   :committer_date "1323636643"
   :author_name "<NAME>"
   :parents ["1d3e617ac3abd287d63393d1ee03f13e4801b7c4"]
   :author_email "<EMAIL>"
   :author_date "1323636643"
   :committer_name "<NAME>"
   :body ""
   :branch "remotes/origin/nginx_ssl~68"
   :committer_email "<EMAIL>"})

(fact "committer-email works"
  (committer-email "." known-commit) => "<EMAIL>")
{'fraction_non_alphanumeric': 0.1572349570200573, 'fraction_numerical': 0.0508595988538682, 'mean_word_length': 3.8743455497382198, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 27, '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': '7465349', 'n_tokens_mistral': 1123, 'n_tokens_neox': 1022, 'n_words': 223}