| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,13 +8,13 @@ def setup(self): | |||
| 8 | 8 | @patch(Git, 'method_missing') | |
| 9 | 9 | def test_bake(self, git): | |
| 10 | 10 | git.return_value = fixture('rev_list_single') | |
| 11 | - | ||
| 11 | + | ||
| 12 | 12 | commit = Commit(self.repo, **{'id': '4c8124ffcf4039d292442eeccabdeca5af5c5017'}) | |
| 13 | 13 | commit.author # bake | |
| 14 | - | ||
| 14 | + | ||
| 15 | 15 | assert_equal("Tom Preston-Werner", commit.author.name) | |
| 16 | 16 | assert_equal("tom@mojombo.com", commit.author.email) | |
| 17 | - | ||
| 17 | + | ||
| 18 | 18 | assert_true(git.called) | |
| 19 | 19 | assert_equal(git.call_args, (('rev_list', '4c8124ffcf4039d292442eeccabdeca5af5c5017'), {'pretty': 'raw', 'max_count': 1})) | |
| 20 | 20 | ||
@@ -26,11 +26,11 @@ def test_id_abbrev(self, git): | |||
| 26 | 26 | @patch(Git, 'method_missing') | |
| 27 | 27 | def test_diff(self, git): | |
| 28 | 28 | git.return_value = fixture('diff_p') | |
| 29 | - | ||
| 29 | + | ||
| 30 | 30 | diffs = Commit.diff(self.repo, 'master') | |
| 31 | - | ||
| 31 | + | ||
| 32 | 32 | assert_equal(15, len(diffs)) | |
| 33 | - | ||
| 33 | + | ||
| 34 | 34 | assert_equal('.gitignore', diffs[0].a_path) | |
| 35 | 35 | assert_equal('.gitignore', diffs[0].b_path) | |
| 36 | 36 | assert_equal('4ebc8aea50e0a67e000ba29a30809d0a7b9b2666', diffs[0].a_commit.id) | |
@@ -39,7 +39,7 @@ def test_diff(self, git): | |||
| 39 | 39 | assert_equal(False, diffs[0].new_file) | |
| 40 | 40 | assert_equal(False, diffs[0].deleted_file) | |
| 41 | 41 | assert_equal("--- a/.gitignore\n+++ b/.gitignore\n@@ -1 +1,2 @@\n coverage\n+pkg", diffs[0].diff) | |
| 42 | - | ||
| 42 | + | ||
| 43 | 43 | assert_equal('lib/grit/actor.rb', diffs[5].a_path) | |
| 44 | 44 | assert_equal(None, diffs[5].a_commit) | |
| 45 | 45 | assert_equal('f733bce6b57c0e5e353206e692b0e3105c2527f4', diffs[5].b_commit.id) | |
@@ -51,47 +51,47 @@ def test_diff(self, git): | |||
| 51 | 51 | @patch(Git, 'method_missing') | |
| 52 | 52 | def test_diff_with_two_commits(self, git): | |
| 53 | 53 | git.return_value = fixture('diff_2') | |
| 54 | - | ||
| 54 | + | ||
| 55 | 55 | diffs = Commit.diff(self.repo, '59ddc32', '13d27d5') | |
| 56 | - | ||
| 56 | + | ||
| 57 | 57 | assert_equal(3, len(diffs)) | |
| 58 | - | ||
| 58 | + | ||
| 59 | 59 | assert_true(git.called) | |
| 60 | - assert_equal(git.call_args, (('diff', '59ddc32', '13d27d5', '--', 'master'), {'full_index': True})) | ||
| 60 | + assert_equal(git.call_args, (('diff', '59ddc32', '13d27d5'), {'full_index': True})) | ||
| 61 | 61 | ||
| 62 | - @patch(Git, 'method_missing') | ||
| 62 | + @patch(Git, 'method_missing') | ||
| 63 | 63 | def test_diff_with_files(self, git): | |
| 64 | 64 | git.return_value = fixture('diff_f') | |
| 65 | - | ||
| 65 | + | ||
| 66 | 66 | diffs = Commit.diff(self.repo, '59ddc32', ['lib']) | |
| 67 | - | ||
| 67 | + | ||
| 68 | 68 | assert_equal(1, len(diffs)) | |
| 69 | 69 | assert_equal('lib/grit/diff.rb', diffs[0].a_path) | |
| 70 | - | ||
| 70 | + | ||
| 71 | 71 | assert_true(git.called) | |
| 72 | 72 | assert_equal(git.call_args, (('diff', '59ddc32', '--', 'lib'), {'full_index': True})) | |
| 73 | - | ||
| 74 | - @patch(Git, 'method_missing') | ||
| 73 | + | ||
| 74 | + @patch(Git, 'method_missing') | ||
| 75 | 75 | def test_diff_with_two_commits_and_files(self, git): | |
| 76 | 76 | git.return_value = fixture('diff_2f') | |
| 77 | - | ||
| 77 | + | ||
| 78 | 78 | diffs = Commit.diff(self.repo, '59ddc32', '13d27d5', ['lib']) | |
| 79 | - | ||
| 79 | + | ||
| 80 | 80 | assert_equal(1, len(diffs)) | |
| 81 | 81 | assert_equal('lib/grit/commit.rb', diffs[0].a_path) | |
| 82 | - | ||
| 82 | + | ||
| 83 | 83 | assert_true(git.called) | |
| 84 | 84 | assert_equal(git.call_args, (('diff', '59ddc32', '13d27d5', '--', 'lib'), {'full_index': True})) | |
| 85 | 85 | ||
| 86 | 86 | @patch(Git, 'method_missing') | |
| 87 | 87 | def test_diffs(self, git): | |
| 88 | 88 | git.return_value = fixture('diff_p') | |
| 89 | - | ||
| 89 | + | ||
| 90 | 90 | commit = Commit(self.repo, id='91169e1f5fa4de2eaea3f176461f5dc784796769', parents=['038af8c329ef7c1bae4568b98bd5c58510465493']) | |
| 91 | 91 | diffs = commit.diffs | |
| 92 | - | ||
| 92 | + | ||
| 93 | 93 | assert_equal(15, len(diffs)) | |
| 94 | - | ||
| 94 | + | ||
| 95 | 95 | assert_equal('.gitignore', diffs[0].a_path) | |
| 96 | 96 | assert_equal('.gitignore', diffs[0].b_path) | |
| 97 | 97 | assert_equal('4ebc8aea50e0a67e000ba29a30809d0a7b9b2666', diffs[0].a_commit.id) | |
@@ -100,27 +100,27 @@ def test_diffs(self, git): | |||
| 100 | 100 | assert_equal(False, diffs[0].new_file) | |
| 101 | 101 | assert_equal(False, diffs[0].deleted_file) | |
| 102 | 102 | assert_equal("--- a/.gitignore\n+++ b/.gitignore\n@@ -1 +1,2 @@\n coverage\n+pkg", diffs[0].diff) | |
| 103 | - | ||
| 103 | + | ||
| 104 | 104 | assert_equal('lib/grit/actor.rb', diffs[5].a_path) | |
| 105 | 105 | assert_equal(None, diffs[5].a_commit) | |
| 106 | 106 | assert_equal('f733bce6b57c0e5e353206e692b0e3105c2527f4', diffs[5].b_commit.id) | |
| 107 | 107 | assert_equal(True, diffs[5].new_file) | |
| 108 | - | ||
| 108 | + | ||
| 109 | 109 | assert_true(git.called) | |
| 110 | - assert_equal(git.call_args, (('diff', '038af8c329ef7c1bae4568b98bd5c58510465493', | ||
| 111 | - '91169e1f5fa4de2eaea3f176461f5dc784796769', | ||
| 112 | - '--', '59ddc32', '13d27d5', '--', 'master'), {'full_index': True})) | ||
| 110 | + assert_equal(git.call_args, (('diff', '038af8c329ef7c1bae4568b98bd5c58510465493', | ||
| 111 | + '91169e1f5fa4de2eaea3f176461f5dc784796769', | ||
| 112 | + ), {'full_index': True})) | ||
| 113 | 113 | ||
| 114 | - @patch(Git, 'method_missing') | ||
| 114 | + @patch(Git, 'method_missing') | ||
| 115 | 115 | def test_diffs_on_initial_import(self, git): | |
| 116 | 116 | git.return_value = fixture('diff_i') | |
| 117 | - | ||
| 117 | + | ||
| 118 | 118 | commit = Commit(self.repo, id='634396b2f541a9f2d58b00be1a07f0c358b999b3') | |
| 119 | 119 | commit.__bake_it__() | |
| 120 | 120 | diffs = commit.diffs | |
| 121 | - | ||
| 121 | + | ||
| 122 | 122 | assert_equal(10, len(diffs)) | |
| 123 | - | ||
| 123 | + | ||
| 124 | 124 | assert_equal('History.txt', diffs[0].a_path) | |
| 125 | 125 | assert_equal('History.txt', diffs[0].b_path) | |
| 126 | 126 | assert_equal(None, diffs[0].a_commit) | |
@@ -129,61 +129,61 @@ def test_diffs_on_initial_import(self, git): | |||
| 129 | 129 | assert_equal(True, diffs[0].new_file) | |
| 130 | 130 | assert_equal(False, diffs[0].deleted_file) | |
| 131 | 131 | assert_equal("--- /dev/null\n+++ b/History.txt\n@@ -0,0 +1,5 @@\n+== 1.0.0 / 2007-10-09\n+\n+* 1 major enhancement\n+ * Birthday!\n+", diffs[0].diff) | |
| 132 | - | ||
| 132 | + | ||
| 133 | 133 | assert_equal('lib/grit.rb', diffs[5].a_path) | |
| 134 | 134 | assert_equal(None, diffs[5].a_commit) | |
| 135 | 135 | assert_equal('32cec87d1e78946a827ddf6a8776be4d81dcf1d1', diffs[5].b_commit.id) | |
| 136 | 136 | assert_equal(True, diffs[5].new_file) | |
| 137 | - | ||
| 137 | + | ||
| 138 | 138 | assert_true(git.called) | |
| 139 | 139 | assert_equal(git.call_args, (('show', '634396b2f541a9f2d58b00be1a07f0c358b999b3'), {'full_index': True, 'pretty': 'raw'})) | |
| 140 | - | ||
| 141 | - @patch(Git, 'method_missing') | ||
| 140 | + | ||
| 141 | + @patch(Git, 'method_missing') | ||
| 142 | 142 | def test_diffs_on_initial_import_with_empty_commit(self, git): | |
| 143 | 143 | git.return_value = fixture('show_empty_commit') | |
| 144 | - | ||
| 144 | + | ||
| 145 | 145 | commit = Commit(self.repo, id='634396b2f541a9f2d58b00be1a07f0c358b999b3') | |
| 146 | 146 | diffs = commit.diffs | |
| 147 | - | ||
| 147 | + | ||
| 148 | 148 | assert_equal([], diffs) | |
| 149 | - | ||
| 149 | + | ||
| 150 | 150 | assert_true(git.called) | |
| 151 | 151 | assert_equal(git.call_args, (('show', '634396b2f541a9f2d58b00be1a07f0c358b999b3'), {'full_index': True, 'pretty': 'raw'})) | |
| 152 | - | ||
| 153 | - @patch(Git, 'method_missing') | ||
| 152 | + | ||
| 153 | + @patch(Git, 'method_missing') | ||
| 154 | 154 | def test_diffs_with_mode_only_change(self, git): | |
| 155 | 155 | git.return_value = fixture('diff_mode_only') | |
| 156 | - | ||
| 156 | + | ||
| 157 | 157 | commit = Commit(self.repo, id='91169e1f5fa4de2eaea3f176461f5dc784796769') | |
| 158 | 158 | commit.__bake_it__() | |
| 159 | 159 | diffs = commit.diffs | |
| 160 | - | ||
| 160 | + | ||
| 161 | 161 | assert_equal(23, len(diffs)) | |
| 162 | 162 | assert_equal('100644', diffs[0].a_mode) | |
| 163 | 163 | assert_equal('100755', diffs[0].b_mode) | |
| 164 | - | ||
| 164 | + | ||
| 165 | 165 | assert_true(git.called) | |
| 166 | 166 | assert_equal(git.call_args, (('show', '91169e1f5fa4de2eaea3f176461f5dc784796769'), {'full_index': True, 'pretty': 'raw'})) | |
| 167 | 167 | ||
| 168 | - @patch(Git, 'method_missing') | ||
| 168 | + @patch(Git, 'method_missing') | ||
| 169 | 169 | def test_stats(self, git): | |
| 170 | 170 | git.return_value = fixture('diff_numstat') | |
| 171 | - | ||
| 171 | + | ||
| 172 | 172 | commit = Commit(self.repo, id='634396b2f541a9f2d58b00be1a07f0c358b999b3') | |
| 173 | 173 | commit.__bake_it__() | |
| 174 | 174 | stats = commit.stats | |
| 175 | - | ||
| 175 | + | ||
| 176 | 176 | keys = stats.files.keys() | |
| 177 | 177 | keys.sort() | |
| 178 | 178 | assert_equal(["a.txt", "b.txt"], keys) | |
| 179 | - | ||
| 179 | + | ||
| 180 | 180 | assert_true(git.called) | |
| 181 | 181 | assert_equal(git.call_args, (('diff', '634396b2f541a9f2d58b00be1a07f0c358b999b3'), {'numstat': True})) | |
| 182 | - | ||
| 182 | + | ||
| 183 | 183 | def test_str(self): | |
| 184 | 184 | commit = Commit(self.repo, id='abc') | |
| 185 | 185 | assert_equal ("abc", str(commit)) | |
| 186 | - | ||
| 186 | + | ||
| 187 | 187 | def test_repr(self): | |
| 188 | 188 | commit = Commit(self.repo, id='abc') | |
| 189 | 189 | assert_equal('<GitPython.Commit "abc">', repr(commit)) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments