예제 #1
0
 def test_fieldnames_missing_id(self):
     csv_content = str("Title,Test Case I D,Caseimportance,,,")
     input_file = StringIO(csv_content)
     reader = csvtools._get_csv_reader(input_file)
     fieldnames = csvtools._get_csv_fieldnames(reader)
     input_file.close()
     assert fieldnames is None
예제 #2
0
 def test_fieldnames_trailing(self):
     csv_content = str("ID,Title,Test Case I D,Caseimportance,,,")
     input_file = StringIO(csv_content)
     reader = csvtools._get_csv_reader(input_file)
     fieldnames = csvtools._get_csv_fieldnames(reader)
     input_file.close()
     assert fieldnames == ["id", "title", "testcaseid", "caseimportance"]
예제 #3
0
 def test_fieldnames_exported(self):
     csv_file = os.path.join(conf.DATA_PATH, "workitems_ids.csv")
     open_args = []
     open_kwargs = {}
     try:
         # pylint: disable=pointless-statement
         unicode
         open_args.append("rb")
     except NameError:
         open_kwargs["encoding"] = "utf-8"
     with open(csv_file, *open_args, **open_kwargs) as input_file:
         reader = csvtools._get_csv_reader(input_file)
         fieldnames = csvtools._get_csv_fieldnames(reader)
     assert fieldnames == [
         "id",
         "title",
         "testcaseid",
         "caseimportance",
         "verdict",
         "comment",
         "stdout",
         "stderr",
         "exported",
         "time",
     ]
예제 #4
0
 def test_fieldnames_unanotated(self):
     csv_content = str(",,ID,Title,Test Case I D,Caseimportance")
     input_file = StringIO(csv_content)
     reader = csvtools._get_csv_reader(input_file)
     fieldnames = csvtools._get_csv_fieldnames(reader)
     input_file.close()
     assert fieldnames == [
         "field1", "field2", "id", "title", "testcaseid", "caseimportance"
     ]
예제 #5
0
 def test_fieldnames_exported(self):
     csv_file = os.path.join(conf.DATA_PATH, "workitems_ids.csv")
     with open(csv_file, encoding="utf-8") as input_file:
         reader = csvtools._get_csv_reader(input_file)
         fieldnames = csvtools._get_csv_fieldnames(reader)
     assert fieldnames == [
         "id",
         "title",
         "testcaseid",
         "caseimportance",
         "verdict",
         "comment",
         "stdout",
         "stderr",
         "exported",
         "time",
     ]