def test_run_tests(self, logwrap):
        session = self.prepare_session()
        client = OSTFClient(session)

        cluster_id = 0

        test_sets = ['smoke']

        test_name = 'test'

        client.run_tests(cluster_id=cluster_id, test_sets=test_sets)

        json = [
            {'metadata': {'cluster_id': str(cluster_id), 'config': {}},
             'testset': test_sets[0]}]

        session.post.assert_called_once_with(
            "/testruns", json=json
        )

        session.reset_mock()

        # noinspection PyTypeChecker
        client.run_tests(
            cluster_id=cluster_id, test_sets=test_sets, test_name=test_name)

        json[0]['tests'] = [test_name]

        session.post.assert_called_once_with(
            "/testruns", json=json
        )
예제 #2
0
    def test_run_tests(self, logwrap):
        session = self.prepare_session()
        client = OSTFClient(session)

        cluster_id = 0

        test_sets = ['smoke']

        test_name = 'test'

        client.run_tests(cluster_id=cluster_id, test_sets=test_sets)

        json = [{
            'metadata': {
                'cluster_id': str(cluster_id),
                'config': {}
            },
            'testset': test_sets[0]
        }]

        session.post.assert_called_once_with("/testruns", json=json)

        session.reset_mock()

        # noinspection PyTypeChecker
        client.run_tests(cluster_id=cluster_id,
                         test_sets=test_sets,
                         test_name=test_name)

        json[0]['tests'] = [test_name]

        session.post.assert_called_once_with("/testruns", json=json)
예제 #3
0
    def test_basic(self, logwrap):
        session = self.prepare_session()
        client = OSTFClient(session)

        cluster_id = 0

        client.get_test_sets(cluster_id=cluster_id)

        session.get.assert_called_once_with(
            url="/testsets/{}".format(cluster_id))

        session.reset_mock()

        client.get_tests(cluster_id=cluster_id)

        session.get.assert_called_once_with(url="/tests/{}".format(cluster_id))

        session.reset_mock()

        client.get_test_runs()

        session.get.assert_called_once_with(url="/testruns")
예제 #4
0
    def test_test_runs(self, logwrap):
        session = self.prepare_session()
        client = OSTFClient(session)

        cluster_id = 0
        testrun_id = 0xff

        client.get_test_runs(testrun_id=testrun_id)
        session.get.assert_called_once_with(
            url="/testruns/{}".format(testrun_id))

        session.reset_mock()

        client.get_test_runs(testrun_id=testrun_id, cluster_id=cluster_id)

        session.get.assert_called_once_with(
            url="/testruns/{}/{}".format(testrun_id, cluster_id))

        session.reset_mock()

        client.get_test_runs(cluster_id=cluster_id)

        session.get.assert_called_once_with(
            url="/testruns/last/{}".format(cluster_id))
    def test_basic(self, logwrap):
        session = self.prepare_session()
        client = OSTFClient(session)

        cluster_id = 0

        client.get_test_sets(cluster_id=cluster_id)

        session.get.assert_called_once_with(
            url="/testsets/{}".format(cluster_id))

        session.reset_mock()

        client.get_tests(cluster_id=cluster_id)

        session.get.assert_called_once_with(
            url="/tests/{}".format(cluster_id))

        session.reset_mock()

        client.get_test_runs()

        session.get.assert_called_once_with(url="/testruns")
    def test_test_runs(self, logwrap):
        session = self.prepare_session()
        client = OSTFClient(session)

        cluster_id = 0
        testrun_id = 0xff

        client.get_test_runs(testrun_id=testrun_id)
        session.get.assert_called_once_with(
            url="/testruns/{}".format(testrun_id))

        session.reset_mock()

        client.get_test_runs(testrun_id=testrun_id, cluster_id=cluster_id)

        session.get.assert_called_once_with(
            url="/testruns/{}/{}".format(testrun_id, cluster_id))

        session.reset_mock()

        client.get_test_runs(cluster_id=cluster_id)

        session.get.assert_called_once_with(
            url="/testruns/last/{}".format(cluster_id))