MCPcopy
hub / github.com/dagger/container-use / TestRepositoryGet

Function TestRepositoryGet

environment/integration/repository_test.go:36–55  ·  view source on GitHub ↗

TestRepositoryGet tests retrieving an existing environment

(t *testing.T)

Source from the content-addressed store, hash-verified

34
35// TestRepositoryGet tests retrieving an existing environment
36func 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
58func TestRepositoryList(t *testing.T) {

Callers

nothing calls this directly

Calls 3

WithRepositoryFunction · 0.85
CreateEnvironmentMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected