def test_write(self):
     document = {'Disco': {1: 'Beatdown', 2: 'Elysium'}}
     yaml_file_interface.write('./tmp/test_write.yaml', document)
     self.assertTrue(
         filecmp.cmp('./tmp/test_write.yaml',
                     self.get_static_file('test_write.yaml')),
         'Files do not match')
 def test_write_empty_file(self):
     document = {}
     yaml_path = './tmp/test_write_empty_file.yaml'
     yaml_file_interface.write(yaml_path, document)
     self.assertTrue(
         filecmp.cmp(yaml_path,
                     self.get_static_file('test_write_empty_file.yaml')),
         'Files do not match')
 def test_write_list_contents(self):
     document = ['Disco', 'Fever']
     yaml_path = './tmp/test_write_list_contents.yaml'
     yaml_file_interface.write(yaml_path, document)
     # A list should just translate to a linear series of YAML keys
     self.assertTrue(
         filecmp.cmp(yaml_path,
                     self.get_static_file('test_write_list_contents.yaml')),
         'Files do not match')
 def test_write_overwrite(self):
     document = {'Disco': {1: 'Beatdown', 2: 'Elysium'}}
     yaml_file_interface.write('./tmp/test_write_overwrite.yaml', document)
     self.assertEqual(len(document['Disco']), 2,
                      'Number of entries is incorrect')
     document['Disco'][3] = 'Fever'
     yaml_file_interface.write('./tmp/test_write_overwrite.yaml', document)
     self.assertEqual(document['Disco'][3], 'Fever',
                      'Third entry is incorrect')
 def test_write_string_contents(self):
     document = 'Ugh'
     yaml_path = './tmp/test_write_string_contents.yaml'
     yaml_file_interface.write(yaml_path, document)
     # Despite not being a dictionary, this writes valid YAML to the file - the result being a single YAML key
     self.assertTrue(
         filecmp.cmp(
             yaml_path,
             self.get_static_file('test_write_string_contents.yaml')),
         'Files do not match')