Exemplo n.º 1
0
    def invalid_username_login(self, monkeypatch):
        def mock_get(*args, **kwargs):
            return MockGetEmptyCustomerResponse()

        customer = customer_service.Customer({"username": "******", "password": "******"})
        monkeypatch.setattr(customer, "get_customer_details", mock_get)
        return customer
Exemplo n.º 2
0
    def return_empty_response(self, monkeypatch):
        def mock_get(*args, **kwargs):
            return MockGetEmptyResponse()

        customer = customer_service.Customer(1001)
        monkeypatch.setattr(customer.mongo_repository, "get_record", mock_get)
        return customer
Exemplo n.º 3
0
    def return_empty_response_loan(self, monkeypatch):
        def mock_get(*args, **kwargs):
            return {"data": []}

        customer = customer_service.Customer(1001)
        monkeypatch.setattr(customer.mongo_repository, "get_record", mock_get)
        return customer
Exemplo n.º 4
0
    def return_valid_loan_response(self, monkeypatch):
        def mock_get(*args, **kwargs):
            #return MockGetLoanResponse()
            return {"data": [{'username': '******',
                 'loanID': 1001,
                 'loanType': 'VL', 'loanAmount': 20000}]}

        customer = customer_service.Customer(1001)
        monkeypatch.setattr(customer.mongo_repository, "get_record", mock_get)
        return customer
Exemplo n.º 5
0
    def return_valid_response(self, monkeypatch):
        def mock_get(*args, **kwargs):
            return MockGetResponse()

        def mock_add(*args, **kwargs):
            return MockMongoInsertResponse()

        def mock_get_doc_number(*args, **kwargs):
            return 1000

        customer = customer_service.Customer(1001)
        monkeypatch.setattr(customer.mongo_repository, "get_record", mock_get)
        monkeypatch.setattr(customer.mongo_repository, "get_document_number", mock_get_doc_number)
        monkeypatch.setattr(customer.mongo_repository, "add_record", mock_add)
        return customer
Exemplo n.º 6
0
 def test_get_customer_details_without_identifier(self):
     app = Flask(__name__)
     with app.app_context():
         customer = customer_service.Customer(1001)
         response = customer.get_customer_details('accountNumber', None, True)
         assert response.json['message'] == 'Invalid search condition'