Ejemplo n.º 1
0
def test_submit_online_problem(testsolver):
    # Arrange
    o_problem = OnlineProblem(name="test", blob_uri="mock_blob_uri")
    # Act
    _ = testsolver.submit(o_problem)
    # Assert
    testsolver.workspace.submit_job.assert_called_once()
Ejemplo n.º 2
0
 def test_submit_online_problem(self):
     # Arrange
     o_problem = OnlineProblem(name="test", blob_uri="mock_blob_uri")
     # Act
     azure.quantum.storage.get_container_uri = Mock(
         return_value="mock_container_uri")
     _ = self.testsolver.submit(o_problem)
     # Assert
     self.testsolver.workspace.submit_job.assert_called_once()
Ejemplo n.º 3
0
class TestOnlineProblemClass(QuantumTestBase):
    def setUp(self):
        self.mock_ws = Mock()
        self.mock_ws._get_linked_storage_sas_uri.return_value = Mock()
        self.o_problem = OnlineProblem(name="test", blob_uri="mock_blob_uri")

    # TODO: instead of using mock, connect to a live service and record the responses
    def test_download(self):
        azure.quantum.optimization.problem.download_blob = Mock(
            return_value=expected_terms())
        azure.quantum.optimization.problem.BlobClient = Mock()
        azure.quantum.optimization.problem.BlobClient.from_blob_url.return_value = Mock(
        )
        azure.quantum.optimization.problem.ContainerClient = Mock()
        azure.quantum.optimization.problem.ContainerClient.from_container_url.return_value = Mock(
        )
        actual_result = self.o_problem.download(self.mock_ws)
        # TODO: add test that user warning was registered in log
        assert actual_result.name == "test"
        azure.quantum.optimization.problem.download_blob.assert_called_once()
        assert isinstance(actual_result, Problem)
Ejemplo n.º 4
0
 def setUp(self):
     self.mock_ws = Mock()
     self.mock_ws._get_linked_storage_sas_uri.return_value = Mock()
     self.o_problem = OnlineProblem(name="test", blob_uri="mock_blob_uri")