modified serialized method and schema

This commit is contained in:
venusbb
2017-10-26 13:25:11 +01:00
parent e88b311c8e
commit c10cde6b22
5 changed files with 31 additions and 14 deletions

View File

@@ -288,30 +288,30 @@ def test_create_free_sms_fragment_limit(client, sample_service):
def test_update_free_sms_fragment_limit(client, sample_service):
data_old = {'financial_year_start': 2015, 'free_sms_fragment_limit': 1000}
data_old = {'financial_year_start': 2016, 'free_sms_fragment_limit': 1000}
response = client.post('service/{}/billing/free-sms-fragment-limit'.format(sample_service.id),
data=json.dumps(data_old),
headers=[('Content-Type', 'application/json'), create_authorization_header()])
data_new = {'financial_year_start': 2015, 'free_sms_fragment_limit': 9999}
data_new = {'financial_year_start': 2016, 'free_sms_fragment_limit': 9999}
response = client.post('service/{}/billing/free-sms-fragment-limit'.format(sample_service.id),
data=json.dumps(data_new),
headers=[('Content-Type', 'application/json'), create_authorization_header()])
response_get = client.get(
'service/{}/billing/free-sms-fragment-limit?financial_year_start=2015'.format(sample_service.id),
'service/{}/billing/free-sms-fragment-limit?financial_year_start=2016'.format(sample_service.id),
headers=[('Content-Type', 'application/json'), create_authorization_header()])
json_resp = json.loads(response_get.get_data(as_text=True))
assert response.status_code == 201
assert response_get.status_code == 200
assert json_resp['data']['financial_year_start'] == 2015
assert json_resp['data']['financial_year_start'] == 2016
assert json_resp['data']['free_sms_fragment_limit'] == 9999
def test_get_free_sms_fragment_limit_year_return_correct_data(client, sample_service):
years = [2015, 2016, 2017]
years = [2016, 2017, 2018]
limits = [1000, 2000, 3000]
for i in range(0, len(years)):
@@ -330,7 +330,7 @@ def test_get_free_sms_fragment_limit_year_return_correct_data(client, sample_ser
def test_get_free_sms_fragment_limit_for_all_years(client, sample_service):
years = [2015, 2016, 2017]
years = [2016, 2017, 2018]
limits = [1000, 2000, 3000]
for i in range(0, len(years)):

View File

@@ -3,13 +3,13 @@ from freezegun import freeze_time
# see get_financial_year for conversion of financial years.
@freeze_time("2001-03-31 22:59:59.999999")
@freeze_time("2017-03-31 22:59:59.999999")
def test_get_current_financial_year_start_year_before_march():
current_fy = get_current_financial_year_start_year()
assert current_fy == 2000
assert current_fy == 2016
@freeze_time("2001-03-31 23:00:00.000000")
@freeze_time("2017-03-31 23:00:00.000000")
def test_get_current_financial_year_start_year_after_april():
current_fy = get_current_financial_year_start_year()
assert current_fy == 2001
assert current_fy == 2017