TestRepositoryGet tests retrieving an existing environment
(t *testing.T)
| 34 | |
| 35 | // TestRepositoryGet tests retrieving an existing environment |
| 36 | func TestRepositoryGet(t *testing.T) { |
| 37 | t.Parallel() |
| 38 | WithRepository(t, "repository-get", SetupEmptyRepo, func(t *testing.T, repo *repository.Repository, user *UserActions) { |
| 39 | ctx := context.Background() |
| 40 | |
| 41 | // Create an environment |
| 42 | env := user.CreateEnvironment("Test Get", "Testing repository get") |
| 43 | |
| 44 | // Get the environment using repository directly |
| 45 | retrieved, err := repo.Get(ctx, user.dag, env.ID) |
| 46 | require.NoError(t, err) |
| 47 | assert.NotNil(t, retrieved) |
| 48 | assert.Equal(t, env.ID, retrieved.ID) |
| 49 | assert.Equal(t, env.State.Title, retrieved.State.Title) |
| 50 | |
| 51 | // Test getting non-existent environment |
| 52 | _, err = repo.Get(ctx, user.dag, "non-existent-env") |
| 53 | assert.Error(t, err) |
| 54 | }) |
| 55 | } |
| 56 | |
| 57 | // TestRepositoryList tests listing all environments |
| 58 | func TestRepositoryList(t *testing.T) { |
nothing calls this directly
no test coverage detected