Skip to content

Commit

Permalink
Update kdump_test.py
Browse files Browse the repository at this point in the history
  • Loading branch information
muhammadalihussnain authored Oct 1, 2024
1 parent 33dc3f8 commit d644841
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions tests/kdump_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@


class TestKdump:

@classmethod
def setup_class(cls):
print("SETUP")
Expand All @@ -12,21 +11,20 @@ def test_config_kdump_disable(self, get_cmd_module):
(config, show) = get_cmd_module
db = Db()
runner = CliRunner()

# Simulate command execution for 'disable'
result = runner.invoke(config.config.commands["kdump"].commands["disable"], obj=db)
assert result.exit_code == 0

# Delete the 'KDUMP' table to test error case
db.cfgdb.delete_table("KDUMP")

result = runner.invoke(config.config.commands["kdump"].commands["disable"], obj=db)
assert result.exit_code == 1

def test_config_kdump_enable(self, get_cmd_module):
(config, show) = get_cmd_module
db = Db()
runner = CliRunner()

# Simulate command execution for 'enable'
result = runner.invoke(config.config.commands["kdump"].commands["enable"], obj=db)
assert result.exit_code == 0
Expand All @@ -40,7 +38,6 @@ def test_config_kdump_memory(self, get_cmd_module):
(config, show) = get_cmd_module
db = Db()
runner = CliRunner()

# Simulate command execution for 'memory'
result = runner.invoke(config.config.commands["kdump"].commands["memory"], ["256MB"], obj=db)
assert result.exit_code == 0
Expand All @@ -54,7 +51,6 @@ def test_config_kdump_num_dumps(self, get_cmd_module):
(config, show) = get_cmd_module
db = Db()
runner = CliRunner()

# Simulate command execution for 'num_dumps'
result = runner.invoke(config.config.commands["kdump"].commands["num_dumps"], ["10"], obj=db)
assert result.exit_code == 0
Expand All @@ -68,7 +64,6 @@ def test_config_kdump_remote_enable(self, get_cmd_module):
(config, show) = get_cmd_module
db = Db()
runner = CliRunner()

# Initialize KDUMP table
db.cfgdb.mod_entry("KDUMP", "config", {"remote": "false"})

Expand All @@ -86,7 +81,6 @@ def test_config_kdump_remote_disable(self, get_cmd_module):
(config, show) = get_cmd_module
db = Db()
runner = CliRunner()

# Initialize KDUMP table
db.cfgdb.mod_entry("KDUMP", "config", {"remote": "true"})

Expand All @@ -104,7 +98,6 @@ def test_config_kdump_add_ssh_string(self, get_cmd_module):
(config, show) = get_cmd_module
db = Db()
runner = CliRunner()

# Test case where KDUMP table does not exist
ssh_string = "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEArV1..."
db.cfgdb.delete_table("KDUMP")
Expand Down Expand Up @@ -151,7 +144,6 @@ def test_config_kdump_add_ssh_path(self, get_cmd_module):
(config, show) = get_cmd_module
db = Db()
runner = CliRunner()

# Test case where KDUMP table does not exist
ssh_path = "/root/.ssh/id_rsa"
db.cfgdb.delete_table("KDUMP")
Expand Down Expand Up @@ -198,7 +190,6 @@ def test_config_kdump_remove_ssh_string(self, get_cmd_module):
(config, show) = get_cmd_module
db = Db()
runner = CliRunner()

# Add an SSH string for testing removal
db.cfgdb.mod_entry("KDUMP", "config", {"ssh_string": "test_ssh_string"})

Expand All @@ -216,7 +207,6 @@ def test_config_kdump_remove_ssh_path(self, get_cmd_module):
(config, show) = get_cmd_module
db = Db()
runner = CliRunner()

# Add an SSH string for testing removal
db.cfgdb.mod_entry("KDUMP", "config", {"ssh_path": "test_ssh_path"})

Expand Down

0 comments on commit d644841

Please sign in to comment.