Example #1
0
 def test_list_key_1(self, test_data):
     """
     @feature: Organizations
     @test: Create organization and list it
     @assert: organization is displayed/listed
     """
     org = ApiCrud.record_create(test_data)
     orgs = ApiCrud.record_list(org)
     self.assertTrue(any(org.name == ol.name for ol in orgs))
Example #2
0
def add_permission_to_user(user_created, perm):
    role = Role()
    created_role = ApiCrud.record_create(role)
    flter = Filter()
    flter.role_id = created_role.id
    flter.permission_ids = [perm.id]
    ApiCrud.record_create(flter)
    user_created.role_ids = [created_role.id]
    ApiCrud.record_update(user_created)
Example #3
0
 def test_list_key_1(self, test_data):
     """
     @feature: Organizations
     @test: Create organization and list it
     @assert: organization is displayed/listed
     """
     org = ApiCrud.record_create(test_data)
     orgs = ApiCrud.record_list(org)
     self.assertTrue(any(org.name == ol.name for ol in orgs))
Example #4
0
    def test_add_user_2(self, test_data):
        """
        @feature: Organizations
        @test: Create admin users then add user by using the organization name
        @assert: User is added to organization
        @status: manual
        """

        ApiCrud.record_create_recursive(test_data)
Example #5
0
    def test_add_user_2(self, test_data):
        """
        @feature: Organizations
        @test: Create admin users then add user by using the organization name
        @assert: User is added to organization
        @status: manual
        """

        ApiCrud.record_create_recursive(test_data)
Example #6
0
def add_permission_to_user(user_created, perm):
    role = Role()
    created_role = ApiCrud.record_create(role)
    flter = Filter()
    flter.role_id = created_role.id
    flter.permission_ids = [perm.id]
    ApiCrud.record_create(flter)
    user_created.role_ids = [created_role.id]
    ApiCrud.record_update(user_created)
Example #7
0
    def test_add_user_1(self, test_data):
        """
        @feature: Organizations
        @test: Create different types of users then add user
        by using the organization ID
        @assert: User is added to organization
        @status: manual
        """

        ApiCrud.record_create_recursive(test_data)
Example #8
0
 def test_positive_delete_1(self, test_data):
     """
     @feature: Organizations
     @test: Create organization with valid values then delete it
     @assert: organization is deleted
     """
     t = ApiCrud.record_create(test_data)
     self.assertTrue(ApiCrud.record_exists(t))
     ApiCrud.record_remove(t)
     self.assertFalse(ApiCrud.record_exists(t))
Example #9
0
 def test_positive_remove_1(self, test_data):
     """
     @feature: CustomYumRepo
     @test: Try removing custom repository with valid name/desc
     @assert: Product iscreated, sent and recieved data intersects
     """
     result = ApiCrud.record_create_recursive(test_data)
     self.assertTrue(ApiCrud.record_exists(result))
     ApiCrud.record_remove(result)
     self.assertFalse(ApiCrud.record_exists(result))
Example #10
0
 def test_positive_update_1(self, test_data):
     """
     @feature: Organizations
     @test: Create organization with valid values then update its name
     @assert: organization name is updated
     """
     org = Organization()
     org = ApiCrud.record_create(org)
     org.name = test_data.name
     ApiCrud.record_update(org)
Example #11
0
 def test_positive_delete_1(self, test_data):
     """
     @feature: Organizations
     @test: Create organization with valid values then delete it
     @assert: organization is deleted
     """
     t = ApiCrud.record_create(test_data)
     self.assertTrue(ApiCrud.record_exists(t))
     ApiCrud.record_remove(t)
     self.assertFalse(ApiCrud.record_exists(t))
Example #12
0
 def test_positive_update_1(self, test_data):
     """
     @feature: Organizations
     @test: Create organization with valid values then update its name
     @assert: organization name is updated
     """
     org = Organization()
     org = ApiCrud.record_create(org)
     org.name = test_data.name
     ApiCrud.record_update(org)
Example #13
0
 def test_positive_update_2(self, test_data):
     """
     @feature: Organizations
     @test: Create organization with valid values then update its label
     @assert: organization label is updated
     """
     org = Organization()
     org = ApiCrud.record_create(org)
     org.label = test_data.label
     ApiCrud.record_update(org)
Example #14
0
    def test_search_key_1(self, test_data):
        """
        @feature: Organizations
        @test: Create organization and search/find it
        @assert: organization can be found
        """

        ApiCrud.record_create(test_data)
        org_res = ApiCrud.record_resolve(test_data)
        self.assertEqual(org_res.name, test_data.name)
Example #15
0
    def test_add_user_1(self, test_data):
        """
        @feature: Organizations
        @test: Create different types of users then add user
        by using the organization ID
        @assert: User is added to organization
        @status: manual
        """

        ApiCrud.record_create_recursive(test_data)
Example #16
0
 def test_recursive_resolve(self):
     """
     @feature: Hosts
     @test: Verify, that we can get information about related fields
     @assert: host's defined operating system is correctly assigned
     """
     h = Host()
     h_cr = ApiCrud.record_create_recursive(h)
     h_rr = ApiCrud.record_resolve_recursive(h_cr)
     self.assertTrue(h.operatingsystem.name == h_rr.operatingsystem.name)
Example #17
0
 def test_recursive_resolve(self):
     """
     @feature: Hosts
     @test: Verify, that we can get information about related fields
     @assert: host's defined operating system is correctly assigned
     """
     h = Host()
     h_cr = ApiCrud.record_create_recursive(h)
     h_rr = ApiCrud.record_resolve_recursive(h_cr)
     self.assertTrue(h.operatingsystem.name == h_rr.operatingsystem.name)
Example #18
0
 def test_positive_remove_1(self, test_data):
     """
     @feature: CustomYumRepo
     @test: Try removing custom repository with valid name/desc
     @assert: Product iscreated, sent and recieved data intersects
     """
     result = ApiCrud.record_create_recursive(test_data)
     self.assertTrue(ApiCrud.record_exists(result))
     ApiCrud.record_remove(result)
     self.assertFalse(ApiCrud.record_exists(result))
Example #19
0
 def test_positive_update_3(self, test_data):
     """
     @feature: Organizations
     @test: Create organization with valid values then update its
     description
     @assert: organization description is updated
     """
     org = Organization()
     org = ApiCrud.record_create(org)
     org.description = test_data.description
     ApiCrud.record_update(org)
Example #20
0
    def test_search_key_1(self, test_data):
        """
        @feature: Organizations
        @test: Create organization and search/find it
        @assert: organization can be found
        @BZ: 1072905
        """

        ApiCrud.record_create(test_data)
        org_res = ApiCrud.record_resolve(test_data)
        self.assertEqual(org_res.name, test_data.name)
Example #21
0
    def test_info_key_1(self, test_data):
        """
        @feature: Organizations
        @test: Create single organization and get its info
        @assert: specific information for organization matches the
        creation values
        """

        org = ApiCrud.record_create(test_data)
        org_res = ApiCrud.record_resolve(org)
        self.assertEqual(org_res.name, test_data.name)
Example #22
0
    def test_positive_create(self, name):
        """
        @Feature: Environment - Positive Create
        @Test: Create new environment
        @Assert: Environment is created
        """

        environment = Environment(name=name)
        result = ApiCrud.record_create(environment)
        self.assertEqual(result.name, environment.name)
        self.assertTrue(ApiCrud.record_exists(environment))
Example #23
0
    def test_positive_create(self, name):
        """
        @Feature: Environment - Positive Create
        @Test: Create new environment
        @Assert: Environment is created
        """

        environment = Environment(name=name)
        result = ApiCrud.record_create(environment)
        self.assertEqual(result.name, environment.name)
        self.assertTrue(ApiCrud.record_exists(environment))
Example #24
0
 def test_positive_update_3(self, test_data):
     """
     @feature: Organizations
     @test: Create organization with valid values then update its
     description
     @assert: organization description is updated
     """
     org = Organization()
     org = ApiCrud.record_create(org)
     org.description = test_data.description
     ApiCrud.record_update(org)
Example #25
0
    def test_negative_create(self, name):
        """
        @Feature: Environment - Negative Create
        @Test: Create new environment
        @Assert: Environment is created
        """

        environment = Environment(name=name)
        with self.assertRaises(ApiException):
            result = ApiCrud.record_create(environment)
            self.assertIsNone(result)
        self.assertFalse(ApiCrud.record_exists(environment))
Example #26
0
    def test_positive_update_4(self, test_data):
        """
        @feature: Organizations
        @test: Create organization with valid values then update all values
        @assert: organization name, label and description are updated
        """
        org = Organization()
        org = ApiCrud.record_create(org)
        org.name = test_data.name
        org.description = test_data.description

        ApiCrud.record_update(org)
Example #27
0
    def test_cv_create_api(self, data):
        # variations (subject to change):
        # ascii string, alphanumeric, latin-1, utf8, etc.
        """
        @test: create content views (positive)
        @feature: Content Views
        @assert: content views are created
        """

        depends = ApiCrud.record_create_dependencies(data)
        result = ApiCrud.record_create(depends)
        self.assertIntersects(data, result)
Example #28
0
    def test_negative_create(self, name):
        """
        @Feature: Environment - Negative Create
        @Test: Create new environment
        @Assert: Environment is created
        """

        environment = Environment(name=name)
        with self.assertRaises(ApiException):
            result = ApiCrud.record_create(environment)
            self.assertIsNone(result)
        self.assertFalse(ApiCrud.record_exists(environment))
Example #29
0
 def test_remove_user_3(self, test_data):
     """
     @feature: Organizations
     @test: Create admin users then add user and remove it
     by using the organization name
     @assert: The user is added then removed from the organization
     @status: manual
     """
     u = ApiCrud.record_create_recursive(test_data)
     self.assertTrue("organizations" in u)
     u.organization_ids = []
     ur = ApiCrud.record_update(u)
     self.assertFalse("organizations" in ur)
Example #30
0
 def test_update(self, test_data):
     """
     @feature: ActivationKey
     @test: Verify, that update funkcionality works as intended
     @assert: different description is created after update.
     """
     update_desc = test_data.description
     test_data.description = "empty"
     ak_cr = ApiCrud.record_create(test_data)
     self.assertIntersects(ak_cr, test_data)
     ak_cr.description = update_desc
     ak_u = ApiCrud.record_update(ak_cr)
     self.assertEquals(ak_u.description, ak_cr.description)
Example #31
0
 def test_update(self, test_data):
     """
     @feature: CustomProduct
     @test: Verify, that update funkcionality works as intended
     @assert: different description is created after update.
     """
     update_desc = test_data.description
     test_data.description = "empty"
     ak_cr = ApiCrud.record_create_recursive(test_data)
     self.assertIntersects(ak_cr, test_data)
     ak_cr.description = update_desc
     ak_u = ApiCrud.record_update(ak_cr)
     self.assertEquals(ak_u.description, ak_cr.description)
Example #32
0
    def test_cv_edit(self, data):
        """
        @test: edit content views - name, description, etc.
        @feature: Content Views
        @assert: edited content view save is successful and info is
        updated
        """

        con_view = ContentViewDefinition()
        depends = ApiCrud.record_create_dependencies(con_view)
        t = ApiCrud.record_create(depends)
        con_view.name = data.name
        ApiCrud.record_update(t)
Example #33
0
 def test_remove_user_3(self, test_data):
     """
     @feature: Organizations
     @test: Create admin users then add user and remove it
     by using the organization name
     @assert: The user is added then removed from the organization
     @status: manual
     """
     u = ApiCrud.record_create_recursive(test_data)
     self.assertTrue("organizations" in u)
     u.organization_ids = []
     ur = ApiCrud.record_update(u)
     self.assertFalse("organizations" in ur)
Example #34
0
 def test_positive_sync_1(self, test_data):
     """
     @feature: CustomYumRepo
     @test: Create and sync repo
     @assert: repo should have more than 0 packages
     """
     result = ApiCrud.record_create_recursive(test_data)
     self.assertEqual({}, result.content_counts)
     task = result._meta.api_class.synchronize(result)
     task.poll(5, 100)
     self.assertEqual('success', task.result())
     resolved = ApiCrud.record_resolve(result)
     self.assertGreater(resolved.content_counts['rpm'], 0)
Example #35
0
 def test_update(self, ak):
     """
     @feature: ActivationKey
     @test: Verify, that update funkcionality works as intended
     @assert: different description is created after update.
     """
     update_desc = ak.description
     ak.description = "empty"
     ak_cr = ApiCrud.record_create(ak)
     self.assertIntersects(ak_cr, ak)
     ak_cr.description = update_desc
     ak_u = ApiCrud.record_update(ak_cr)
     self.assertEquals(ak_u.description, ak_cr.description)
Example #36
0
 def test_negative_create_2(self, test_data):
     """
     @feature: Organizations
     @test: Create organization with valid label and description, name is
     whitespace
     @assert: organization is not created
     """
     try:
         ApiCrud.record_create(test_data)
         correctly_failing = False
     except ApiException:
         correctly_failing = True
     self.assertTrue(correctly_failing)
Example #37
0
 def test_negative_create_2(self, test_data):
     """
     @feature: Organizations
     @test: Create organization with valid label and description, name is
     whitespace
     @assert: organization is not created
     """
     try:
         ApiCrud.record_create(test_data)
         correctly_failing = False
     except ApiException:
         correctly_failing = True
     self.assertTrue(correctly_failing)
Example #38
0
 def test_positive_sync_1(self, test_data):
     """
     @feature: CustomYumRepo
     @test: Create and sync repo
     @assert: repo should have more than 0 packages
     """
     result = ApiCrud.record_create_recursive(test_data)
     self.assertEqual({}, result.content_counts)
     task = result._meta.api_class.synchronize(result)
     task.poll(5, 100)
     self.assertEqual('success', task.result())
     resolved = ApiCrud.record_resolve(result)
     self.assertGreater(resolved.content_counts['rpm'], 0)
Example #39
0
 def test_negative_create_3(self, test_data):
     """
     @feature: Organizations
     @test: Create organization with valid values, then create a new one
     with same values.
     @assert: organization is not created
     """
     ApiCrud.record_create(test_data)
     try:
         ApiCrud.record_create(test_data)
         correctly_failing = False
     except ApiException:
         correctly_failing = True
     self.assertTrue(correctly_failing)
Example #40
0
    def test_remove_user_1(self, test_data):
        """
        @feature: Organizations
        @test: Create different types of users then add/remove user
        by using the organization ID
        @assert: User is added and then removed from organization
        @status: manual
        """

        u = ApiCrud.record_create_recursive(test_data)
        self.assertTrue("organizations" in u)
        u.organization_ids = []
        ur = ApiCrud.record_update(u)
        self.assertFalse("organizations" in ur)
Example #41
0
 def test_negative_create_3(self, test_data):
     """
     @feature: Organizations
     @test: Create organization with valid values, then create a new one
     with same values.
     @assert: organization is not created
     """
     ApiCrud.record_create(test_data)
     try:
         ApiCrud.record_create(test_data)
         correctly_failing = False
     except ApiException:
         correctly_failing = True
     self.assertTrue(correctly_failing)
Example #42
0
    def test_search_name_1(self, test_data):
        """
        @feature: Organizations
        @test: Create organization and search/find it
        @assert: organization can be found
        @BZ: 1072905
        """

        ApiCrud.record_create(test_data)
        query = {"search": "name=%s" % test_data.name}
        result = Organization._meta.api_class.list(json=query)
        self.assertTrue(result.ok)
        name = result.json()["results"][0]["name"]
        self.assertEqual(name, test_data.name)
Example #43
0
 def test_host_collections(self, test_data):
     """
     @test: Verify, that you can add host collections
     @feature: ActivationKey
     @assert: there was no system group and you have added one
     """
     acc = ApiCrud.record_create(test_data)
     self.assertEqual(len(acc.host_collections), 0)
     sg = HostCollectionDefOrg()
     sgc = ApiCrud.record_create(sg)
     r = acc._meta.api_class.add_host_collection(acc, [sgc.id])
     self.assertTrue(r.ok)
     acr = ApiCrud.record_resolve(acc)
     self.assertEqual(len(acr.host_collections), 1)
Example #44
0
    def test_remove_user_1(self, test_data):
        """
        @feature: Organizations
        @test: Create different types of users then add/remove user
        by using the organization ID
        @assert: User is added and then removed from organization
        @status: manual
        """

        u = ApiCrud.record_create_recursive(test_data)
        self.assertTrue("organizations" in u)
        u.organization_ids = []
        ur = ApiCrud.record_update(u)
        self.assertFalse("organizations" in ur)
Example #45
0
    def test_cv_composite_create(self, data):
        # Note: puppet repos cannot/should not be used in this test
        # It shouldn't work - and that is tested in a different case.
        # Individual modules from a puppet repo, however, are a valid
        # variation.
        """
        @test: create a composite content views
        @feature: Content Views
        @setup: sync multiple content source/types (RH, custom, etc.)
        @assert: Composite content views are created
       """

        data.composite = True
        depends = ApiCrud.record_create_dependencies(data)
        result = ApiCrud.record_create(depends)
        self.assertIntersects(data, result)
Example #46
0
 def test_positive_create_1(self, test_data):
     """
     @feature: CustomYumRepo
     @test: Try creating custom repository with valid name/desc
     @assert: Product iscreated, sent and recieved data intersects
     """
     result = ApiCrud.record_create_recursive(test_data)
     self.assertIntersects(test_data, result)
Example #47
0
 def test_cv_create_api_badorg_negative(self, data):
     # Use an invalid org name
     """
     @test: create content views (negative)
     @feature: Content Views
     @assert: content views are not created; proper error thrown and
     system handles it gracefully
     """
     try:
         data.organization.name = ""
         depends = ApiCrud.record_create_dependencies(data)
         result = ApiCrud.record_create(depends)
         self.assertIntersects(data, result)
         correctly_failing = False
     except ApiException:
         correctly_failing = True
     self.assertTrue(correctly_failing)
Example #48
0
 def test_positive_create_1(self, test_data):
     """
     @feature: CustomYumRepo
     @test: Try creating custom repository with valid name/desc
     @assert: Product iscreated, sent and recieved data intersects
     """
     result = ApiCrud.record_create_recursive(test_data)
     self.assertIntersects(test_data, result)
Example #49
0
 def test_positive_create_5(self, test_data):
     """
     @feature: Organizations
     @test: Create organization with valid name, label and description
     @assert: organization is created
     """
     result = ApiCrud.record_create(test_data)
     self.assertIntersects(test_data, result)
Example #50
0
 def test_positive_create_1(self, test_data):
     """
     @feature: ActivationKey
     @test: Try creating activation keys with valid name/label/desc
     @assert: ActivationKeyis created, sent and recieved data intersects
     """
     result = ApiCrud.record_create(test_data)
     self.assertIntersects(test_data, result)
Example #51
0
 def test_negative_update_2(self, test_data):
     """
     @feature: Organizations
     @test: Create organization with valid values then fail to update
     its label
     @assert: organization label is not updated
     """
     org = Organization()
     org = ApiCrud.record_create(org)
     org.label = test_data.label
     correctly_failing = True
     try:
         ApiCrud.record_update(org)
         correctly_failing = False
     except ApiException:
         correctly_failing = correctly_failing and True
     self.assertTrue(correctly_failing)
Example #52
0
 def test_positive_create_1(self, test_data):
     """
     @feature: ActivationKey
     @test: Try creating activation keys with valid name/label/desc
     @assert: ActivationKeyis created, sent and recieved data intersects
     """
     result = ApiCrud.record_create(test_data)
     self.assertIntersects(test_data, result)
Example #53
0
 def test_positive_create_5(self, test_data):
     """
     @feature: Organizations
     @test: Create organization with valid name, label and description
     @assert: organization is created
     """
     result = ApiCrud.record_create(test_data)
     self.assertIntersects(test_data, result)