File: test_OrganizationsApi.py

package info (click to toggle)
python-influxdb-client 1.40.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,216 kB
  • sloc: python: 60,236; sh: 64; makefile: 53
file content (24 lines) | stat: -rw-r--r-- 1,004 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from tests.base_test import BaseTest, generate_name


class OrganizationsApiTests(BaseTest):

    def setUp(self) -> None:
        super(OrganizationsApiTests, self).setUp()
        organizations_api = self.client.organizations_api()
        organizations = organizations_api.find_organizations()

        for organization in organizations:
            if organization.name.endswith("_IT"):
                print("Delete organization: ", organization.name)
                organizations_api.delete_organization(org_id=organization.id)

    def test_update_organization(self):
        organizations_api = self.client.organizations_api()

        organization = organizations_api.create_organization(name=generate_name(key='org'))
        self.assertEqual("", organization.description)

        organization.description = "updated description"
        organization = organizations_api.update_organization(organization=organization)
        self.assertEqual("updated description", organization.description)