From 44b7256f3cef43e5ce79874d47cb811cf7176ec3 Mon Sep 17 00:00:00 2001 From: "shimoda.m@nds-tyo.co.jp" Date: Tue, 16 Aug 2022 11:08:05 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=E3=83=AC=E3=83=93=E3=83=A5=E3=83=BC?= =?UTF-8?q?=E6=8C=87=E6=91=98=E5=AF=BE=E5=BF=9C=20https://nds-tyo.backlog.?= =?UTF-8?q?com/git/NEWDWH2021/newsdwh2021/pullRequests/59#comment-1319332?= =?UTF-8?q?=20https://nds-tyo.backlog.com/git/NEWDWH2021/newsdwh2021/pullR?= =?UTF-8?q?equests/59#comment-1319342?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tests/salesforce/test_salesfoce.py | 46 ++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/ecs/crm-datafetch/tests/salesforce/test_salesfoce.py b/ecs/crm-datafetch/tests/salesforce/test_salesfoce.py index aac7f109..612c3679 100644 --- a/ecs/crm-datafetch/tests/salesforce/test_salesfoce.py +++ b/ecs/crm-datafetch/tests/salesforce/test_salesfoce.py @@ -41,6 +41,28 @@ class TestSalesforceApiClient: actual = sut.fetch_sf_count(soql) assert actual >= 1 + def test_fetch_sf_count_zero_record(self): + """ + Cases: + 取得範囲外の場合、Salesforceからオブジェクトの件数が取得できないこと + Arranges: + SalesforceのAccountオブジェクトに、レコードを作成する(手作業、コード上では行わない) + Expects: + 取得件数が0件になる + """ + soql = """SELECT + COUNT(Id) + FROM + Account + WHERE + SystemModstamp > 1999-01-01T00:00:00.000Z AND + SystemModstamp <= 2000-01-01T00:00:00.000Z + """ + sut = SalesforceApiClient() + + actual = sut.fetch_sf_count(soql) + assert actual >= 0 + def test_fetch_sf_count_by_soql_builder_system_modstamp_lt_from_and_to_ge(self): """ Cases: @@ -229,6 +251,28 @@ class TestSalesforceApiClient: assert dict(actual[0]) == expect + def test_fetch_sf_data_zero_record(self): + """ + Cases: + 取得範囲外の場合、Salesforceからオブジェクトが取得できないこと + Arranges: + SalesforceのAccountオブジェクトに、レコードを作成する(手作業、コード上では行わない) + Expects: + 取得件数が0件になる + """ + soql = """SELECT + COUNT(Id) + FROM + Account + WHERE + SystemModstamp > 1999-01-01T00:00:00.000Z AND + SystemModstamp <= 2000-01-01T00:00:00.000Z + """ + sut = SalesforceApiClient() + + actual = sut.fetch_sf_data(soql) + assert len(actual) >= 0 + def test_fetch_sf_data_by_soql_builder_system_modstamp_lt_from_and_to_ge(self): """ Cases: @@ -538,4 +582,4 @@ class TestSalesforceApiClient: sf = SalesforceApiClient() soql = "SELECT" with pytest.raises(Exception): - sf.fetch_sf_count(soql) + sf.fetch_sf_data(soql)