summaryrefslogtreecommitdiff
path: root/morphlib/artifact_tests.py
diff options
context:
space:
mode:
authorJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2012-04-16 17:03:53 +0100
committerJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2012-04-16 17:04:20 +0100
commit9a0976b32c8362de0ad70283f5d4ab3675706564 (patch)
treeb42e2d1a9a928ed47518135cd17e87fd26d446be /morphlib/artifact_tests.py
parent31b887e4fa73920ea2c0c95160eabdc758f4fde0 (diff)
downloadmorph-9a0976b32c8362de0ad70283f5d4ab3675706564.tar.gz
Merge DependencyResolver into ArtifactResolver.
Diffstat (limited to 'morphlib/artifact_tests.py')
-rw-r--r--morphlib/artifact_tests.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/morphlib/artifact_tests.py b/morphlib/artifact_tests.py
index 49f8e17f..faeef879 100644
--- a/morphlib/artifact_tests.py
+++ b/morphlib/artifact_tests.py
@@ -46,6 +46,8 @@ class ArtifactTests(unittest.TestCase):
self.artifact_name = 'chunk-runtime'
self.artifact = morphlib.artifact.Artifact(
self.source, self.artifact_name, self.cache_key)
+ self.other = morphlib.artifact.Artifact(
+ self.source, self.artifact_name, self.cache_key)
def test_constructor_sets_source(self):
self.assertEqual(self.artifact.source, self.source)
@@ -55,3 +57,26 @@ class ArtifactTests(unittest.TestCase):
def test_constructor_sets_cache_key(self):
self.assertEqual(self.artifact.cache_key, self.cache_key)
+
+ def test_sets_dependencies_to_empty(self):
+ self.assertEqual(self.artifact.dependencies, [])
+
+ def test_sets_dependents_to_empty(self):
+ self.assertEqual(self.artifact.dependents, [])
+
+ def test_does_not_depend_on_other_initially(self):
+ self.assertFalse(self.artifact.depends_on(self.other))
+
+ def test_adds_dependency(self):
+ self.artifact.add_dependency(self.other)
+ self.assertEqual(self.artifact.dependencies, [self.other])
+ self.assertEqual(self.other.dependents, [self.artifact])
+ self.assertTrue(self.artifact.depends_on(self.other))
+
+ def test_does_not_add_dependency_twice(self):
+ self.artifact.add_dependency(self.other)
+ self.artifact.add_dependency(self.other)
+ self.assertEqual(self.artifact.dependencies, [self.other])
+ self.assertEqual(self.other.dependents, [self.artifact])
+ self.assertTrue(self.artifact.depends_on(self.other))
+