示例#1
0
 def compare_string_keys(self, key):
     lst_status = []
     if AssertCompare.is_string_equal(str(self.verify_dct[key]),
                                      str(self.snap_shot_dct[key])):
         self.remarks += '%s assertion passed\n' % key
         lst_status.append(True)
     else:
         self.remarks += '%s assertion failed Expected: %s Actual: %s\n' % (
             key, self.snap_shot_dct[key], self.verify_dct[key])
         lst_status.append(False)
     return all(lst_status)
示例#2
0
 def compare_date_keys(self, key):
     actual_date = TestCaseHelper.string_to_date(self.verify_dct[key])
     expected_date = TestCaseHelper.string_to_date(self.snap_shot_dct[key])
     lst_status = []
     if AssertCompare.is_date_compare_pp(actual_date, expected_date):
         self.remarks += '%s assertion passed\n' % key
         lst_status.append(True)
     else:
         lst_status.append(False)
         self.remarks += '%s assertion failed Expected: %s Actual: %s\n' % (
             key, self.snap_shot_dct[key], self.verify_dct[key])
     return all(lst_status)
示例#3
0
    def verify_delete(self, encoding='utf-8'):
        status = False
        try:
            if self.verify_deleted_key:
                delete_response = self.read(self.verify_deleted_key, encoding)
                error_msg = self.parse_wrapper.get_values(
                    delete_response.text, node='b:ErrorMessage')[0]
                expected_msg = 'Unable to find task:'

                if AssertCompare.is_substring_present(expected_msg, error_msg):
                    status = True
                    self.remarks += '%s task deleted successfully\n' % self.verify_deleted_key
                else:
                    self.remarks += '%s task not deleted successfully\n' % self.verify_deleted_key
        except:
            logger.logs(
                'Execution failed in Class: Task inside Method: verify_delete()',
                'error')
            self.remarks += 'Task not deleted due to exception in Class: Task inside Method: verify_delete() \n'
            status = False
        finally:
            return status, self.remarks
示例#4
0
    def verify_create(self, encoding='utf-8'):
        status = True
        self.remarks = 'Verification:\n'
        try:
            if self.verify_created_key:
                resp = self.read(self.verify_created_key, encoding)
                description = self.parse_wrapper.get_values(
                    resp.text, node='d:Description')[0]
                father_key = self.parse_wrapper.get_values(
                    resp.text, node='d:FatherKey')[0]
                verify_dct = {
                    'verify_description': description,
                    'verify_father_key': father_key
                }
                snap_shot_dct = self.__dict__

                for key in verify_dct:
                    if type(snap_shot_dct[key]) is int:
                        snap_shot_dct[key] = (str(snap_shot_dct[key])).replace(
                            " ", "")

                    if AssertCompare.is_string_equal(verify_dct[key],
                                                     snap_shot_dct[key]):
                        self.remarks += '%s assertion passed\n' % key
                    else:
                        self.remarks += '%s assertion failed Expected: %s Actual: %s\n' % (
                            key, snap_shot_dct[key], verify_dct[key])
                        status = False

        except:
            logger.logs(
                'Execution failed in Class: Task inside Method: verify_create()',
                'error')
            self.remarks += 'Task not created due to exception in Class: Task inside Method: verify_create() \n'
            status = False
        finally:
            return status, self.remarks