Exemplo n.º 1
0
 def test_azureblobpublisher_publishes_without_path_and_prefix(
         self, mock_from_connection_string):
     connection_string = "https://azure.connection.string"
     mock_from_connection_string.side_effect = mock_func_from_connection_string
     with mock.patch.object(
             TestBlobServiceClient,
             'get_blob_client',
             return_value=TestBlobServiceClient()) as mock_get_blob_client:
         with LocalFetcher({'src': 'test/resources/testcases'}) as f:
             f.update()
             e = Executor(f.get_context())
             p = AzureBlobPublisher(
                 {'connection_string': connection_string})
             result = e.execute()
             stats = result.suite.statistics
             self.assertEqual(stats.critical.total, 2)
             p.publish(result)
             mock_from_connection_string.assert_called_with(
                 connection_string)
             now = datetime.now().strftime('%d-%m-%y')
             self.assertEqual(
                 mock_get_blob_client.call_args.kwargs['container'], '$web')
             self.assertTrue(
                 mock_get_blob_client.call_args.kwargs['blob'].startswith(
                     f'{now}'))
             self.assertTrue(
                 mock_get_blob_client.call_args.kwargs['blob'].endswith(
                     '.html'))
Exemplo n.º 2
0
 def test_executor_excludes_tags(self):
     with LocalFetcher({'src': 'test/resources/testcases'}) as f:
         f.update()
         e = Executor(f.context)
         result = e.execute(exclude_tags=['nonsmoke'])
         stats = result.suite.statistics
         self.assertEqual(stats.critical.total, 1)
Exemplo n.º 3
0
 def test_executor_execute_exact_testcase(self):
     e = Executor()
     result = e.execute('test/resources/testcases/activate_skynet.robot')
     self.assertEqual(result.return_code, 0)
     self.assertEqual(result.suite.name, 'Activate Skynet')
     test = result.suite.tests[0]
     self.assertEqual(test.name, 'Should Activate Skynet')
     self.assertTrue(test.passed and test.critical)
     stats = result.suite.statistics
     self.assertEqual(stats.critical.total, 2)
     self.assertEqual(stats.critical.failed, 0)
Exemplo n.º 4
0
 def test_caddypublisher_publishes_from_result(self, mock_put):
     url = "http://127.0.0.1:8080/uploads"
     with LocalFetcher({'src': 'test/resources/testcases'}) as f:
         f.update()
         e = Executor(f.get_context())
         p = CaddyPublisher({'url': url})
         result = e.execute()
         stats = result.suite.statistics
         self.assertEqual(stats.critical.total, 2)
         p.publish(result)
         now = datetime.now().strftime('%d-%m-%yT%H%M')
         self.assertTrue(
             mock_put.call_args.args[0].startswith(f'{url}/{now}'))
         self.assertTrue(mock_put.call_args.kwargs['data'].name.startswith(
             f'/tmp/{now}'))
Exemplo n.º 5
0
 def test_localpublisher_publishes_from_result(self):
     with LocalFetcher({'src': 'test/resources/testcases'}) as f:
         f.update()
         e = Executor(f.get_context())
         p = LocalPublisher({'dest': f.get_context()})
         result = e.execute()
         stats = result.suite.statistics
         self.assertEqual(stats.critical.total, 2)
         p.publish(result)
         found = False
         for filename in os.listdir(f.get_context()):
             if '.html' in filename:
                 found = True
                 now = datetime.now().strftime('%d-%m-%yT%H%M')
                 self.assertTrue(now in filename)
         self.assertTrue(found)
Exemplo n.º 6
0
 def test_executor_init(self):
     e = Executor('/tmp/rf-runner/')
     self.assertEqual('/tmp/rf-runner/', e.context)