Exemplo n.º 1
0
    def setUp(self):
        """Sets up a generic test control environment."""
        self.client = Client()
        self.requester = partial(request, client=self.client)
        _, token_object = request(client=self.client,
                                  path="tests/get_token",
                                  method="get")
        self.token = token_object.token

        MockSuite1.components = (MockSuite2, MockTestSuite)
        MockSuite2.components = (MockCase, MockCase1, MockCase2)
        MockTestSuite.components = (SuccessCase, )

        run_data = RunData(run_name='test_run_name')
        self.main_test = MockSuite1(run_data=run_data)
        tests_tree_dict = ClientResultManager._create_test_dict(self.main_test)
        run_data = {'run_name': self.main_test.data.run_data.run_name}

        response, _ = self.requester(path="tests/start_test_run",
                                     json_data={
                                         "run_data": run_data,
                                         "tests": tests_tree_dict,
                                         "token": self.token
                                     })
        self.assertEqual(response.status_code, http_client.NO_CONTENT)
        self.test_suite = next(iter(self.main_test))
        self.test_case = next(iter(self.test_suite))
Exemplo n.º 2
0
 def setUp(self):
     """Setup test environment."""
     self.client = Client()
     _, token_object = request(client=self.client,
                               path="tests/get_token", method="get")
     self.token = token_object.token
     self.requester = partial(request, client=self.client,
                              path="resources/cleanup_user")