@@ -25,14 +25,11 @@ def db(pull_requests):
25
25
26
26
def test_tables (db ):
27
27
assert {"pull_requests" , "users" , "repos" , "milestones" } == set (db .table_names ())
28
- assert {
29
- ForeignKey (
30
- table = "pull_requests" , column = "repo" , other_table = "repos" , other_column = "id"
31
- ),
28
+ assert set (db ["pull_requests" ].foreign_keys ) == {
32
29
ForeignKey (
33
30
table = "pull_requests" ,
34
- column = "milestone " ,
35
- other_table = "milestones " ,
31
+ column = "merged_by " ,
32
+ other_table = "users " ,
36
33
other_column = "id" ,
37
34
),
38
35
ForeignKey (
@@ -41,10 +38,19 @@ def test_tables(db):
41
38
other_table = "users" ,
42
39
other_column = "id" ,
43
40
),
41
+ ForeignKey (
42
+ table = "pull_requests" ,
43
+ column = "milestone" ,
44
+ other_table = "milestones" ,
45
+ other_column = "id" ,
46
+ ),
47
+ ForeignKey (
48
+ table = "pull_requests" , column = "repo" , other_table = "repos" , other_column = "id"
49
+ ),
44
50
ForeignKey (
45
51
table = "pull_requests" , column = "user" , other_table = "users" , other_column = "id"
46
52
),
47
- } == set ( db [ "pull_requests" ]. foreign_keys )
53
+ }
48
54
49
55
50
56
def test_pull_requests (db ):
@@ -74,7 +80,7 @@ def test_pull_requests(db):
74
80
"mergeable" : None ,
75
81
"rebaseable" : None ,
76
82
"mergeable_state" : "unknown" ,
77
- "merged_by" : '{"login": "simonw", "id": 9599, "node_id": "MDQ6VXNlcjk1OTk=", "avatar_url": "https://avatars0.githubusercontent.com/u/9599?v=4", "gravatar_id": "", "url": "https://api.github.com/users/simonw", "html_url": "https://github.com/simonw", "followers_url": "https://api.github.com/users/simonw/followers", "following_url": "https://api.github.com/users/simonw/following{/other_user}", "gists_url": "https://api.github.com/users/simonw/gists{/gist_id}", "starred_url": "https://api.github.com/users/simonw/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/simonw/subscriptions", "organizations_url": "https://api.github.com/users/simonw/orgs", "repos_url": "https://api.github.com/users/simonw/repos", "events_url": "https://api.github.com/users/simonw/events{/privacy}", "received_events_url": "https://api.github.com/users/simonw/received_events", "type": "User", "site_admin": false}' ,
83
+ "merged_by" : 9599 ,
78
84
"comments" : 0 ,
79
85
"review_comments" : 0 ,
80
86
"maintainer_can_modify" : 0 ,
@@ -106,10 +112,16 @@ def test_users(db):
106
112
107
113
108
114
def test_foreign_keys (db ):
109
- assert [
115
+ assert db [ "pull_requests" ]. foreign_keys == [
110
116
ForeignKey (
111
117
table = "pull_requests" , column = "repo" , other_table = "repos" , other_column = "id"
112
118
),
119
+ ForeignKey (
120
+ table = "pull_requests" ,
121
+ column = "merged_by" ,
122
+ other_table = "users" ,
123
+ other_column = "id" ,
124
+ ),
113
125
ForeignKey (
114
126
table = "pull_requests" ,
115
127
column = "milestone" ,
@@ -125,4 +137,4 @@ def test_foreign_keys(db):
125
137
ForeignKey (
126
138
table = "pull_requests" , column = "user" , other_table = "users" , other_column = "id"
127
139
),
128
- ] == db [ "pull_requests" ]. foreign_keys
140
+ ]
0 commit comments