Skip to content

Commit

Permalink
Add a dead simple test for some basic task and resource functionality.
Browse files Browse the repository at this point in the history
Signed-off-by: mulhern <amulhern@redhat.com>
  • Loading branch information
mulkieran committed May 18, 2015
1 parent 4b68b39 commit 2038f95
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
Empty file added tests/tasks_test/__init__.py
Empty file.
42 changes: 42 additions & 0 deletions tests/tasks_test/basic_tests.py
@@ -0,0 +1,42 @@
#!/usr/bin/python
import unittest

import blivet.tasks.task as task
import blivet.tasks.availability as availability

class BasicUnavailableApplication(task.BasicApplication):
ext = availability.unavailable_resource("unavailable")
description = "unavailable application"

def doTask(self):
pass

class BasicAvailableApplication(task.BasicApplication):
ext = availability.available_resource("available")
description = "available application"

def doTask(self):
pass

class ResourceTestCase(unittest.TestCase):

def testAvailabililty(self):
unavailable_resource = availability.unavailable_resource("unavailable")
self.assertNotEqual(unavailable_resource.availabilityErrors, [])
self.assertFalse(unavailable_resource.available)

available_resource = availability.available_resource("available")
self.assertEqual(available_resource.availabilityErrors, [])
self.assertTrue(available_resource.available)

class TasksTestCase(unittest.TestCase):

def testAvailability(self):
unavailable_app = BasicUnavailableApplication()
self.assertFalse(unavailable_app.available)
self.assertNotEqual(unavailable_app.availabilityErrors, [])

available_app = BasicAvailableApplication()
self.assertTrue(available_app.available)
self.assertEqual(available_app.availabilityErrors, [])

0 comments on commit 2038f95

Please sign in to comment.