Example #1
0
 def test_empty_userdata(self):
     """
     Empty option adds nothing to result.
     """
     options = BenchmarkOptions()
     options.parseOptions(['--userdata', ''])
     self.assertIs(parse_userdata(options), None)
Example #2
0
 def test_json_userdata(self):
     """
     JSON string adds to result.
     """
     options = BenchmarkOptions()
     options.parseOptions(['--userdata', '{"branch": "master"}'])
     self.assertEqual(parse_userdata(options), {"branch": "master"})
Example #3
0
 def test_no_userdata(self):
     """
     Missing option adds nothing to result.
     """
     options = BenchmarkOptions()
     options.parseOptions([])
     self.assertIs(parse_userdata(options), None)
Example #4
0
 def test_json_userdata(self):
     """
     JSON string adds to result.
     """
     options = BenchmarkOptions()
     options.parseOptions(['--userdata', '{"branch": "master"}'])
     self.assertEqual(parse_userdata(options), {"branch": "master"})
Example #5
0
 def test_empty_userdata(self):
     """
     Empty option adds nothing to result.
     """
     options = BenchmarkOptions()
     options.parseOptions(['--userdata', ''])
     self.assertIs(parse_userdata(options), None)
Example #6
0
 def test_no_userdata(self):
     """
     Missing option adds nothing to result.
     """
     options = BenchmarkOptions()
     options.parseOptions([])
     self.assertIs(parse_userdata(options), None)
Example #7
0
 def test_json_file_userdata(self):
     """
     JSON file adds to result.
     """
     json_file = FilePath(self.mktemp())
     with json_file.open('w') as f:
         f.write('{"branch": "master"}\n')
     options = BenchmarkOptions()
     options.parseOptions(['--userdata', '@{}'.format(json_file.path)])
     self.assertEqual(parse_userdata(options), {"branch": "master"})
Example #8
0
 def test_json_file_userdata(self):
     """
     JSON file adds to result.
     """
     json_file = FilePath(self.mktemp())
     with json_file.open('w') as f:
         f.write('{"branch": "master"}\n')
     options = BenchmarkOptions()
     options.parseOptions(['--userdata', '@{}'.format(json_file.path)])
     self.assertEqual(parse_userdata(options), {"branch": "master"})