@@ -32,32 +32,56 @@ defmodule CodeCorps.GitHub.Event.InstallationRepositoriesTest do
3232
3333 test "creates repos" do
3434 % {
35- "installation" => % { "id" => installation_github_id } ,
35+ "installation" => % {
36+ "account" => % {
37+ "avatar_url" => installation_account_avatar_url ,
38+ "id" => installation_account_id ,
39+ "login" => installation_account_login ,
40+ "type" => installation_account_type
41+ } ,
42+ "id" => installation_github_id
43+ } ,
3644 "repositories_added" => [ repo_1_payload , repo_2_payload ]
3745 } = @ payload
3846
39- % { id: installation_id } = insert ( :github_app_installation , github_id: installation_github_id )
47+ % { id: installation_id } = insert ( :github_app_installation , github_account_avatar_url: installation_account_avatar_url , github_account_id: installation_account_id , github_account_login: installation_account_login , github_account_type: installation_account_type , github_id: installation_github_id )
4048
4149 { :ok , [ % GithubRepo { } , % GithubRepo { } ] } = InstallationRepositories . handle ( @ payload )
4250
4351 github_repo_1 = Repo . get_by ( GithubRepo , github_id: repo_1_payload [ "id" ] )
4452 assert github_repo_1
4553 assert github_repo_1 . name == repo_1_payload [ "name" ]
54+ assert github_repo_1 . github_account_avatar_url == installation_account_avatar_url
55+ assert github_repo_1 . github_account_id == installation_account_id
56+ assert github_repo_1 . github_account_login == installation_account_login
57+ assert github_repo_1 . github_account_type == installation_account_type
4658 assert github_repo_1 . github_app_installation_id == installation_id
4759
4860 github_repo_2 = Repo . get_by ( GithubRepo , github_id: repo_2_payload [ "id" ] )
4961 assert github_repo_2
5062 assert github_repo_2 . name == repo_2_payload [ "name" ]
63+ assert github_repo_2 . github_account_avatar_url == installation_account_avatar_url
64+ assert github_repo_2 . github_account_id == installation_account_id
65+ assert github_repo_2 . github_account_login == installation_account_login
66+ assert github_repo_2 . github_account_type == installation_account_type
5167 assert github_repo_2 . github_app_installation_id == installation_id
5268 end
5369
5470 test "skips creating existing repos" do
5571 % {
56- "installation" => % { "id" => installation_github_id } ,
72+ "installation" => % {
73+ "account" => % {
74+ "avatar_url" => installation_account_avatar_url ,
75+ "id" => installation_account_id ,
76+ "login" => installation_account_login ,
77+ "type" => installation_account_type
78+ } ,
79+ "id" => installation_github_id
80+ } ,
5781 "repositories_added" => [ repo_1_payload , repo_2_payload ]
5882 } = @ payload
5983
60- installation = insert ( :github_app_installation , github_id: installation_github_id )
84+ installation = insert ( :github_app_installation , github_account_avatar_url: installation_account_avatar_url , github_account_id: installation_account_id , github_account_login: installation_account_login , github_account_type: installation_account_type , github_id: installation_github_id )
6185 preinserted_repo = insert ( :github_repo , github_app_installation: installation , github_id: repo_1_payload [ "id" ] )
6286
6387 { :ok , [ % GithubRepo { } , % GithubRepo { } ] } = InstallationRepositories . handle ( @ payload )
@@ -68,6 +92,10 @@ defmodule CodeCorps.GitHub.Event.InstallationRepositoriesTest do
6892 github_repo_2 = Repo . get_by ( GithubRepo , github_id: repo_2_payload [ "id" ] )
6993 assert github_repo_2
7094 assert github_repo_2 . name == repo_2_payload [ "name" ]
95+ assert github_repo_2 . github_account_avatar_url == installation_account_avatar_url
96+ assert github_repo_2 . github_account_id == installation_account_id
97+ assert github_repo_2 . github_account_login == installation_account_login
98+ assert github_repo_2 . github_account_type == installation_account_type
7199 assert github_repo_2 . github_app_installation_id == installation . id
72100
73101 assert Repo . aggregate ( GithubRepo , :count , :id ) == 2
0 commit comments