(t *testing.T)
| 47 | } |
| 48 | |
| 49 | func TestAuthTelemetryEvent_records(t *testing.T) { |
| 50 | recorder := &telemetry.InvocationRecorderSpy{} |
| 51 | event := BeginAuthTelemetry(recorder, "login", "github.com", false) |
| 52 | |
| 53 | event.RecordExpiringSetupCancelled(true) |
| 54 | event.RecordHelperBefore("other") |
| 55 | event.RecordHelperAfter("ours") |
| 56 | event.RecordGitProtocol("ssh") |
| 57 | event.RecordExpiringReceived(true) |
| 58 | event.RecordStorage(true) |
| 59 | event.RecordSuccess() |
| 60 | |
| 61 | events := recorder.Events() |
| 62 | require.Len(t, events, 1) |
| 63 | dims := events[0].Dimensions |
| 64 | assert.Equal(t, "true", dims["expiring_setup_cred_helper_cancelled"]) |
| 65 | assert.Equal(t, "other", dims["git_credential_helper_before"]) |
| 66 | assert.Equal(t, "ours", dims["git_credential_helper_after"]) |
| 67 | assert.Equal(t, "ssh", dims["git_protocol"]) |
| 68 | assert.Equal(t, "true", dims["expiring_received"]) |
| 69 | assert.Equal(t, "plaintext", dims["storage_type"]) |
| 70 | assert.Equal(t, "true", dims["auth_success"]) |
| 71 | } |
| 72 | |
| 73 | func TestAuthTelemetryEvent_recordGitProtocolUnset(t *testing.T) { |
| 74 | recorder := &telemetry.InvocationRecorderSpy{} |
nothing calls this directly
no test coverage detected