Skip to content

Commit

Permalink
Add more unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-dileo committed Oct 20, 2015
1 parent daa47b1 commit d6d318e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 1 addition & 7 deletions pyeapi/api/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def getall(self):
for name in interfaces_re.findall(self.config):
interface = self.get(name)
if interface:
response[name] = interface
response['name'] = interface
return response

def __getattr__(self, name):
Expand Down Expand Up @@ -172,7 +172,6 @@ def get(self, name):
resource.update(self._parse_description(config))
return resource


def _parse_shutdown(self, config):
"""Scans the specified config block and returns the shutdown value
Expand Down Expand Up @@ -334,7 +333,6 @@ def get(self, name):
resource.update(self._parse_flowcontrol_receive(config))
return resource


def _parse_sflow(self, config):
"""Scans the specified config block and returns the sflow value
Expand Down Expand Up @@ -383,7 +381,6 @@ def _parse_flowcontrol_receive(self, config):
value = match.group(1)
return dict(flowcontrol_receive=value)


def create(self, name):
"""Creating Ethernet interfaces is currently not supported
Expand Down Expand Up @@ -549,7 +546,6 @@ def _parse_minimum_links(self, config):
value = int(match.group(1))
return dict(minimum_links=value)


def get_lacp_mode(self, name):
"""Returns the LACP mode for the specified Port-Channel interface
Expand All @@ -571,8 +567,6 @@ def get_lacp_mode(self, name):
self.get_block('^interface %s' % member))
return match.group('value')



def get_members(self, name):
"""Returns the member interfaces for the specified Port-Channel
Expand Down
4 changes: 4 additions & 0 deletions test/unit/test_api_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ def test_get_interface_ethernet(self):
result = self.instance.get('Ethernet1')
self.assertEqual(result['type'], 'ethernet')

def test_get_invalid_interface(self):
result = self.instance.get('Foo1')
self.assertEqual(result, None)

def test_proxy_method_success(self):
result = self.instance.set_sflow('Ethernet1', True)
self.assertTrue(result)
Expand Down

0 comments on commit d6d318e

Please sign in to comment.