コード例 #1
0
def test_go(fixtures_dir, input_filename, summary_filename, tmpdir, null_string):
    output_file = summarize.go(fixtures_dir, input_filename, tmpdir.strpath, 'output', null_string)
    actual_summary_data = common.read_json_file(output_file)

    expected_summary_data = common.read_json_file(os.path.join(fixtures_dir, summary_filename))

    # the "file" key is a full path to the summary file and can't be tested across different machines
    expected_keys = expected_summary_data.keys()
    assert actual_summary_data.keys() == expected_keys
    for key in expected_keys:
        if key != 'file':
            assert actual_summary_data[key] == expected_summary_data[key]
コード例 #2
0
def test_go(mock_client, fixtures_dir, input_filename, trellosummary_filename,
            tmpdir):
    mock_client.add_board().url = 'MOCK_BOARD_URL'
    mock_client.add_board().add_list().add_card().url = 'MOCK_CARD_URL'
    output_filename = build_trello.go(fixtures_dir, input_filename,
                                      tmpdir.strpath, '')
    actual_summary_data = common.read_json_file(output_filename)
    # TODO: add asserts on mock calls

    expected_summary_data = common.read_json_file(
        os.path.join(fixtures_dir, trellosummary_filename))
    assert actual_summary_data == expected_summary_data
コード例 #3
0
def test_write_summary(tmpdir):
    summary_data = {'a': 1, 'b': {'c': 2, 'd': 3}, 'e': [1, 2, 3]}
    filename = common.write_summary(summary_data, tmpdir.strpath, 'foo', 'bar')
    assert os.path.basename(filename) == 'foo_barsummary.json'

    summary_data_from_file = common.read_json_file(filename)
    assert summary_data_from_file == summary_data
コード例 #4
0
 def set_trello_summary_data(self):
     trello_summary_file = common.get_summary_filename(self.summary_dir, self.base_name, 'trello')
     common.file_exists_or_exit(
         trello_summary_file, 'Please create the Trello summary file with '
                              '"tddc build_trello <input_file> [--output=<dir>]'
     )
     self._trello_summary = common.read_json_file(trello_summary_file)
     print('Retrieved Trello summary data.')
コード例 #5
0
 def set_summary_data(self):
     summary_file = common.get_summary_filename(self.summary_dir, self.base_name)
     common.file_exists_or_exit(
         summary_file, 'Please create the summary file with '
                       '"tddc summarize <input_file> [--output=<dir>] [--null=<NA>]".'
     )
     self._summary = common.read_json_file(summary_file)
     print('Retrieved summary data.')
コード例 #6
0
 def set_trello_summary_data(self):
     trello_summary_file = common.get_summary_filename(
         self.summary_dir, self.base_name, 'trello')
     common.file_exists_or_exit(
         trello_summary_file, 'Please create the Trello summary file with '
         '"tddc build_trello <input_file> [--output=<dir>]')
     self._trello_summary = common.read_json_file(trello_summary_file)
     print('Retrieved Trello summary data.')
コード例 #7
0
 def set_summary_data(self):
     summary_file = common.get_summary_filename(self.summary_dir,
                                                self.base_name)
     common.file_exists_or_exit(
         summary_file, 'Please create the summary file with '
         '"tddc summarize <input_file> [--output=<dir>] [--null=<NA>]".')
     self._summary = common.read_json_file(summary_file)
     print('Retrieved summary data.')