fbe 0.0.60 → 0.0.61
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fbe/octo.rb +234 -75
- data/lib/fbe.rb +1 -1
- data/test/fbe/test_octo.rb +36 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 714cfed283ff521d4b0c51a0520157a1663da7786a0665debdc835fefcb39ea2
|
4
|
+
data.tar.gz: 61e090588bc4b073e00a3f496e382545d9e5a04f73d36225474fbee69d8423b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f819bf9191c6f18fc5671578f3bb3368ff3a6220df378e6938d0412fbd088d3f41f17017d3bf5d1abb59fbda12b06df99fd984769931ab7d558a31cfa1a1cd71
|
7
|
+
data.tar.gz: cf1a95c3f4ecbb8ed0a4c0bf644e2b2e286a0d041a8db93781bdf40280097f7ba5c2f6b21a891807067a2a92ee999a2f335bc255d58cbeaeeb2c63129b08adcd
|
data/lib/fbe/octo.rb
CHANGED
@@ -541,6 +541,64 @@ class Fbe::FakeOctokit
|
|
541
541
|
changed_files: 2
|
542
542
|
}
|
543
543
|
}
|
544
|
+
},
|
545
|
+
{
|
546
|
+
id: 43,
|
547
|
+
created_at: Time.now,
|
548
|
+
actor: { id: 42 },
|
549
|
+
type: 'PullRequestEvent',
|
550
|
+
repo: { id: repo },
|
551
|
+
payload: {
|
552
|
+
action: 'closed',
|
553
|
+
number: 172,
|
554
|
+
ref_type: 'tag',
|
555
|
+
ref: 'foo',
|
556
|
+
pull_request: {
|
557
|
+
url: 'https://api.github.com/repos/yegor256/judges/pulls/93',
|
558
|
+
id: 1_990_323_142,
|
559
|
+
node_id: 'PR_kwDOL6GCO852oevG',
|
560
|
+
number: 172,
|
561
|
+
state: 'closed',
|
562
|
+
locked: false,
|
563
|
+
title: '#999 new feature',
|
564
|
+
user: {
|
565
|
+
login: 'test',
|
566
|
+
id: 88_084_038,
|
567
|
+
node_id: 'MDQ6VXNlcjE2NDYwMjA=',
|
568
|
+
type: 'User',
|
569
|
+
site_admin: false
|
570
|
+
},
|
571
|
+
base: {
|
572
|
+
label: 'zerocracy:master',
|
573
|
+
ref: 'master',
|
574
|
+
user: {
|
575
|
+
login: 'zerocracy',
|
576
|
+
id: 24_234_201
|
577
|
+
},
|
578
|
+
repo: {
|
579
|
+
id: repo,
|
580
|
+
node_id: 'R_kgDOK2_4Aw',
|
581
|
+
name: 'judges-action',
|
582
|
+
full_name: 'zerocracy/judges-action',
|
583
|
+
private: false,
|
584
|
+
owner: {
|
585
|
+
login: 'zerocracy'
|
586
|
+
}
|
587
|
+
}
|
588
|
+
},
|
589
|
+
head: {
|
590
|
+
ref: 'zerocracy/judges-action',
|
591
|
+
sha: '74d0c234967de0f690805c6943e78db42a294c1a'
|
592
|
+
},
|
593
|
+
merged_at: Time.now,
|
594
|
+
comments: 2,
|
595
|
+
review_comments: 2,
|
596
|
+
commits: 1,
|
597
|
+
additions: 3,
|
598
|
+
deletions: 3,
|
599
|
+
changed_files: 2
|
600
|
+
}
|
601
|
+
}
|
544
602
|
}
|
545
603
|
]
|
546
604
|
end
|
@@ -691,65 +749,166 @@ class Fbe::FakeOctokit
|
|
691
749
|
]
|
692
750
|
end
|
693
751
|
|
694
|
-
def check_runs_for_ref(
|
695
|
-
{
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
752
|
+
def check_runs_for_ref(repo, sha)
|
753
|
+
data = {
|
754
|
+
'zerocracy/baza' => {
|
755
|
+
total_count: 7,
|
756
|
+
check_runs: [
|
757
|
+
{
|
758
|
+
id: 28_907_016_501,
|
759
|
+
name: 'make',
|
760
|
+
head_sha: sha,
|
761
|
+
started_at: '2024-08-18T08:04:44Z',
|
762
|
+
completed_at: '2024-08-18T08:20:17Z',
|
763
|
+
app: {
|
764
|
+
slug: 'github-actions'
|
765
|
+
}
|
766
|
+
},
|
767
|
+
{
|
768
|
+
id: 28_906_596_603,
|
769
|
+
name: 'copyrights',
|
770
|
+
head_sha: sha,
|
771
|
+
started_at: '2024-08-18T08:04:44Z',
|
772
|
+
completed_at: '2024-08-18T08:20:17Z',
|
773
|
+
app: {
|
774
|
+
slug: 'github-actions'
|
775
|
+
}
|
776
|
+
},
|
777
|
+
{
|
778
|
+
id: 28_906_596_550,
|
779
|
+
name: 'markdown-lint',
|
780
|
+
head_sha: sha,
|
781
|
+
started_at: '2024-08-18T08:04:44Z',
|
782
|
+
completed_at: '2024-08-18T08:20:17Z',
|
783
|
+
app: {
|
784
|
+
slug: 'github-actions'
|
785
|
+
}
|
786
|
+
},
|
787
|
+
{
|
788
|
+
id: 28_906_596_483,
|
789
|
+
name: 'pdd',
|
790
|
+
head_sha: sha,
|
791
|
+
started_at: '2024-08-18T08:04:44Z',
|
792
|
+
completed_at: '2024-08-18T08:20:17Z',
|
793
|
+
app: {
|
794
|
+
slug: 'github-actions'
|
795
|
+
}
|
796
|
+
},
|
797
|
+
{
|
798
|
+
id: 28_906_596_433,
|
799
|
+
name: 'rake',
|
800
|
+
head_sha: sha,
|
801
|
+
started_at: '2024-08-18T08:04:44Z',
|
802
|
+
completed_at: '2024-08-18T08:20:17Z',
|
803
|
+
app: {
|
804
|
+
slug: 'github-actions'
|
805
|
+
}
|
806
|
+
},
|
807
|
+
{
|
808
|
+
id: 28_906_596_405,
|
809
|
+
name: 'shellcheck',
|
810
|
+
head_sha: sha,
|
811
|
+
started_at: '2024-08-18T08:04:44Z',
|
812
|
+
completed_at: '2024-08-18T08:20:17Z',
|
813
|
+
app: {
|
814
|
+
slug: 'github-actions'
|
815
|
+
}
|
816
|
+
},
|
817
|
+
{
|
818
|
+
id: 28_906_596_379,
|
819
|
+
name: 'yamllint',
|
820
|
+
head_sha: sha,
|
821
|
+
started_at: '2024-08-18T08:04:44Z',
|
822
|
+
completed_at: '2024-08-18T08:20:17Z',
|
823
|
+
app: {
|
824
|
+
slug: 'github-actions'
|
825
|
+
}
|
826
|
+
}
|
827
|
+
]
|
828
|
+
},
|
829
|
+
'zerocracy/judges-action' => {
|
830
|
+
total_count: 7,
|
831
|
+
check_runs: [
|
832
|
+
{
|
833
|
+
id: 28_907_016_501,
|
834
|
+
name: 'Codacy Static Code Analysis',
|
835
|
+
head_sha: sha,
|
836
|
+
started_at: '2024-08-18T08:04:44Z',
|
837
|
+
completed_at: '2024-08-18T08:20:17Z',
|
838
|
+
app: {
|
839
|
+
slug: 'codacy-production'
|
840
|
+
}
|
841
|
+
},
|
842
|
+
{
|
843
|
+
id: 28_906_596_603,
|
844
|
+
name: 'copyrights',
|
845
|
+
head_sha: sha,
|
846
|
+
started_at: '2024-08-18T08:04:44Z',
|
847
|
+
completed_at: '2024-08-18T08:20:17Z',
|
848
|
+
app: {
|
849
|
+
slug: 'github-actions'
|
850
|
+
}
|
851
|
+
},
|
852
|
+
{
|
853
|
+
id: 28_906_596_550,
|
854
|
+
name: 'markdown-lint',
|
855
|
+
head_sha: sha,
|
856
|
+
started_at: '2024-08-18T08:04:44Z',
|
857
|
+
completed_at: '2024-08-18T08:20:17Z',
|
858
|
+
app: {
|
859
|
+
slug: 'github-actions'
|
860
|
+
}
|
861
|
+
},
|
862
|
+
{
|
863
|
+
id: 28_906_596_483,
|
864
|
+
name: 'pdd',
|
865
|
+
head_sha: sha,
|
866
|
+
started_at: '2024-08-18T08:04:44Z',
|
867
|
+
completed_at: '2024-08-18T08:20:17Z',
|
868
|
+
app: {
|
869
|
+
slug: 'github-actions'
|
870
|
+
}
|
871
|
+
},
|
872
|
+
{
|
873
|
+
id: 28_906_596_433,
|
874
|
+
name: 'rake',
|
875
|
+
head_sha: sha,
|
876
|
+
started_at: '2024-08-18T08:04:44Z',
|
877
|
+
completed_at: '2024-08-18T08:20:17Z',
|
878
|
+
app: {
|
879
|
+
slug: 'github-actions'
|
880
|
+
}
|
881
|
+
},
|
882
|
+
{
|
883
|
+
id: 28_906_596_405,
|
884
|
+
name: 'shellcheck',
|
885
|
+
head_sha: sha,
|
886
|
+
started_at: '2024-08-18T08:04:44Z',
|
887
|
+
completed_at: '2024-08-18T08:20:17Z',
|
888
|
+
app: {
|
889
|
+
slug: 'github-actions'
|
890
|
+
}
|
891
|
+
},
|
892
|
+
{
|
893
|
+
id: 28_906_596_379,
|
894
|
+
name: 'yamllint',
|
895
|
+
head_sha: sha,
|
896
|
+
started_at: '2024-08-18T08:04:44Z',
|
897
|
+
completed_at: '2024-08-18T08:20:17Z',
|
898
|
+
app: {
|
899
|
+
slug: 'github-actions'
|
900
|
+
}
|
901
|
+
}
|
902
|
+
]
|
903
|
+
}
|
748
904
|
}
|
905
|
+
data.fetch(repo) do
|
906
|
+
{ total_count: 0, check_runs: [] }
|
907
|
+
end
|
749
908
|
end
|
750
909
|
|
751
910
|
def workflow_run_job(_repo, job)
|
752
|
-
|
911
|
+
[
|
753
912
|
{
|
754
913
|
id: 28_907_016_501,
|
755
914
|
run_id: 10_438_531_072,
|
@@ -799,12 +958,17 @@ class Fbe::FakeOctokit
|
|
799
958
|
started_at: '2024-08-18T08:04:44Z',
|
800
959
|
completed_at: '2024-08-18T08:20:17Z'
|
801
960
|
}
|
802
|
-
].select { |json| json[:id] == job }
|
803
|
-
|
961
|
+
].select { |json| json[:id] == job }.first || {
|
962
|
+
id: job,
|
963
|
+
run_id: 1234,
|
964
|
+
name: 'run job',
|
965
|
+
started_at: '2024-08-18T08:04:44Z',
|
966
|
+
completed_at: '2024-08-18T08:20:17Z'
|
967
|
+
}
|
804
968
|
end
|
805
969
|
|
806
970
|
def workflow_run(repo, id)
|
807
|
-
|
971
|
+
[
|
808
972
|
{
|
809
973
|
id: 10_438_531_072,
|
810
974
|
event: 'pull_request',
|
@@ -861,22 +1025,17 @@ class Fbe::FakeOctokit
|
|
861
1025
|
started_at: '2024-08-18T08:04:44Z',
|
862
1026
|
completed_at: '2024-08-18T08:20:17Z'
|
863
1027
|
}
|
864
|
-
].select { |json| json[:id] == id }
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
repository: repository(repo)
|
877
|
-
}
|
878
|
-
else
|
879
|
-
runs.first
|
880
|
-
end
|
1028
|
+
].select { |json| json[:id] == id }.first || {
|
1029
|
+
id:,
|
1030
|
+
name: 'copyrights',
|
1031
|
+
head_branch: 'master',
|
1032
|
+
head_sha: '7d34c53e6743944dbf6fc729b1066bcbb3b18443',
|
1033
|
+
event: 'push',
|
1034
|
+
status: 'completed',
|
1035
|
+
conclusion: 'success',
|
1036
|
+
workflow_id: id,
|
1037
|
+
created_at: random_time,
|
1038
|
+
repository: repository(repo)
|
1039
|
+
}
|
881
1040
|
end
|
882
1041
|
end
|
data/lib/fbe.rb
CHANGED
data/test/fbe/test_octo.rb
CHANGED
@@ -162,4 +162,40 @@ class TestOcto < Minitest::Test
|
|
162
162
|
end
|
163
163
|
assert_in_delta(pause, Time.now - start_time, 1)
|
164
164
|
end
|
165
|
+
|
166
|
+
def test_fetches_fake_check_runs_for_ref
|
167
|
+
WebMock.disable_net_connect!
|
168
|
+
o = Fbe.octo(loog: Loog::NULL, global: {}, options: Judges::Options.new({ 'testing' => true }))
|
169
|
+
sha = 'f2ca1bb6c7e907d06'
|
170
|
+
result = o.check_runs_for_ref('zerocracy/baza', sha)
|
171
|
+
assert_equal(7, result[:total_count])
|
172
|
+
assert_equal(7, result[:check_runs].count)
|
173
|
+
result = o.check_runs_for_ref('zerocracy/judges-action', sha)
|
174
|
+
assert_equal(7, result[:total_count])
|
175
|
+
assert_equal(7, result[:check_runs].count)
|
176
|
+
result = o.check_runs_for_ref('zerocracy/something', sha)
|
177
|
+
assert_equal(0, result[:total_count])
|
178
|
+
assert_instance_of(Array, result[:check_runs])
|
179
|
+
assert_equal(0, result[:check_runs].count)
|
180
|
+
end
|
181
|
+
|
182
|
+
def test_fetches_fake_workflow_run
|
183
|
+
WebMock.disable_net_connect!
|
184
|
+
o = Fbe.octo(loog: Loog::NULL, global: {}, options: Judges::Options.new({ 'testing' => true }))
|
185
|
+
id = 10_438_531_072
|
186
|
+
result = o.workflow_run('zerocracy/baza', id)
|
187
|
+
assert_equal(id, result[:id])
|
188
|
+
result = o.workflow_run('zerocracy/baza', 0)
|
189
|
+
assert_equal(0, result[:id])
|
190
|
+
end
|
191
|
+
|
192
|
+
def test_fetches_fake_workflow_run_job
|
193
|
+
WebMock.disable_net_connect!
|
194
|
+
o = Fbe.octo(loog: Loog::NULL, global: {}, options: Judges::Options.new({ 'testing' => true }))
|
195
|
+
id = 28_906_596_433
|
196
|
+
result = o.workflow_run_job('zerocracy/baza', id)
|
197
|
+
assert_equal(id, result[:id])
|
198
|
+
result = o.workflow_run_job('zerocracy/baza', 0)
|
199
|
+
assert_equal(0, result[:id])
|
200
|
+
end
|
165
201
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fbe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.61
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yegor Bugayenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: backtrace
|