MCPcopy Create free account
hub / github.com/saltstack/salt / test_status

Method test_status

tests/integration/modules/test_git.py:822–855  ·  view source on GitHub ↗

Test git.status

(self)

Source from the content-addressed store, hash-verified

820
821 @pytest.mark.slow_test
822 def test_status(self):
823 """
824 Test git.status
825 """
826 changes = {
827 "modified": ["foo"],
828 "new": ["thisisdefinitelyanewfile"],
829 "deleted": ["bar"],
830 "untracked": ["thisisalsoanewfile"],
831 }
832 for filename in changes["modified"]:
833 with salt.utils.files.fopen(os.path.join(self.repo, filename), "a") as fp_:
834 fp_.write("Added a line\n")
835 for filename in changes["new"]:
836 with salt.utils.files.fopen(os.path.join(self.repo, filename), "w") as fp_:
837 fp_.write(
838 salt.utils.stringutils.to_str(
839 f"This is a new file named {filename}."
840 )
841 )
842 # Stage the new file so it shows up as a 'new' file
843 self.assertTrue(
844 "ERROR" not in self.run_function("git.add", [self.repo, filename])
845 )
846 for filename in changes["deleted"]:
847 self.run_function("git.rm", [self.repo, filename])
848 for filename in changes["untracked"]:
849 with salt.utils.files.fopen(os.path.join(self.repo, filename), "w") as fp_:
850 fp_.write(
851 salt.utils.stringutils.to_str(
852 f"This is a new file named {filename}."
853 )
854 )
855 self.assertEqual(self.run_function("git.status", [self.repo]), changes)
856
857 # TODO: Add git.submodule test
858

Callers

nothing calls this directly

Calls 2

run_functionMethod · 0.95
writeMethod · 0.45

Tested by

no test coverage detected