Example #1
0
    def test_get_node_by_name(self):
        settings = integrationtestsetttings.IntegrationTestSetttings()

        client = pyacp.ApprendaOpsClient(settings.baseurl, settings.adminEmail,
                                         settings.adminPassword)

        res = client.get_nodes(settings.testNodeName)

        self.assertIsNotNone(res)

        self.assertEqual(settings.testNodeName, res.name)
Example #2
0
    def test_get_custom_property_by_name_returns_key_error_for_unfound(self):
        settings = integrationtestsetttings.IntegrationTestSetttings()

        client = pyacp.ApprendaOpsClient(settings.baseurl, settings.adminEmail,
                                         settings.adminPassword)

        threw = False
        try:
            client.get_custom_properties("thisisneitheralovesongoracustomprop")
        except KeyError:
            threw = True

        self.assertTrue(threw)
Example #3
0
    def test_get_node_by_name_throws_with_unfound_node(self):
        settings = integrationtestsetttings.IntegrationTestSetttings()

        client = pyacp.ApprendaOpsClient(settings.baseurl, settings.adminEmail,
                                         settings.adminPassword)

        threw = False
        try:
            client.get_nodes("iamnotanodeimbadtestdata")
        except KeyError:
            threw = True

        self.assertTrue(threw)
Example #4
0
    def test_get_clouds_returns(self):
        settings = integrationtestsetttings.IntegrationTestSetttings()

        client = pyacp.ApprendaOpsClient(settings.baseurl, settings.adminEmail, settings.adminPassword)

        results = client.get_public_clouds()

        found_one = False

        # enumerate the generator and we'll start firing
        for cloud in results:
            self.assertIsNotNone(cloud)
            found_one = True

        self.assertTrue(found_one)
Example #5
0
    def testGetAppsByNameReturns404WhenNotFound(self):
        settings = integrationtestsetttings.IntegrationTestSetttings()

        client = pyacp.ApprendaOpsClient(settings.baseurl, settings.adminEmail,
                                         settings.adminPassword)

        bad_alias = "notAThingHereISwear"

        threw = False
        try:
            client.get_applications(bad_alias)
        except KeyError:
            threw = True

        self.assertTrue(threw)
Example #6
0
    def test_get_all_nodes_returns_at_least_one(self):
        settings = integrationtestsetttings.IntegrationTestSetttings()

        client = pyacp.ApprendaOpsClient(settings.baseurl, settings.adminEmail,
                                         settings.adminPassword)

        res = client.get_nodes()

        self.assertIsNotNone(res)

        found_one = False

        for node in res:
            self.assertIsNotNone(node)
            found_one = True

        self.assertTrue(found_one)
Example #7
0
    def test_get_cloud_by_id(self):
        settings = integrationtestsetttings.IntegrationTestSetttings()

        client = pyacp.ApprendaOpsClient(settings.baseurl, settings.adminEmail, settings.adminPassword)

        results = client.get_public_clouds()

        cloud = None
        for ret in results:
            cloud = ret
            break

        self.assertIsNotNone(cloud, "No cloud was found - ensure your platform has at least one add on installed to run this test")

        single_res = client.get_public_clouds(cloud.id)

        self.assertIsNotNone(single_res)
        self.assertEqual(cloud.id, single_res.id)
Example #8
0
    def testGetAtLeastOneApp(self):
        settings = integrationtestsetttings.IntegrationTestSetttings()

        client = pyacp.ApprendaOpsClient(settings.baseurl, settings.adminEmail,
                                         settings.adminPassword)
        # set our page size low so we page
        client.apps_page_size = 2

        results = client.get_applications()

        found_one = False

        # enumerate the generator and we'll start firing
        for application in results:
            self.assertIsNotNone(application)
            found_one = True

        self.assertTrue(found_one)
Example #9
0
    def test_get_addons_returns(self):
        settings = integrationtestsetttings.IntegrationTestSetttings()

        client = pyacp.ApprendaOpsClient(settings.baseurl, settings.adminEmail,
                                         settings.adminPassword)

        results = client.get_add_ons()

        found_one = False

        # enumerate the generator and we'll start firing
        for add_on in results:
            self.assertIsNotNone(add_on)
            found_one = True

        self.assertTrue(
            found_one,
            "No add on was found - ensure your platform has at least one add on installed to run this test"
        )
Example #10
0
    def test_paged_retrieves_at_least_one_custom_property(self):
        settings = integrationtestsetttings.IntegrationTestSetttings()

        client = pyacp.ApprendaOpsClient(settings.baseurl, settings.adminEmail,
                                         settings.adminPassword)

        #set paging low so we test it
        client.custom_properties_page_size = 1

        results = client.get_custom_properties()

        self.assertIsNotNone(results)

        found_one = False
        for prop in results:
            self.assertIsNotNone(prop)
            found_one = True

        self.assertTrue(found_one)
Example #11
0
    def testGetAppsByName(self):
        settings = integrationtestsetttings.IntegrationTestSetttings()

        client = pyacp.ApprendaOpsClient(settings.baseurl, settings.adminEmail,
                                         settings.adminPassword)
        # set our page size low so we page
        client.apps_page_size = 2

        results = client.get_applications()

        app = None
        for a in results:
            app = a
            break

        self.assertIsNotNone(app)
        self.assertTrue(app.name)

        res = client.get_applications(app.alias)

        self.assertIsNotNone(res)
        self.assertEqual(app.name, res.name)
Example #12
0
    def test_get_add_on_by_alias(self):
        settings = integrationtestsetttings.IntegrationTestSetttings()

        client = pyacp.ApprendaOpsClient(settings.baseurl, settings.adminEmail,
                                         settings.adminPassword)

        results = client.get_add_ons()

        add_on = None
        for ret in results:
            add_on = ret
            break

        self.assertIsNotNone(
            add_on,
            "No add on was found - ensure your platform has at least one add on installed to run this test"
        )

        single_res = client.get_add_ons(add_on.alias)

        self.assertIsNotNone(single_res)
        self.assertEqual(add_on.alias, single_res.alias)
Example #13
0
    def test_get_custom_property_by_name(self):
        settings = integrationtestsetttings.IntegrationTestSetttings()

        client = pyacp.ApprendaOpsClient(settings.baseurl, settings.adminEmail,
                                         settings.adminPassword)

        #set paging low so we test it
        client.custom_properties_page_size = 1

        results = client.get_custom_properties()

        self.assertIsNotNone(results)

        my_prop = None
        for prop in results:
            self.assertIsNotNone(prop)
            my_prop = prop

        single_res = client.get_custom_properties(my_prop.name)

        self.assertIsNotNone(single_res)
        self.assertEqual(my_prop.name, single_res.name)