File tree 6 files changed +100
-0
lines changed
read_github_namespace/graph
6 files changed +100
-0
lines changed Original file line number Diff line number Diff line change @@ -28,3 +28,5 @@ Pytest has been choosen as the test too.
28
28
CI/CD integration with the github actions
29
29
----------------------------------------
30
30
31
+ Is it possible to detect if the ssh key is valid for the org?
32
+ -------------------------------------------------------
Original file line number Diff line number Diff line change
1
+ [pytest]
2
+ markers =
3
+ integration: slower tests on network
Original file line number Diff line number Diff line change
1
+ import sys
2
+ import os
3
+
4
+
5
+ def clone (git_url ):
6
+ clone_cmd = f"git clone { git_url } "
7
+
8
+
9
+ def clone_list (nodes , to_folder ):
10
+ os .chdir (to_folder )
11
+ for node in nodes :
12
+ print (node ["name" ])
13
+ clone (node ["url" ])
Original file line number Diff line number Diff line change @@ -52,3 +52,12 @@ def fetch_org_repos(organization):
52
52
result = client .execute (query , variable_values = params )
53
53
print (result )
54
54
return result
55
+
56
+ def collate (data ):
57
+ try :
58
+ pass
59
+ nodes = data ["organization" ]["repositories" ]["nodes" ]
60
+ return nodes
61
+ except Exception as err :
62
+ print (f"Unexpected { err } " )
63
+ raise err
Original file line number Diff line number Diff line change
1
+ import pytest
2
+
3
+ from src .read_github_namespace .graph .fetch_org_repos import collate
4
+
5
+
6
+ data = {"organization" : {
7
+ "repositories" : {
8
+ "pageInfo" : {
9
+ "endCursor" : "Y3Vyc29yOnYyOpKkcnViec4FZeYV" ,
10
+ "hasNextPage" : False
11
+ },
12
+ "nodes" : [
13
+ {
14
+ "name" : ".github" ,
15
+ "url" : "https://github.com/kubernetes-client/.github"
16
+ },
17
+ {
18
+ "name" : "c" ,
19
+ "url" : "https://github.com/kubernetes-client/c"
20
+ },
21
+ {
22
+ "name" : "csharp" ,
23
+ "url" : "https://github.com/kubernetes-client/csharp"
24
+ },
25
+ {
26
+ "name" : "gen" ,
27
+ "url" : "https://github.com/kubernetes-client/gen"
28
+ },
29
+ {
30
+ "name" : "go" ,
31
+ "url" : "https://github.com/kubernetes-client/go"
32
+ },
33
+ {
34
+ "name" : "go-base" ,
35
+ "url" : "https://github.com/kubernetes-client/go-base"
36
+ },
37
+ {
38
+ "name" : "haskell" ,
39
+ "url" : "https://github.com/kubernetes-client/haskell"
40
+ },
41
+ {
42
+ "name" : "java" ,
43
+ "url" : "https://github.com/kubernetes-client/java"
44
+ },
45
+ {
46
+ "name" : "javascript" ,
47
+ "url" : "https://github.com/kubernetes-client/javascript"
48
+ },
49
+ {
50
+ "name" : "perl" ,
51
+ "url" : "https://github.com/kubernetes-client/perl"
52
+ },
53
+ {
54
+ "name" : "python" ,
55
+ "url" : "https://github.com/kubernetes-client/python"
56
+ },
57
+ {
58
+ "name" : "python-base" ,
59
+ "url" : "https://github.com/kubernetes-client/python-base"
60
+ },
61
+ {
62
+ "name" : "ruby" ,
63
+ "url" : "https://github.com/kubernetes-client/ruby"
64
+ }
65
+ ]
66
+ }
67
+ }}
68
+
69
+ def test_collate ():
70
+ test_org = "kubernetes-client"
71
+ collated = collate (data )
72
+ assert len (collated ) == len (data ["organization" ]["repositories" ]["nodes" ])
Original file line number Diff line number Diff line change 2
2
3
3
from src .read_github_namespace .graph .fetch_org_repos import fetch_org_repos
4
4
5
+ @pytest .mark .integration
5
6
def test_fetch ():
6
7
try :
7
8
fetch_org_repos ('kubernetes-client' )
You can’t perform that action at this time.
0 commit comments