(t *testing.T, ctx context.Context, s *ActionsStore)
| 129 | } |
| 130 | |
| 131 | func actionsCommitRepo(t *testing.T, ctx context.Context, s *ActionsStore) { |
| 132 | alice, err := newUsersStore(s.db).Create(ctx, "alice", "alice@example.com", CreateUserOptions{}) |
| 133 | require.NoError(t, err) |
| 134 | repo, err := newReposStore(s.db).Create(ctx, |
| 135 | alice.ID, |
| 136 | CreateRepoOptions{ |
| 137 | Name: "example", |
| 138 | }, |
| 139 | ) |
| 140 | require.NoError(t, err) |
| 141 | |
| 142 | now := time.Unix(1588568886, 0).UTC() |
| 143 | |
| 144 | conf.SetMockSSH(t, conf.SSHOpts{}) |
| 145 | conf.SetMockUI(t, conf.UIOpts{ |
| 146 | User: conf.UIUserOpts{ |
| 147 | NewsFeedPagingNum: 20, |
| 148 | }, |
| 149 | }) |
| 150 | |
| 151 | t.Run("new commit", func(t *testing.T) { |
| 152 | t.Cleanup(func() { |
| 153 | err := s.db.Session(&gorm.Session{AllowGlobalUpdate: true}).WithContext(ctx).Delete(new(Action)).Error |
| 154 | require.NoError(t, err) |
| 155 | }) |
| 156 | |
| 157 | err = s.CommitRepo(ctx, |
| 158 | CommitRepoOptions{ |
| 159 | PusherName: alice.Name, |
| 160 | Owner: alice, |
| 161 | Repo: repo, |
| 162 | RefFullName: "refs/heads/main", |
| 163 | OldCommitID: "ca82a6dff817ec66f44342007202690a93763949", |
| 164 | NewCommitID: "085bb3bcb608e1e8451d4b2432f8ecbe6306e7e7", |
| 165 | Commits: CommitsToPushCommits( |
| 166 | []*git.Commit{ |
| 167 | { |
| 168 | ID: git.MustIDFromString("085bb3bcb608e1e8451d4b2432f8ecbe6306e7e7"), |
| 169 | Author: &git.Signature{ |
| 170 | Name: "alice", |
| 171 | Email: "alice@example.com", |
| 172 | When: now, |
| 173 | }, |
| 174 | Committer: &git.Signature{ |
| 175 | Name: "alice", |
| 176 | Email: "alice@example.com", |
| 177 | When: now, |
| 178 | }, |
| 179 | Message: "A random commit", |
| 180 | }, |
| 181 | }, |
| 182 | ), |
| 183 | }, |
| 184 | ) |
| 185 | require.NoError(t, err) |
| 186 | |
| 187 | got, err := s.ListByUser(ctx, alice.ID, alice.ID, 0, false) |
| 188 | require.NoError(t, err) |
nothing calls this directly
no test coverage detected