Skip to content

Commit

Permalink
#174 fixed failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
patrykorwat committed Jan 3, 2021
1 parent f09310f commit c675f41
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions cloudiscovery/tests/shared/test_shared_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

from assertpy import assert_that

from shared.common import parse_filters, ResourceTag, ResourceType
from shared.common import parse_filters, Filterable


class TestCommon(TestCase):
def test_parse_filters_simple_tag_filter(self):
filters = parse_filters(["Name=tags.costCenter;Value=20000"])
assert_that(filters).is_length(1)
assert_that(filters).contains(ResourceTag(key="costCenter", value="20000"))
assert_that(filters).contains(Filterable(key="costCenter", value="20000"))

def test_parse_filters_type_filter(self):
filters = parse_filters(["Name=type;Value=aws_lambda_function"])
assert_that(filters).is_length(1)
assert_that(filters).contains(ResourceType(type="aws_lambda_function"))
assert_that(filters).contains(Filterable(type="aws_lambda_function"))

def test_parse_filters_wrong_filter(self):
filters = parse_filters(["Name=wrong;Value=value"])
Expand All @@ -23,14 +23,14 @@ def test_parse_filters_wrong_filter(self):
def test_parse_filters_two_values_tag_filter(self):
filters = parse_filters(["Name=tags.costCenter;Value=20000:20001"])
assert_that(filters).is_length(2)
assert_that(filters).contains(ResourceTag(key="costCenter", value="20000"))
assert_that(filters).contains(ResourceTag(key="costCenter", value="20001"))
assert_that(filters).contains(Filterable(key="costCenter", value="20000"))
assert_that(filters).contains(Filterable(key="costCenter", value="20001"))

def test_parse_filters_two_complex_values_tag_filter(self):
filters = parse_filters(["Name=tags.costCenter;Value=20000:'20000:1'"])
assert_that(filters).is_length(2)
assert_that(filters).contains(ResourceTag(key="costCenter", value="20000"))
assert_that(filters).contains(ResourceTag(key="costCenter", value="20000:1"))
assert_that(filters).contains(Filterable(key="costCenter", value="20000"))
assert_that(filters).contains(Filterable(key="costCenter", value="20000:1"))

def test_parse_filters_invalid_tag_parts_filter(self):
filters = parse_filters(["Name=tags.;costCenter;Value=20000"])
Expand Down

0 comments on commit c675f41

Please sign in to comment.