def setUp(self):

        dataRows = []

        # Generate the Run object(s)
        runTest = Run()
        runTest.name = 'python upload'
        runTest.data_rows = dataRows
        runTest.properties['RunFieldName'] = 'Run Field Value'

        # Generate the Batch object(s)
        batch = Batch()
        batch.runs = [runTest]
        # batch.name = 'python batch'
        batch.properties['PropertyName'] = 'Property Value'

        self.configs = configs.copy()
        self.service = MockSaveBatch(**self.configs)
        self.expected_kwargs = {
            'expected_args': [self.service.get_server_url()]
            , 'data': '{"assayId": 12345, "batches": [{"batchProtocolId": 0, "comment": null, "created": null, "createdBy": null, "lsid": null, "modified": null, "modifiedBy": null, "name": null, "properties": {"PropertyName": "Property Value"}, "runs": [{"comment": null, "created": null, "createdBy": null, "dataInputs": [], "dataRows": [], "experiments": [], "filePathRoot": null, "lsid": null, "materialInputs": [], "materialOutputs": [], "modified": null, "modifiedBy": null, "name": "python upload", "properties": {"RunFieldName": "Run Field Value"}}]}]}'
            , 'headers': {'Content-type': 'application/json', 'Accept': 'text/plain'}
        }

        self.args = [
            server_context, assay_id, batch
        ]
class TestSaveBatch(unittest.TestCase):

    def setUp(self):

        dataRows = []

        # Generate the Run object(s)
        runTest = Run()
        runTest.name = 'python upload'
        runTest.data_rows = dataRows
        runTest.properties['RunFieldName'] = 'Run Field Value'

        # Generate the Batch object(s)
        batch = Batch()
        batch.runs = [runTest]
        # batch.name = 'python batch'
        batch.properties['PropertyName'] = 'Property Value'

        self.configs = configs.copy()
        self.service = MockSaveBatch(**self.configs)
        self.expected_kwargs = {
            'expected_args': [self.service.get_server_url()]
            , 'data': '{"assayId": 12345, "batches": [{"batchProtocolId": 0, "comment": null, "created": null, "createdBy": null, "lsid": null, "modified": null, "modifiedBy": null, "name": null, "properties": {"PropertyName": "Property Value"}, "runs": [{"comment": null, "created": null, "createdBy": null, "dataInputs": [], "dataRows": [], "experiments": [], "filePathRoot": null, "lsid": null, "materialInputs": [], "materialOutputs": [], "modified": null, "modifiedBy": null, "name": "python upload", "properties": {"RunFieldName": "Run Field Value"}}]}]}'
            , 'headers': {'Content-type': 'application/json', 'Accept': 'text/plain'}
        }

        self.args = [
            server_context, assay_id, batch
        ]

    def test_success(self):
        test = self
        success_test(test, self.service.get_successful_response(), save_batch, *self.args, **self.expected_kwargs)

    def test_unauthorized(self):
        test = self
        throws_error_test(test, RequestAuthorizationError, self.service.get_unauthorized_response()
                          , save_batch, *self.args, **self.expected_kwargs)

    def test_query_not_found(self):
        test = self
        throws_error_test(test, QueryNotFoundError,  self.service.get_query_not_found_response()
                          , save_batch, *self.args, **self.expected_kwargs)

    def test_server_not_found(self):
        test = self
        throws_error_test(test, ServerNotFoundError, self.service.get_server_not_found_response()
                          , save_batch, *self.args, **self.expected_kwargs)

    def test_general_error(self):
        test = self
        throws_error_test(test, RequestError, self.service.get_general_error_response()
                          , save_batch, *self.args, **self.expected_kwargs)