Exemplo n.º 1
0
 def test_write_config_new_name(self):
     name = 'filename2'
     path = self.manager.build_file_path(name)
     self.manifest.get_file_name.return_value = None
     autospec_method(self.manager.validate_with_fragment)
     self.manager.write_config(name, self.raw_content)
     assert_equal(manager.read(path), self.content)
     self.manifest.get_file_name.assert_called_with(name)
     self.manifest.add.assert_called_with(name, path)
Exemplo n.º 2
0
 def test_write_config_new_name(self):
     name = 'filename2'
     path = self.manager.build_file_path(name)
     self.manifest.get_file_name.return_value = None
     autospec_method(self.manager.validate_with_fragment)
     self.manager.write_config(name, self.raw_content)
     assert_equal(manager.read(path), self.content)
     self.manifest.get_file_name.assert_called_with(name)
     self.manifest.add.assert_called_with(name, path)
Exemplo n.º 3
0
 def test_delete(self):
     current = {
         'one': 'a.yaml',
         'two': 'b.yaml',
     }
     manager.write(self.manifest.filename, current)
     self.manifest.delete('one')
     expected = {'two': 'b.yaml'}
     assert_equal(manager.read(self.manifest.filename), expected)
Exemplo n.º 4
0
 def test_delete(self):
     current = {
         'one': 'a.yaml',
         'two': 'b.yaml',
     }
     manager.write(self.manifest.filename, current)
     self.manifest.delete('one')
     expected = {'two': 'b.yaml'}
     assert_equal(manager.read(self.manifest.filename), expected)
Exemplo n.º 5
0
 def test_write_config(self):
     name = 'filename'
     path = self.manager.build_file_path(name)
     self.manifest.get_file_name.return_value = path
     autospec_method(self.manager.validate_fragment)
     self.manager.write_config(name, self.raw_content)
     assert_equal(manager.read(path), self.content)
     self.manifest.get_file_name.assert_called_with(name)
     assert not self.manifest.add.call_count
     self.manager.validate_fragment.assert_called_with(name, self.content)
Exemplo n.º 6
0
 def test_write_config(self):
     name = 'filename'
     path = self.manager.build_file_path(name)
     self.manifest.get_file_name.return_value = path
     autospec_method(self.manager.validate_with_fragment)
     self.manager.write_config(name, self.raw_content)
     assert_equal(manager.read(path), self.content)
     self.manifest.get_file_name.assert_called_with(name)
     assert not self.manifest.add.call_count
     self.manager.validate_with_fragment.assert_called_with(
         name,
         self.content,
         should_validate_missing_dependency=False,
     )
Exemplo n.º 7
0
 def test_add(self):
     self.manifest.add('zing', 'zing.yaml')
     expected = {'zing': 'zing.yaml'}
     assert_equal(manager.read(self.manifest.filename), expected)
Exemplo n.º 8
0
 def test_create(self):
     assert_equal(manager.read(self.manifest.filename), {})
Exemplo n.º 9
0
 def test_read_write(self):
     content = {'one': 'stars', 'two': 'beers'}
     manager.write(self.filename, content)
     actual = manager.read(self.filename)
     assert_equal(content, actual)
Exemplo n.º 10
0
 def test_add(self):
     self.manifest.add('zing', 'zing.yaml')
     expected = {'zing': 'zing.yaml'}
     assert_equal(manager.read(self.manifest.filename), expected)
Exemplo n.º 11
0
 def test_create(self):
     assert_equal(manager.read(self.manifest.filename), {})
Exemplo n.º 12
0
 def test_read_write(self):
     content = {'one': 'stars', 'two': 'beers'}
     manager.write(self.filename, content)
     actual = manager.read(self.filename)
     assert_equal(content, actual)
Exemplo n.º 13
0
 def test_read_write(self):
     filename = tempfile.NamedTemporaryFile().name
     content = {'one': 'stars', 'two': 'beers'}
     manager.write(filename, content)
     actual = manager.read(filename)
     assert_equal(content, actual)
Exemplo n.º 14
0
 def test_add(self):
     self.manifest.add("zing", "zing.yaml")
     expected = {"zing": "zing.yaml"}
     assert_equal(manager.read(self.manifest.filename), expected)
Exemplo n.º 15
0
 def test_read_write(self):
     content = {"one": "stars", "two": "beers"}
     manager.write(self.filename, content)
     actual = manager.read(self.filename)
     assert_equal(content, actual)