示例#1
0
    def test_positive_CRD(self):
        """Create organization with valid name, label and description

        :id: 35840da7-668e-4f78-990a-738aa688d586

        :expectedresults: organization is created with attributes

        :CaseImportance: Critical

        create read
        """
        # Create
        name = valid_org_names_list()[0]
        label = valid_labels_list()[0]
        desc = valid_data_list()[0]
        org = make_org({
            'name': name,
            'label': label,
            'description': desc,
        })
        self.assertEqual(org['name'], name)
        self.assertEqual(org['label'], label)
        self.assertEqual(org['description'], desc)

        # List
        result = Org.list({'search': 'name=%s' % org['name']})
        self.assertTrue(len(result), 1)
        self.assertEqual(result[0]['name'], org['name'])

        # Search scoped
        for query in [
                'label = {}'.format(label),
                'description ~ {}'.format(desc[:-5]),
                'name ^ "{}"'.format(org['name']),
        ]:
            result = Org.list({'search': query})
            self.assertTrue(len(result), 1)
            self.assertEqual(result[0]['name'], org['name'])

        # Search by name and label
        result = Org.exists(search=('name', org['name']))
        self.assertEqual(org['name'], result['name'])
        result = Org.exists(search=('label', org['label']))
        self.assertEqual(org['name'], result['name'])

        # Info by name and label
        result = Org.info({'label': org['label']})
        self.assertEqual(org['id'], result['id'])
        result = Org.info({'name': org['name']})
        self.assertEqual(org['id'], result['id'])

        # Delete
        Org.delete({'id': org['id']})
        with self.assertRaises(CLIReturnCodeError):
            Org.info({'id': org['id']})
示例#2
0
    def test_positive_delete_by_id(self):
        """Delete an organization by ID

        @feature: Organization

        @assert: organization is deleted
        """
        org = make_org()
        Org.delete({'id': org['id']})
        # Can we find the object?
        with self.assertRaises(CLIReturnCodeError):
            Org.info({'id': org['id']})
    def test_positive_delete_by_id(self):
        """Delete an organization by ID

        @id: b1f5d246-2b12-4302-9824-00d3561f8699

        @assert: organization is deleted
        """
        org = make_org()
        Org.delete({'id': org['id']})
        # Can we find the object?
        with self.assertRaises(CLIReturnCodeError):
            Org.info({'id': org['id']})
示例#4
0
    def test_positive_delete_by_id(self):
        """Delete an organization by ID

        @feature: Organization

        @assert: organization is deleted
        """
        org = make_org()
        Org.delete({'id': org['id']})
        # Can we find the object?
        with self.assertRaises(CLIReturnCodeError):
            Org.info({'id': org['id']})
示例#5
0
    def test_positive_delete_by_id(self):
        """Delete an organization by ID

        @id: b1f5d246-2b12-4302-9824-00d3561f8699

        @assert: organization is deleted
        """
        org = make_org()
        Org.delete({'id': org['id']})
        # Can we find the object?
        with self.assertRaises(CLIReturnCodeError):
            Org.info({'id': org['id']})
示例#6
0
def test_positive_CRD():
    """Create organization with valid name, label and description

    :id: 35840da7-668e-4f78-990a-738aa688d586

    :expectedresults: organization is created with attributes

    :CaseImportance: Critical

    create read
    """
    # Create
    name = valid_org_names_list()[0]
    label = valid_labels_list()[0]
    desc = list(valid_data_list().values())[0]
    org = make_org({'name': name, 'label': label, 'description': desc})

    assert org['name'] == name
    assert org['label'] == label
    assert org['description'] == desc

    # List
    result = Org.list({'search': f'name={name}'})
    assert len(result) == 1
    assert result[0]['name'] == name

    # Search scoped
    for query in [
        f'label = {label}',
        f'description ~ {desc[:-5]}',
        f'name ^ "{name}"',
    ]:
        result = Org.list({'search': query})
        assert len(result) == 1
        assert result[0]['name'] == name

    # Search by name and label
    result = Org.exists(search=('name', name))
    assert result['name'] == name
    result = Org.exists(search=('label', label))
    assert result['name'] == name

    # Info by name and label
    result = Org.info({'label': label})
    assert result['id'] == org['id']
    result = Org.info({'name': name})
    assert org['id'] == result['id']

    # Delete
    Org.delete({'id': org['id']})
    with pytest.raises(CLIReturnCodeError):
        result = Org.info({'id': org['id']})
    def test_positive_delete_by_name(self):
        """Delete an organization by name

        @id: c2787b85-fa87-4aaf-bee4-4695249dd5d8

        @assert: organization is deleted
        """
        for name in valid_org_names_list():
            with self.subTest(name):
                org = make_org({'name': name})
                Org.delete({'name': org['name']})
                # Can we find the object?
                with self.assertRaises(CLIReturnCodeError):
                    Org.info({'id': org['id']})
    def test_positive_delete_by_label(self):
        """Delete an organization by label

        @id: 5624f318-ce10-4eaa-815b-0d6ec1e6b438

        @assert: organization is deleted
        """
        for label in valid_labels_list():
            with self.subTest(label):
                org = make_org({'label': label})
                Org.delete({'label': org['label']})
                # Can we find the object?
                with self.assertRaises(CLIReturnCodeError):
                    Org.info({'id': org['id']})
示例#9
0
    def test_positive_delete_by_name(self):
        """Delete an organization by name

        @feature: Organization

        @assert: organization is deleted
        """
        for name in valid_org_names_list():
            with self.subTest(name):
                org = make_org({'name': name})
                Org.delete({'name': org['name']})
                # Can we find the object?
                with self.assertRaises(CLIReturnCodeError):
                    Org.info({'id': org['id']})
示例#10
0
    def test_positive_delete_by_label(self):
        """Delete an organization by label

        @feature: Organization

        @assert: organization is deleted
        """
        for label in valid_labels_list():
            with self.subTest(label):
                org = make_org({'label': label})
                Org.delete({'label': org['label']})
                # Can we find the object?
                with self.assertRaises(CLIReturnCodeError):
                    Org.info({'id': org['id']})
示例#11
0
    def test_positive_delete_by_id(self):
        """Delete an organization by ID

        :id: b1f5d246-2b12-4302-9824-00d3561f8699

        :expectedresults: organization is deleted

        :CaseImportance: Critical
        """
        org = make_org()
        Org.delete({'id': org['id']})
        # Can we find the object?
        with self.assertRaises(CLIReturnCodeError):
            Org.info({'id': org['id']})
示例#12
0
    def test_positive_delete_by_id(self):
        """Delete an organization by ID

        :id: b1f5d246-2b12-4302-9824-00d3561f8699

        :expectedresults: organization is deleted

        :CaseImportance: Critical
        """
        org = make_org()
        Org.delete({'id': org['id']})
        # Can we find the object?
        with self.assertRaises(CLIReturnCodeError):
            Org.info({'id': org['id']})
示例#13
0
    def test_positive_delete_by_name(self):
        """@test: Create organization with valid values then delete it
        by name

        @feature: Organization

        @assert: organization is deleted
        """
        for test_data in valid_name_desc_label():
            with self.subTest(test_data):
                org = make_org(test_data)
                Org.delete({'name': org['name']})
                # Can we find the object?
                with self.assertRaises(CLIReturnCodeError):
                    Org.info({'id': org['id']})
示例#14
0
    def test_positive_delete_by_name(self):
        """Delete an organization by name

        :id: c2787b85-fa87-4aaf-bee4-4695249dd5d8

        :expectedresults: organization is deleted

        :CaseImportance: Critical
        """
        for name in valid_org_names_list():
            with self.subTest(name):
                org = make_org({'name': name})
                Org.delete({'name': org['name']})
                # Can we find the object?
                with self.assertRaises(CLIReturnCodeError):
                    Org.info({'id': org['id']})
示例#15
0
    def test_positive_delete_by_label(self):
        """Delete an organization by label

        :id: 5624f318-ce10-4eaa-815b-0d6ec1e6b438

        :expectedresults: organization is deleted

        :CaseImportance: Critical
        """
        for label in valid_labels_list():
            with self.subTest(label):
                org = make_org({'label': label})
                Org.delete({'label': org['label']})
                # Can we find the object?
                with self.assertRaises(CLIReturnCodeError):
                    Org.info({'id': org['id']})