forked from jlee-made/aws-fuzzy-finder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests.py
64 lines (60 loc) · 1.89 KB
/
tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
from aws_fuzzy_finder.aws_utils import prepare_searchable_instances
class TestInstanceView:
example_reservations = [{
u'Groups': [],
u'Instances': [{
u'PrivateIpAddress': '10.121.111.123',
u'State': {
u'Code': 16,
u'Name': 'running'
},
u'Tags': [{
u'Key': 'Name',
u'Value': 'test_foobar"'
}],
u'VpcId': 'vpc-f2ccsd34f'
}, {
u'PrivateIpAddress': '10.121.12.34',
u'State': {
u'Code': 16,
u'Name': 'running'
},
u'Tags': [{
u'Key': 'Name',
u'Value': 'prod_something'
}],
u'VpcId': 'vpc-2342sfd2'
}, {
u'PrivateIpAddress': '10.121.12.55',
u'PublicIpAddress': '52.123.12.32',
u'State': {
u'Code': 16,
u'Name': 'running'
},
u'Tags': [{
u'Key': 'Name',
u'Value': 'prod_something2'
}],
u'VpcId': 'vpc-2342sfd2'
}]
}]
def test_getting_private_ip(self):
searchable_instances = prepare_searchable_instances(
reservations=self.example_reservations,
use_private_ip=True
)
assert searchable_instances == [
'test_foobar @ 10.121.111.123',
'prod_something @ 10.121.12.34',
'prod_something2 @ 10.121.12.55',
]
def test_getting_public_ip(self):
searchable_instances = prepare_searchable_instances(
reservations=self.example_reservations,
use_private_ip=False
)
assert searchable_instances == [
'test_foobar @ 10.121.111.123',
'prod_something @ 10.121.12.34',
'prod_something2 @ 52.123.12.32',
]