extension_test.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // +build acceptance compute extensions
  2. package v2
  3. import (
  4. "testing"
  5. "devel.mephi.ru/iacherepanov/openstack-gophercloud/acceptance/clients"
  6. "devel.mephi.ru/iacherepanov/openstack-gophercloud/acceptance/tools"
  7. "devel.mephi.ru/iacherepanov/openstack-gophercloud/openstack/common/extensions"
  8. th "devel.mephi.ru/iacherepanov/openstack-gophercloud/testhelper"
  9. )
  10. func TestExtensionsList(t *testing.T) {
  11. client, err := clients.NewComputeV2Client()
  12. th.AssertNoErr(t, err)
  13. allPages, err := extensions.List(client).AllPages()
  14. th.AssertNoErr(t, err)
  15. allExtensions, err := extensions.ExtractExtensions(allPages)
  16. th.AssertNoErr(t, err)
  17. var found bool
  18. for _, extension := range allExtensions {
  19. tools.PrintResource(t, extension)
  20. if extension.Name == "SchedulerHints" {
  21. found = true
  22. }
  23. }
  24. th.AssertEquals(t, found, true)
  25. }
  26. func TestExtensionsGet(t *testing.T) {
  27. client, err := clients.NewComputeV2Client()
  28. th.AssertNoErr(t, err)
  29. extension, err := extensions.Get(client, "os-admin-actions").Extract()
  30. th.AssertNoErr(t, err)
  31. tools.PrintResource(t, extension)
  32. th.AssertEquals(t, extension.Name, "AdminActions")
  33. }