api.v1.test_list_accounts

Test account report summary API.

caseautomation:automated
casecomponent:api
caseimportance:high
caselevel:integration
requirement:Cloud Meter
testtype:functional
upstream:yes
class integrade.tests.api.v1.test_list_accounts.FutureParam

Configuration parameters for future instance scenarios.

Parameters: acct_age : int

The number of days old the account is
unknown : bool
True if we expect null/None responses because instance and image counts are unknown for the account in the current date range.
class integrade.tests.api.v1.test_list_accounts.InstanceTagParams

Configuration parameters for scenarios of instance types and times.

Parameters: name : str

The name of the parameter, visible in test results for identification
image_type : str
An empty string or series of comma-separated tags (rhel or openshift)

exp_inst : int | None exp_images : int | None exp_rhel : int | None exp_openshift : int | None

The numbers of instances, images, RHEL, and OpenShift expected to be seen

start : int end : int | None

The start and end times the instance was run. The end time can be None, in which case the instance was started and is still running at this time.
offset : int
An offset for the date range used to fetch data. If 0, fetch the last 30 days. If -30, fetch (roughly) “last month”
integrade.tests.api.v1.test_list_accounts.test_future_instances(param)

Test instance events generate usage summary results for correct tags.

Id:

f3c84697-a40c-40d9-846d-117e2647e9d3

Description:

Test combinations of image tags, start/end events, and the resulting counts from the summary report API.

Steps:
  1. Add a cloud account
  2. Insert instance, image, and event data
  3. GET from the account report endpoint
Expectedresults:
 
  • The instance, image, RHEL, and Openshift counts match the expectation
integrade.tests.api.v1.test_list_accounts.test_list_account_tagging(conf)

Test instance events generate usage summary results for correct tags.

Id:

f3c84697-a40c-40d9-846d-117e2647e9d3

Description:

Test combinations of image tags, start/end events, and the resulting counts from the summary report API.

Steps:
  1. Add a cloud account
  2. Insert instance, image, and event data
  3. GET from the account report endpoint
Expectedresults:
 
  • The instance, image, RHEL, and Openshift counts match the expectation
integrade.tests.api.v1.test_list_accounts.test_list_account_while_impersonating(impersonate)

Test account data fetched via impersonating a user as a superuser.

Id:

5f99c7ec-a4d3-4040-868f-9340015e4c9c

Description:

Test that the same assertions can be made for fetching data as a regular user and fetching data impersonating that same user

Steps:
  1. Add a cloud account
  2. Insert instance, image, and event data

3) GET from the account report endpoint as regular user 3) GET from the account report endpoint as super user impersonating

Expectedresults:
 
  • The instance, image, RHEL, and Openshift counts match the expectation
integrade.tests.api.v1.test_list_accounts.test_list_account_with_multiple()

Test that a user with multiple accounts can list all.

Id:

1f16a664-a4ea-410e-9ff8-0a6e42cb4df2

Description:

Test that the same assertions can be made for fetching data with just one account works with multiple.

Steps:
  1. Add a cloud account
  2. Insert instance, image, and event data
  3. GET from the account report endpoint as regular user
Expectedresults:
 
  • The instance, image, RHEL, and Openshift counts match the expectation
integrade.tests.api.v1.test_list_accounts.test_list_accounts_empty(create_user_account)

Test accounts without any instance or image history have empty summaries.

Id:

2a152ef6-fcd8-491c-b3cc-bda81699453a

Description:

Test that an account without any instances or images shows up in the results with 0 counts.

Steps:
  1. Add a cloud account
  2. GET from the account report endpoint
Expectedresults:
 
  • The account is in the response and matches the created account
  • Instances, images, RHEL, and Openshift all have 0 counts
integrade.tests.api.v1.test_list_accounts.test_multiple_runs_counted_once()

Test instances being run a different times in the same period count once.

Id:

0e8d0475-54d9-43af-9c2b-23f84865c6b4

Description:

Within any single period of reporting an instance which has been started and stopped multiple times still counts just once.

Steps:
  1. Add a cloud account
  2. Insert event data with more than one start and stop in the last 30 day period
  3. GET from the account report endpoint
Expectedresults:
 
  • The instance and image should only be counted once