Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
paladin-devops committed Nov 18, 2024
1 parent 1a6b4fa commit 2bc78c3
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions registry_module_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ func TestRegistryModulesList(t *testing.T) {
registryModuleTest2, registryModuleTest2Cleanup := createRegistryModule(t, client, orgTest, PrivateRegistry)
defer registryModuleTest2Cleanup()

newSubscriptionUpdater(orgTest).WithPlusEntitlementPlan().Update(t)
_, noCodeModuleCleanup := createNoCodeRegistryModule(t, client, orgTest.Name, registryModuleTest2, nil)
defer noCodeModuleCleanup()

t.Run("with no list options", func(t *testing.T) {
modl, err := client.RegistryModules.List(ctx, orgTest.Name, &RegistryModuleListOptions{})
require.NoError(t, err)
Expand Down Expand Up @@ -68,15 +64,28 @@ func TestRegistryModulesList(t *testing.T) {
})

t.Run("include no-code modules", func(t *testing.T) {
registryModuleTest3, registryModuleTest3Cleanup := createRegistryModule(t, client, orgTest, PrivateRegistry)
defer registryModuleTest3Cleanup()

newSubscriptionUpdater(orgTest).WithPlusEntitlementPlan().Update(t)
_, noCodeModuleCleanup := createNoCodeRegistryModule(t, client, orgTest.Name, registryModuleTest3, nil)
defer noCodeModuleCleanup()

modl, err := client.RegistryModules.List(ctx, orgTest.Name, &RegistryModuleListOptions{
Include: []RegistryModuleListIncludeOpt{
IncludeNoCodeModules,
},
})
require.NoError(t, err)
assert.Len(t, modl.Items, 2)
assert.True(t, modl.Items[1].NoCode)
assert.Len(t, modl.Items[1].RegistryNoCodeModule, 1)
assert.Len(t, modl.Items, 3)
// only module 3 is no-code, so iterate through the results before
// the test assertion
for _, m := range modl.Items {
if m.ID == registryModuleTest2.ID {
assert.True(t, modl.Items[2].NoCode)
assert.Len(t, modl.Items[2].RegistryNoCodeModule, 1)
}
}
})
}

Expand Down

0 comments on commit 2bc78c3

Please sign in to comment.