~free.ekanayaka/landscape-client/karmic-updates-1.4.4-0ubuntu0.9.10

« back to all changes in this revision

Viewing changes to landscape/tests/test_diff.py

  • Committer: Bazaar Package Importer
  • Author(s): Rick Clark
  • Date: 2008-09-08 16:35:57 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080908163557-l3ixzj5dxz37wnw2
Tags: 1.0.18-0ubuntu1
New upstream release 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from landscape.diff import diff
 
2
from landscape.tests.helpers import LandscapeTest
 
3
 
 
4
 
 
5
class DiffTest(LandscapeTest):
 
6
 
 
7
    def test_empty(self):
 
8
        self.assertEquals(diff({}, {}), ({}, {}, {}))
 
9
 
 
10
    def test_identical(self):
 
11
        data = {"str": "wubble", "strlist": ["foo", "bar"]}
 
12
        self.assertEquals(diff(data, data), ({}, {}, {}))
 
13
 
 
14
    def test_create(self):
 
15
        old = {}
 
16
        new = {"str": "wubble"}
 
17
        self.assertEquals(diff(old, new), ({"str": "wubble"}, {}, {}))
 
18
 
 
19
    def test_update(self):
 
20
        old = {"str": "wubble"}
 
21
        new = {"str": "ooga"}
 
22
        self.assertEquals(diff(old, new), ({}, {"str": "ooga"}, {}))
 
23
 
 
24
    def test_delete(self):
 
25
        old = {"str": "wubble"}
 
26
        new = {}
 
27
        self.assertEquals(diff(old, new), ({}, {}, {"str": "wubble"}))
 
28
 
 
29
    def test_complex(self):
 
30
        old = {"str": "wubble", "int": 10}
 
31
        new = {"strlist": ["foo", "bar"], "int": 25}
 
32
        self.assertEquals(diff(old, new), ({"strlist": ["foo", "bar"]},
 
33
                                           {"int": 25},
 
34
                                           {"str": "wubble"}))