Ejemplo n.º 1
0
    def test_import_and_save_boot(self, mock_db):
        mock_db = self.db

        bimport.import_and_save_boot(self.boot_report, {},
                                     base_path=self.base_path)
        lab_dir = os.path.join(self.base_path, "job", "branch", "kernel",
                               "arm", "defconfig", "lab_name")
        boot_file = os.path.join(lab_dir, "boot-board.json")

        self.assertTrue(os.path.isdir(lab_dir))
        self.assertTrue(os.path.isfile(boot_file))

        try:
            os.remove(boot_file)
            os.rmdir(lab_dir)
        except OSError:
            pass
Ejemplo n.º 2
0
    def test_import_and_save_no_doc(self, mock_parse, mock_db):
        mock_parse.return_value = None
        mock_db = self.db

        code, doc_id, errors = bimport.import_and_save_boot({}, {})
        self.assertIsNone(code)
        self.assertIsNone(doc_id)
        self.assertDictEqual({}, errors)
Ejemplo n.º 3
0
    def test_import_and_save_db_error(self, mock_conn):
        mock_conn.side_effect = pymongo.errors.ConnectionFailure("ConnErr")

        ret_code, doc_id, errors = bimport.import_and_save_boot(
            self.boot_report, {})

        self.assertIsNone(doc_id)
        self.assertIsNotNone(errors)
        self.assertListEqual([500], errors.keys())
Ejemplo n.º 4
0
    def test_import_and_save_boot(self, mock_db):
        mock_db = self.db

        bimport.import_and_save_boot(
            self.boot_report, {}, base_path=self.base_path)
        lab_dir = os.path.join(
            self.base_path,
            "job", "branch", "kernel", "arm", "defconfig",
            "build_environment", "lab_name")
        boot_file = os.path.join(lab_dir, "boot-board.json")

        self.assertTrue(os.path.isdir(lab_dir))
        self.assertTrue(os.path.isfile(boot_file))

        try:
            os.remove(boot_file)
            os.rmdir(lab_dir)
        except OSError:
            pass
    def test_import_and_save_no_doc(self, mock_parse, mock_db):
        mock_parse.return_value = None
        mock_db = self.db

        doc_id = bimport.import_and_save_boot({}, {})
        self.assertIsNone(doc_id)
Ejemplo n.º 6
0
    def test_import_and_save_no_doc(self, mock_parse, mock_db):
        mock_parse.return_value = None
        mock_db = self.db

        doc_id = bimport.import_and_save_boot({}, {})
        self.assertIsNone(doc_id)