Exemplo n.º 1
0
 def setUp(self):
     self.TESTCONFPATH = join(get_project_dir(), "test-data", "test.conf")
     self.TEMPCONFPATH = join(get_project_dir(), "test-data",
                              "temp-test.conf")
     self.cp = get_test_confparser()
     self.defaults = dict(self.cp.defaults())
     self.test_class = None
     # copy config file to temp location
     copyfile(self.TESTCONFPATH, self.TEMPCONFPATH)
Exemplo n.º 2
0
    def test_read_data(self):
        """ Test that the right number of rows are read and values. """
        (section_name, num_records, fpath) = (
            "test_jlp_card",
            11,
            "MS_JANE_SMITH_01-12-2019_14-12-2019.csv",
        )

        config = fix_conf_params(self.cp, section_name)
        b = B2YBank(config)
        records = b.read_data(join(get_project_dir(), "test-data", fpath))
        self.assertEqual(len(records), num_records)
        self.assertEqual(records[10][5], "1100.00")
        self.assertEqual(records[4][4], "80.99")
Exemplo n.º 3
0
    def test_get_files(self):
        """Test it's finding the right amount of files"""
        # if you need more tests, add sections to test.conf & specify them here
        for section_name, num_files in [
            ("test_num_files", 2),
            ("test_num_files_noexist", 0),
            ("test_num_files_extension", 0),
            ("test_regex", 1),
            ("test_regex_noexist", 0),
        ]:

            config = fix_conf_params(self.cp, section_name)
            config["path"] = join(get_project_dir(), config["path"])
            b = B2YBank(config)
            files = b.get_files()
            self.assertEqual(len(files), num_files)
            # hack config to make sure we can deal with absolute paths too
            b.config["path"] = abspath(self.test_data)
            files = b.get_files()
            self.assertEqual(len(files), num_files)
Exemplo n.º 4
0
 def setUp(self):
     self.cp = get_test_confparser()
     self.defaults = dict(self.cp.defaults())
     self.b = None
     self.test_data = join(get_project_dir(), "test-data")