api.v1.test_accounts_report

Tests for accounts reports.

caseautomation:automated
casecomponent:api
caseimportance:high
caselevel:integration
requirement:Cloud Meter
testtype:functional
upstream:yes
integrade.tests.api.v1.test_accounts_report.accounts_report_data()

Create cloud account data for the accounts report tests.

Create three cloud accounts and create some instance data.

integrade.tests.api.v1.test_accounts_report.test_filter_by_account_id(accounts_report_data, superuser)

Test that cloud accounts report can be filtered by account ID.

Id:

8de488c4-2550-4d51-9d25-a7c4355fe6f4

Description:

Test that regular users and superusers can filter cloud accounts by account ID.

Steps:
  1. Add three cloud accounts
  2. Insert some instance events for all accounts.
  3. Filter the cloud accounts by providing the account_id of one of the three accounts ID
  4. Ensure a single account is returned and assert that their instance events are correct.
Expectedresults:
 

One account matched by its account ID is returned. All instance events should match.

integrade.tests.api.v1.test_accounts_report.test_filter_by_account_id_and_name(accounts_report_data, superuser)

Test that cloud accounts report can be filtered by account ID and name.

Id:

edacb611-dfec-4d8b-b480-b0c0d901c08e

Description:

Test that regular users and superusers can filter cloud accounts by account ID and name. This is not useful since the account ID will restrict the list to a single account but, since this is a possibility, ensure that an and operation will be done to match both account ID and name.

Steps:
  1. Add three cloud accounts
  2. Insert some instance events for all accounts.
  3. Filter the cloud accounts by providing the account_id and a name pattern that does not match the account’s name.
  4. Ensure an emptly list is returned since it won’t match anything.
  5. Now update the account ID and the name pattern to match both the account ID and the name.
  1. Ensure a single account is returned and assert that their instance events are correct.
Expectedresults:
 

No result should be returned if both account ID and name pattern don’t match any account. One result is returned when both account ID and name pattern match an account. All instance events should match for the matched account.

integrade.tests.api.v1.test_accounts_report.test_filter_by_name(accounts_report_data, superuser)

Test that cloud accounts can be filtered by name.

Id:

5abbfb8d-c447-464a-a980-4c7e8d2fcc80

Description:

Test that regular users and superusers can filter cloud accounts by name. Cloudigrade takes the search pattern, split its words and then for each word is matched as a substring in the name, any account that is matched is returned.

Steps:
  1. Add three cloud accounts
  2. Insert some instance events for all accounts.
  3. Filter the cloud accounts using a two words pattern. Each pattern’s word should match a single account.
  4. Ensure two accounts are returned and assert that their instance events are correct.
Expectedresults:
 

Two accounts are returned, one matched by the first word and the other by the second word. All instance events should match.

integrade.tests.api.v1.test_accounts_report.usertype(superuser)

Generate a test id based on the user type.