示例#1
0
 def test_updated_asset(self):
     assert asset.do_differ(
         {
             "name": "asset",
             "builds": [{
                 "url": "http://abc.com",
                 "sha512": "abc",
             }],
             "annotations": {
                 "foo": "bar",
             }
         },
         {
             "name":
             "asset",
             "builds": [{
                 "url": "http://def.com",
                 "sha512": "abc",
             }, {
                 "url": "http://def.com",
                 "sha512": "abc",
                 "filters": ["abc == def"],
             }],
         },
     ) is True
示例#2
0
 def test_different_assets_with_same_builds(self):
     assert asset.do_differ(
         {
             "name": "a",
             "builds": [
                 {
                     "url": "http://abc.com",
                     "sha512": "abc",
                 }
             ],
             "annotations": {
                 "foo": "bar",
             }
         },
         {
             "name": "b",
             "builds": [
                 {
                     "url": "http://abc.com",
                     "sha512": "abc",
                 }
             ],
             "annotations": {
                 "bar": "foo"
             }
         },
     ) is True
示例#3
0
 def test_new_asset(self):
     assert asset.do_differ(
         None,
         {
             "name": "a",
             "builds": [{
                 "url": "http://abc.com",
                 "sha512": "abc",
             }]
         },
     ) is True
示例#4
0
 def test_equal_assets_with_different_build_content(self):
     assert asset.do_differ(
         {
             "name":
             "asset",
             "builds": [
                 {
                     "url": "http://abc.com",
                     "sha512": "abc",
                     "headers": {
                         "foo": "bar",
                         "bar": "foo",
                     }
                 },
                 {
                     "url": "http://def.com",
                     "sha512": "def",
                     "filters": ["d == d", "e == e"],
                 },
             ]
         },
         {
             "name":
             "asset",
             "builds": [
                 {
                     "url": "http://def.com",
                     "sha512": "def",
                     "filters": ["e == e", "d == d"],
                 },
                 {
                     "url": "http://abc.com",
                     "sha512": "abc",
                     "headers": {
                         "bar": "foo",
                         "foo": "bar"
                     }
                 },
             ]
         },
     ) is False
示例#5
0
 def test_equal_assets_with_none_values(self):
     assert asset.do_differ(
         {
             "name": "asset",
             "builds": [
                 {
                     "sha512": "a",
                     "url": "a",
                     "filters": None
                 },
             ],
         },
         {
             "name": "asset",
             "builds": [
                 {
                     "sha512": "a",
                     "url": "a",
                     "headers": None,
                 },
             ],
         },
     ) is False