Exemple #1
0
    def test_patch_many(self, patch_many_dict, bg_patch, bg_patch2, kwargs):
        """Parametrize for the 'many' kwarg because the parser should ignore it"""
        patches = SchemaParser.parse_patch(patch_many_dict, **kwargs)
        sorted_patches = sorted(patches, key=lambda x: x.operation)

        for index, patch in enumerate([bg_patch, bg_patch2]):
            assert_patch_equal(patch, sorted_patches[index])
Exemple #2
0
    def test_patch_model_start(self, bg_patch):
        """Patches are always parsed into a list, so they need a tweak to test"""
        parsed = SchemaParser.parse(
            SchemaParser.serialize(bg_patch, to_string=False),
            brewtils.models.PatchOperation,
            from_string=False,
        )

        assert len(parsed) == 1
        assert_patch_equal(parsed[0], bg_patch)
Exemple #3
0
def test_parse_patch_many(patch_many_dict, bg_patch1, bg_patch2):
    parser = SchemaParser()
    patches = sorted(parser.parse_patch(patch_many_dict, many=True),
                     key=lambda x: x.operation)
    for index, patch in enumerate([bg_patch1, bg_patch2]):
        assert_patch_equal(patch, patches[index])
Exemple #4
0
 def test_patch(self, bg_patch, data, kwargs):
     """Parametrize for the 'many' kwarg because the parser should ignore it"""
     assert_patch_equal(
         SchemaParser.parse_patch(data, **kwargs)[0], bg_patch)
Exemple #5
0
def test_parse_patch(bg_patch1, data, kwargs):
    parser = SchemaParser()
    actual = parser.parse_patch(data, **kwargs)[0]
    assert_patch_equal(actual, bg_patch1)