Exemple #1
0
    def test_get_build_steps(self, mocked_url, mocked_time):
        """Test for get_build_steps."""
        del mocked_url, mocked_time
        datetime.datetime = SpoofedDatetime
        project_yaml_contents = 'language: c++\nsanitizers:\n  - address\narchitectures:\n  - x86_64\n'
        image_project = 'oss-fuzz'
        base_images_project = 'oss-fuzz-base'
        testcase_path = os.path.join(os.path.dirname(__file__),
                                     'expected_build_steps.json')
        with open(testcase_path) as testcase_file:
            expected_build_steps = json.load(testcase_file)

        with ndb.Client().context():
            Project(name='test-project',
                    project_yaml_contents=project_yaml_contents,
                    dockerfile_contents='test line').put()

        build_steps = get_build_steps('test-project', image_project,
                                      base_images_project)
        self.assertEqual(build_steps, expected_build_steps)
Exemple #2
0
  def test_get_build_steps(self, mock_url, mock_time):
    """Test for get_build_steps."""
    del mock_url, mock_time
    datetime.datetime = test_utils.SpoofedDatetime
    project_yaml_contents = ('language: c++\n'
                             'sanitizers:\n'
                             '  - address\n'
                             'architectures:\n'
                             '  - x86_64\n')
    image_project = 'oss-fuzz'
    base_images_project = 'oss-fuzz-base'
    expected_build_steps_file_path = test_utils.get_test_data_file_path(
        'expected_build_steps.json')

    with open(expected_build_steps_file_path) as expected_build_steps_file:
      expected_build_steps = json.load(expected_build_steps_file)

    with ndb.Client().context():
      Project(name='test-project',
              project_yaml_contents=project_yaml_contents,
              dockerfile_contents='test line').put()
      build_steps = get_build_steps('test-project', image_project,
                                    base_images_project)
    self.assertEqual(build_steps, expected_build_steps)