"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "cloudkitty/tests/api/v2/task/test_reprocess.py" between
cloudkitty-16.0.0.tar.gz and cloudkitty-17.0.0.tar.gz

About: OpenStack CloudKitty provides Rating-as-a-Service for OpenStack.
The "Zed" series (latest release).

test_reprocess.py  (cloudkitty-16.0.0):test_reprocess.py  (cloudkitty-17.0.0)
skipping to change at line 50 skipping to change at line 50
self.scope_ids.append('ALL') self.scope_ids.append('ALL')
expected_message = \ expected_message = \
"400 Bad Request: Cannot use 'ALL' with scope ID [['some-other-" \ "400 Bad Request: Cannot use 'ALL' with scope ID [['some-other-" \
"scope-id', '5e56cb64-4980-4466-9fce-d0133c0c221e', 'ALL']]. " \ "scope-id', '5e56cb64-4980-4466-9fce-d0133c0c221e', 'ALL']]. " \
"Either schedule a reprocessing for all active scopes using " \ "Either schedule a reprocessing for all active scopes using " \
"'ALL' option, or inform only the scopes you desire to schedule " \ "'ALL' option, or inform only the scopes you desire to schedule " \
"a reprocessing." "a reprocessing."
expected_message = re.escape(expected_message) expected_message = re.escape(expected_message)
self.assertRaisesRegexp(http_exceptions.BadRequest, expected_message, self.assertRaisesRegex(http_exceptions.BadRequest, expected_message,
self.endpoint.validate_scope_ids, self.endpoint.validate_scope_ids,
self.scope_ids) self.scope_ids)
self.scope_ids.remove('ALL') self.scope_ids.remove('ALL')
self.endpoint.validate_scope_ids(self.scope_ids) self.endpoint.validate_scope_ids(self.scope_ids)
def test_validate_inputs_blank_reason(self): def test_validate_inputs_blank_reason(self):
expected_message = \ expected_message = \
"400 Bad Request: Empty or blank reason text is not allowed. " \ "400 Bad Request: Empty or blank reason text is not allowed. " \
"Please, do inform/register the reason for the reprocessing of " \ "Please, do inform/register the reason for the reprocessing of " \
"a previously processed timestamp." "a previously processed timestamp."
expected_message = re.escape(expected_message) expected_message = re.escape(expected_message)
self.assertRaisesRegexp(http_exceptions.BadRequest, expected_message, self.assertRaisesRegex(http_exceptions.BadRequest, expected_message,
self.endpoint.validate_inputs, self.endpoint.validate_inputs,
self.end_reprocess_time, "", self.scope_ids, self.end_reprocess_time, "", self.scope_ids,
self.start_reprocess_time) self.start_reprocess_time)
self.assertRaisesRegexp( self.assertRaisesRegex(
http_exceptions.BadRequest, expected_message, http_exceptions.BadRequest, expected_message,
self.endpoint.validate_inputs, self.end_reprocess_time, self.endpoint.validate_inputs, self.end_reprocess_time,
" ", self.scope_ids, self.start_reprocess_time) " ", self.scope_ids, self.start_reprocess_time)
self.endpoint.validate_inputs( self.endpoint.validate_inputs(
self.end_reprocess_time, self.reason, self.scope_ids, self.end_reprocess_time, self.reason, self.scope_ids,
self.start_reprocess_time) self.start_reprocess_time)
def test_validate_inputs_end_date_less_than_start_date(self): def test_validate_inputs_end_date_less_than_start_date(self):
original_end_reprocess_time = self.end_reprocess_time original_end_reprocess_time = self.end_reprocess_time
skipping to change at line 92 skipping to change at line 92
self.end_reprocess_time =\ self.end_reprocess_time =\
self.start_reprocess_time - datetime.timedelta(hours=1) self.start_reprocess_time - datetime.timedelta(hours=1)
expected_message = \ expected_message = \
"400 Bad Request: End reprocessing timestamp [%s] cannot be " \ "400 Bad Request: End reprocessing timestamp [%s] cannot be " \
"less than start reprocessing timestamp [%s]." % ( "less than start reprocessing timestamp [%s]." % (
self.start_reprocess_time, self.end_reprocess_time) self.start_reprocess_time, self.end_reprocess_time)
expected_message = re.escape(expected_message) expected_message = re.escape(expected_message)
self.assertRaisesRegexp(http_exceptions.BadRequest, expected_message, self.assertRaisesRegex(http_exceptions.BadRequest, expected_message,
self.endpoint.validate_inputs, self.endpoint.validate_inputs,
self.end_reprocess_time, self.reason, self.end_reprocess_time, self.reason,
self.scope_ids, self.start_reprocess_time) self.scope_ids, self.start_reprocess_time)
self.end_reprocess_time = original_end_reprocess_time self.end_reprocess_time = original_end_reprocess_time
self.endpoint.validate_inputs( self.endpoint.validate_inputs(
self.end_reprocess_time, self.reason, self.scope_ids, self.end_reprocess_time, self.reason, self.scope_ids,
self.start_reprocess_time) self.start_reprocess_time)
def test_check_if_there_are_invalid_scopes(self): def test_check_if_there_are_invalid_scopes(self):
all_scopes = self.generate_all_scopes_object() all_scopes = self.generate_all_scopes_object()
element_removed = all_scopes.pop(0) element_removed = all_scopes.pop(0)
expected_message = \ expected_message = \
"400 Bad Request: Scopes [\'%s\'] scheduled to reprocess "\ "400 Bad Request: Scopes [\'%s\'] scheduled to reprocess "\
"[start=%s, end=%s] do not exist."\ "[start=%s, end=%s] do not exist."\
% (element_removed.identifier, self.start_reprocess_time, % (element_removed.identifier, self.start_reprocess_time,
self.end_reprocess_time) self.end_reprocess_time)
expected_message = re.escape(expected_message) expected_message = re.escape(expected_message)
self.assertRaisesRegexp( self.assertRaisesRegex(
http_exceptions.BadRequest, expected_message, http_exceptions.BadRequest, expected_message,
self.endpoint.check_if_there_are_invalid_scopes, all_scopes, self.endpoint.check_if_there_are_invalid_scopes, all_scopes,
self.end_reprocess_time, self.scope_ids, self.start_reprocess_time) self.end_reprocess_time, self.scope_ids, self.start_reprocess_time)
all_scopes.append(element_removed) all_scopes.append(element_removed)
self.endpoint.check_if_there_are_invalid_scopes( self.endpoint.check_if_there_are_invalid_scopes(
all_scopes, self.end_reprocess_time, self.scope_ids, all_scopes, self.end_reprocess_time, self.scope_ids,
self.start_reprocess_time) self.start_reprocess_time)
def generate_all_scopes_object(self, last_processed_time=None): def generate_all_scopes_object(self, last_processed_time=None):
skipping to change at line 208 skipping to change at line 208
tzutils.local_to_utc(start_reprocess_time), tzutils.local_to_utc(start_reprocess_time),
tzutils.local_to_utc(end_reprocess_time)) tzutils.local_to_utc(end_reprocess_time))
expected_message = \ expected_message = \
"400 Bad Request: Cannot schedule a reprocessing for scope " \ "400 Bad Request: Cannot schedule a reprocessing for scope " \
"[toStringMock] for reprocessing time [%s], because it already " \ "[toStringMock] for reprocessing time [%s], because it already " \
"has a schedule for a similar time range [%s]." \ "has a schedule for a similar time range [%s]." \
% (scheduling_range, scheduled_range) % (scheduling_range, scheduled_range)
expected_message = re.escape(expected_message) expected_message = re.escape(expected_message)
self.assertRaisesRegexp( self.assertRaisesRegex(
http_exceptions.BadRequest, expected_message, http_exceptions.BadRequest, expected_message,
self.endpoint.validate_reprocessing_schedules_overlaps, self.endpoint.validate_reprocessing_schedules_overlaps,
self.generate_all_scopes_object(), self.generate_all_scopes_object(),
self.end_reprocess_time, self.start_reprocess_time) self.end_reprocess_time, self.start_reprocess_time)
schedule_get_all_mock.assert_called_with( schedule_get_all_mock.assert_called_with(
identifier=[self.scope_ids[0]]) identifier=[self.scope_ids[0]])
def configure_schedules_mock(self, schedule_get_all_mock, def configure_schedules_mock(self, schedule_get_all_mock,
start_reprocess_time, end_reprocess_time): start_reprocess_time, end_reprocess_time):
skipping to change at line 246 skipping to change at line 246
start_reprocess_time =\ start_reprocess_time =\
self.start_reprocess_time + datetime.timedelta(hours=1) self.start_reprocess_time + datetime.timedelta(hours=1)
expected_message = base_error_message % ("start", expected_message = base_error_message % ("start",
start_reprocess_time, start_reprocess_time,
"starting", "starting",
self.start_reprocess_time) self.start_reprocess_time)
expected_message = re.escape(expected_message) expected_message = re.escape(expected_message)
self.assertRaisesRegexp( self.assertRaisesRegex(
http_exceptions.BadRequest, expected_message, http_exceptions.BadRequest, expected_message,
self.endpoint.validate_start_end_for_reprocessing, all_scopes, self.endpoint.validate_start_end_for_reprocessing, all_scopes,
self.end_reprocess_time, start_reprocess_time) self.end_reprocess_time, start_reprocess_time)
all_scopes = self.generate_all_scopes_object( all_scopes = self.generate_all_scopes_object(
last_processed_time=self.end_reprocess_time) last_processed_time=self.end_reprocess_time)
end_processing_time =\ end_processing_time =\
self.end_reprocess_time + datetime.timedelta(hours=1) self.end_reprocess_time + datetime.timedelta(hours=1)
expected_message = base_error_message % ("end", expected_message = base_error_message % ("end",
end_processing_time, end_processing_time,
"ending", "ending",
self.end_reprocess_time) self.end_reprocess_time)
expected_message = re.escape(expected_message) expected_message = re.escape(expected_message)
self.assertRaisesRegexp( self.assertRaisesRegex(
http_exceptions.BadRequest, expected_message, http_exceptions.BadRequest, expected_message,
self.endpoint.validate_start_end_for_reprocessing, all_scopes, self.endpoint.validate_start_end_for_reprocessing, all_scopes,
end_processing_time, self.start_reprocess_time) end_processing_time, self.start_reprocess_time)
self.endpoint.validate_start_end_for_reprocessing( self.endpoint.validate_start_end_for_reprocessing(
all_scopes, self.end_reprocess_time, all_scopes, self.end_reprocess_time,
self.start_reprocess_time) self.start_reprocess_time)
all_scopes = self.generate_all_scopes_object( all_scopes = self.generate_all_scopes_object(
last_processed_time=self.start_reprocess_time) last_processed_time=self.start_reprocess_time)
 End of changes. 8 change blocks. 
16 lines changed or deleted 16 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)